Add strlcpy() function
[nasm.git] / Mkfiles / owlinux.mak
blob8b3a8240cff3350b625d6c6101a9d1b94709d10f
1 # -*- makefile -*-
3 # Makefile for cross-compiling NASM from Linux
4 # to DOS, Win32 or OS/2 using OpenWatcom.
6 # Please see http://bugzilla.openwatcom.org/show_bug.cgi?id=751
7 # for some caveats in using OpenWatcom as a cross-compiler
8 # from Linux, in particular:
10 # > Second and more importantly, the makefile needs to ensure that the
11 # > proper headers are included. This is normally not a problem when
12 # > building on DOS, Windows, or OS/2, as they share the same C
13 # > library headers. But when cross-compiling from (or to) Linux, it
14 # > is crucial.
15 # >
16 # > This may be accomplished by setting the INCLUDE env var in the
17 # > makefile, or setting OS2_INCLUDE, DOS_INCLUDE, NT_INCLUDE env vars
18 # > *and* making sure that the proper -bt switch is used, or passing a
19 # > switch like -I"$(%WATCOM)/h". The last variant is probably the
20 # > easiest to implement and least likely to break.
23 top_srcdir = .
24 srcdir = .
25 prefix = C:/Program Files/NASM
26 exec_prefix = $(prefix)
27 bindir = $(prefix)/bin
28 mandir = $(prefix)/man
30 CC = wcl386
31 DEBUG =
32 CFLAGS = -6 -ox -wx -ze -fpi $(DEBUG)
33 BUILD_CFLAGS = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes
34 INTERNAL_CFLAGS = -I$(srcdir) -I. \
35 -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
36 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
37 LD = $(CC)
38 LDFLAGS = $(ALL_CFLAGS)
39 LIBS =
40 PERL = perl -I$(srcdir)/perllib
42 STRIP = wstrip
44 # Binary suffixes
45 O = obj
46 X = .exe
48 # WMAKE errors out if a suffix is declared more than once, including
49 # its own built-in declarations. Thus, we need to explicitly clear the list
50 # first. Also, WMAKE only allows implicit rules that point "to the left"
51 # in this list!
52 .SUFFIXES:
53 .SUFFIXES: .man .1 .$(O) .i .c
55 .c.$(O):
56 $(CC) -c $(ALL_CFLAGS) -fo=$@ $<
58 #-- Begin File Lists --#
59 # Edit in Makefile.in, not here!
60 NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \
61 raa.$(O) saa.$(O) rbtree.$(O) \
62 float.$(O) insnsa.$(O) insnsb.$(O) \
63 directives.$(O) \
64 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
65 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
66 output/nullout.$(O) \
67 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
68 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
69 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
70 output/outdbg.$(O) output/outieee.$(O) output/outmacho32.$(O) \
71 output/outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
72 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
73 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
74 lib/strlcpy.$(O)
76 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
77 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
78 #-- End File Lists --#
80 what:
81 @echo 'Please build "dos", "win32" or "os2"'
83 dos:
84 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G'
86 win32:
87 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT'
89 os2:
90 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2'
92 all: nasm$(X) ndisasm$(X)
94 nasm$(X): $(NASM)
95 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
97 ndisasm$(X): $(NDISASM)
98 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
100 # These source files are automagically generated from a single
101 # instruction-table file by a Perl script. They're distributed,
102 # though, so it isn't necessary to have Perl just to recompile NASM
103 # from the distribution.
105 insnsb.c: insns.dat insns.pl
106 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
107 insnsa.c: insns.dat insns.pl
108 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
109 insnsd.c: insns.dat insns.pl
110 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
111 insnsi.h: insns.dat insns.pl
112 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
113 insnsn.c: insns.dat insns.pl
114 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
116 # These files contains all the standard macros that are derived from
117 # the version number.
118 version.h: version version.pl
119 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
121 version.mac: version version.pl
122 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
124 # This source file is generated from the standard macros file
125 # `standard.mac' by another Perl script. Again, it's part of the
126 # standard distribution.
128 macros.c: macros.pl standard.mac version.mac
129 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
131 # These source files are generated from regs.dat by yet another
132 # perl script.
133 regs.c: regs.dat regs.pl
134 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
135 regflags.c: regs.dat regs.pl
136 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
137 regdis.c: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
139 regdis.h: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
141 regvals.c: regs.dat regs.pl
142 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
143 regs.h: regs.dat regs.pl
144 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
146 # Assembler token hash
147 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
148 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
149 $(srcdir)/tokens.dat > tokhash.c
151 # Assembler token metadata
152 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
153 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
154 $(srcdir)/tokens.dat > tokens.h
156 # Preprocessor token hash
157 pptok.h: pptok.dat pptok.pl perllib/phash.ph
158 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
159 pptok.c: pptok.dat pptok.pl perllib/phash.ph
160 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
162 # This target generates all files that require perl.
163 # This allows easier generation of distribution (see dist target).
164 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
165 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
166 tokhash.c tokens.h pptok.h pptok.c \
167 version.h version.mac
168 perlreq: $(PERLREQ)
170 clean:
171 -rm -f *.$(O)
172 -rm -f *.s
173 -rm -f *.i
174 -rm -f output/*.$(O)
175 -rm -f output/*.s
176 -rm -f output/*.i
177 -rm -f nasm$(X)
178 -rm -f ndisasm$(X)
179 # cd rdoff && $(MAKE) clean
181 distclean: clean .SYMBOLIC
182 -rm -f config.h
183 -rm -f config.log
184 -rm -f config.status
185 -rm -f Makefile
186 -rm -f *~
187 -rm -f *.bak
188 -rm -f *.lst
189 -rm -f *.bin
190 -rm -f output/*~
191 -rm -f output/*.bak
192 -rm -f test/*.lst
193 -rm -f test/*.bin
194 -rm -f test/*.$(O)
195 -rm -f test/*.bin
196 -rm -f/s autom4te*.cache
197 # cd rdoff && $(MAKE) distclean
199 cleaner: clean .SYMBOLIC
200 -rm -f $(PERLREQ)
201 -rm -f *.man
202 -rm -f nasm.spec
203 # cd doc && $(MAKE) clean
205 spotless: distclean cleaner .SYMBOLIC
206 -rm -f doc/Makefile
207 -rm -f doc/*~
208 -rm -f doc/*.bak
210 strip:
211 $(STRIP) *.exe
213 rdf:
214 # cd rdoff && $(MAKE)
216 doc:
217 # cd doc && $(MAKE) all
219 everything: all doc rdf
221 #-- Magic hints to mkdep.pl --#
222 # @object-ending: ".$(O)"
223 # @path-separator: "/"
224 # @exclude: "config.h"
225 # @continuation: "\"
226 #-- Everything below is generated by mkdep.pl - do not edit --#
227 assemble.$(O): assemble.c assemble.h compiler.h directives.h insns.h \
228 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
229 crc64.$(O): crc64.c compiler.h nasmlib.h
230 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h \
231 nasm.h nasmlib.h pptok.h preproc.h regs.h
232 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
233 nasm.h nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
234 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h \
235 nasm.h nasmlib.h pptok.h preproc.h regs.h
236 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
237 pptok.h preproc.h regs.h
238 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h \
239 nasmlib.h pptok.h preproc.h regs.h
240 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
241 nasmlib.h pptok.h preproc.h regs.h
242 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h \
243 nasmlib.h pptok.h preproc.h regs.h tokens.h
244 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h \
245 nasmlib.h pptok.h preproc.h regs.h tokens.h
246 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h \
247 nasmlib.h pptok.h preproc.h regs.h tokens.h
248 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
249 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
250 nasmlib.h pptok.h preproc.h regs.h
251 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
252 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
253 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
254 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h \
255 nasmlib.h pptok.h preproc.h regs.h
256 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
257 nasmlib.h output/outform.h pptok.h preproc.h regs.h tables.h
258 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h \
259 insnsi.h labels.h listing.h nasm.h nasmlib.h output/outform.h parser.h \
260 pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
261 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h \
262 nasmlib.h pptok.h preproc.h regs.h tokens.h
263 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
264 nasm.h nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
265 output/nulldbg.$(O): output/nulldbg.c compiler.h directives.h insnsi.h \
266 nasm.h nasmlib.h pptok.h preproc.h regs.h
267 output/nullout.$(O): output/nullout.c compiler.h directives.h insnsi.h \
268 nasm.h nasmlib.h output/outlib.h pptok.h preproc.h regs.h
269 output/outaout.$(O): output/outaout.c compiler.h directives.h eval.h \
270 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
271 preproc.h raa.h regs.h saa.h stdscan.h
272 output/outas86.$(O): output/outas86.c compiler.h directives.h insnsi.h \
273 nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
274 regs.h saa.h
275 output/outbin.$(O): output/outbin.c compiler.h directives.h eval.h insnsi.h \
276 labels.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
277 preproc.h regs.h saa.h stdscan.h
278 output/outcoff.$(O): output/outcoff.c compiler.h directives.h eval.h \
279 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
280 preproc.h raa.h regs.h saa.h
281 output/outdbg.$(O): output/outdbg.c compiler.h directives.h insnsi.h nasm.h \
282 nasmlib.h output/outform.h pptok.h preproc.h regs.h
283 output/outelf.$(O): output/outelf.c compiler.h directives.h insnsi.h nasm.h \
284 nasmlib.h output/dwarf.h output/elfcommon.h output/outelf.h \
285 output/outform.h pptok.h preproc.h regs.h
286 output/outelf32.$(O): output/outelf32.c compiler.h directives.h eval.h \
287 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elf32.h output/elfcommon.h \
288 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
289 rbtree.h regs.h saa.h stdscan.h
290 output/outelf64.$(O): output/outelf64.c compiler.h directives.h eval.h \
291 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elf64.h output/elfcommon.h \
292 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
293 rbtree.h regs.h saa.h stdscan.h
294 output/outform.$(O): output/outform.c compiler.h directives.h insnsi.h \
295 nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h
296 output/outieee.$(O): output/outieee.c compiler.h directives.h insnsi.h \
297 nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h
298 output/outlib.$(O): output/outlib.c compiler.h directives.h insnsi.h nasm.h \
299 nasmlib.h output/outlib.h pptok.h preproc.h regs.h
300 output/outmacho32.$(O): output/outmacho32.c compiler.h directives.h eval.h \
301 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
302 preproc.h raa.h regs.h saa.h
303 output/outmacho64.$(O): output/outmacho64.c compiler.h directives.h insnsi.h \
304 nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
305 regs.h saa.h
306 output/outobj.$(O): output/outobj.c compiler.h directives.h eval.h insnsi.h \
307 nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h \
308 stdscan.h
309 output/outrdf.$(O): output/outrdf.c compiler.h directives.h insnsi.h nasm.h \
310 nasmlib.h output/outform.h pptok.h preproc.h regs.h
311 output/outrdf2.$(O): output/outrdf2.c compiler.h directives.h insnsi.h \
312 nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h \
313 rdoff/rdoff.h regs.h saa.h
314 parser.$(O): parser.c compiler.h directives.h eval.h float.h insns.h \
315 insnsi.h nasm.h nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h \
316 tables.h tokens.h
317 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
318 preproc.$(O): preproc.c compiler.h directives.h eval.h hashtbl.h insnsi.h \
319 nasm.h nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h \
320 tokens.h
321 quote.$(O): quote.c compiler.h nasmlib.h quote.h
322 raa.$(O): raa.c compiler.h nasmlib.h raa.h
323 rbtree.$(O): rbtree.c compiler.h rbtree.h
324 regdis.$(O): regdis.c regdis.h regs.h
325 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
326 pptok.h preproc.h regs.h tables.h
327 regs.$(O): regs.c compiler.h insnsi.h tables.h
328 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
329 saa.$(O): saa.c compiler.h nasmlib.h saa.h
330 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h \
331 nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
332 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
333 pptok.h preproc.h regs.h
334 sync.$(O): sync.c compiler.h nasmlib.h sync.h
335 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h \
336 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
337 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h pptok.h \
338 preproc.h regs.h version.h