NASM 2.09rc7
[nasm/avx512.git] / Mkfiles / owlinux.mak
blob697987658096f6ea7c7bf4df18f9987dde5d7874
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 directiv.$(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/outmac32.$(O) \
71 output/outmac64.$(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 ilog2.$(O) \
75 lib/strlcpy.$(O)
77 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
78 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
79 #-- End File Lists --#
81 what:
82 @echo 'Please build "dos", "win32" or "os2"'
84 dos:
85 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G'
87 win32:
88 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT'
90 os2:
91 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2'
93 all: nasm$(X) ndisasm$(X)
95 nasm$(X): $(NASM)
96 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
98 ndisasm$(X): $(NDISASM)
99 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
101 # These source files are automagically generated from a single
102 # instruction-table file by a Perl script. They're distributed,
103 # though, so it isn't necessary to have Perl just to recompile NASM
104 # from the distribution.
106 insnsb.c: insns.dat insns.pl
107 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
108 insnsa.c: insns.dat insns.pl
109 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
110 insnsd.c: insns.dat insns.pl
111 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
112 insnsi.h: insns.dat insns.pl
113 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
114 insnsn.c: insns.dat insns.pl
115 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
117 # These files contains all the standard macros that are derived from
118 # the version number.
119 version.h: version version.pl
120 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
122 version.mac: version version.pl
123 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
125 # This source file is generated from the standard macros file
126 # `standard.mac' by another Perl script. Again, it's part of the
127 # standard distribution.
129 macros.c: macros.pl standard.mac version.mac
130 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
132 # These source files are generated from regs.dat by yet another
133 # perl script.
134 regs.c: regs.dat regs.pl
135 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
136 regflags.c: regs.dat regs.pl
137 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
138 regdis.c: regs.dat regs.pl
139 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
140 regdis.h: regs.dat regs.pl
141 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
142 regvals.c: regs.dat regs.pl
143 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
144 regs.h: regs.dat regs.pl
145 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
147 # Assembler token hash
148 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
149 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
150 $(srcdir)/tokens.dat > tokhash.c
152 # Assembler token metadata
153 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
154 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
155 $(srcdir)/tokens.dat > tokens.h
157 # Preprocessor token hash
158 pptok.h: pptok.dat pptok.pl perllib/phash.ph
159 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
160 pptok.c: pptok.dat pptok.pl perllib/phash.ph
161 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
163 # This target generates all files that require perl.
164 # This allows easier generation of distribution (see dist target).
165 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
166 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
167 tokhash.c tokens.h pptok.h pptok.c \
168 version.h version.mac
169 perlreq: $(PERLREQ)
171 clean:
172 -rm -f *.$(O)
173 -rm -f *.s
174 -rm -f *.i
175 -rm -f lib/*.$(O)
176 -rm -f lib/*.s
177 -rm -f lib/*.i
178 -rm -f output/*.$(O)
179 -rm -f output/*.s
180 -rm -f output/*.i
181 -rm -f nasm$(X)
182 -rm -f ndisasm$(X)
183 # cd rdoff && $(MAKE) clean
185 distclean: clean .SYMBOLIC
186 -rm -f config.h
187 -rm -f config.log
188 -rm -f config.status
189 -rm -f Makefile
190 -rm -f *~
191 -rm -f *.bak
192 -rm -f *.lst
193 -rm -f *.bin
194 -rm -f output/*~
195 -rm -f output/*.bak
196 -rm -f test/*.lst
197 -rm -f test/*.bin
198 -rm -f test/*.$(O)
199 -rm -f test/*.bin
200 -rm -f/s autom4te*.cache
201 # cd rdoff && $(MAKE) distclean
203 cleaner: clean .SYMBOLIC
204 -rm -f $(PERLREQ)
205 -rm -f *.man
206 -rm -f nasm.spec
207 # cd doc && $(MAKE) clean
209 spotless: distclean cleaner .SYMBOLIC
210 -rm -f doc/Makefile
211 -rm -f doc/*~
212 -rm -f doc/*.bak
214 strip:
215 $(STRIP) *.exe
217 rdf:
218 # cd rdoff && $(MAKE)
220 doc:
221 # cd doc && $(MAKE) all
223 everything: all doc rdf
225 #-- Magic hints to mkdep.pl --#
226 # @object-ending: ".$(O)"
227 # @path-separator: "/"
228 # @exclude: "config.h"
229 # @continuation: "\"
230 #-- Everything below is generated by mkdep.pl - do not edit --#
231 assemble.$(O): assemble.c assemble.h compiler.h directiv.h insns.h insnsi.h \
232 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h tokens.h
233 crc64.$(O): crc64.c compiler.h nasmlib.h
234 directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
235 nasmlib.h opflags.h pptok.h preproc.h regs.h
236 disasm.$(O): disasm.c compiler.h directiv.h disasm.h insns.h insnsi.h nasm.h \
237 nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h sync.h tables.h \
238 tokens.h
239 eval.$(O): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
240 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
241 exprlib.$(O): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
242 opflags.h pptok.h preproc.h regs.h
243 float.$(O): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmlib.h \
244 opflags.h pptok.h preproc.h regs.h
245 hashtbl.$(O): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
246 nasmlib.h opflags.h pptok.h preproc.h regs.h
247 ilog2.$(O): ilog2.c compiler.h nasmlib.h
248 insnsa.$(O): insnsa.c compiler.h directiv.h insns.h insnsi.h nasm.h \
249 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
250 insnsb.$(O): insnsb.c compiler.h directiv.h insns.h insnsi.h nasm.h \
251 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
252 insnsd.$(O): insnsd.c compiler.h directiv.h insns.h insnsi.h nasm.h \
253 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
254 insnsn.$(O): insnsn.c compiler.h insnsi.h opflags.h tables.h
255 labels.$(O): labels.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
256 nasmlib.h opflags.h pptok.h preproc.h regs.h
257 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
258 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
259 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
260 listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
261 nasmlib.h opflags.h pptok.h preproc.h regs.h
262 macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
263 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
264 nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h insns.h \
265 insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h output/outform.h \
266 parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
267 nasmlib.$(O): nasmlib.c compiler.h directiv.h insns.h insnsi.h nasm.h \
268 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
269 ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h insns.h insnsi.h \
270 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h tokens.h
271 output/nulldbg.$(O): output/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
272 nasmlib.h opflags.h pptok.h preproc.h regs.h
273 output/nullout.$(O): output/nullout.c compiler.h directiv.h insnsi.h nasm.h \
274 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
275 output/outaout.$(O): output/outaout.c compiler.h directiv.h eval.h insnsi.h \
276 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
277 preproc.h raa.h regs.h saa.h stdscan.h
278 output/outas86.$(O): output/outas86.c compiler.h directiv.h insnsi.h nasm.h \
279 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
280 raa.h regs.h saa.h
281 output/outbin.$(O): output/outbin.c compiler.h directiv.h eval.h insnsi.h \
282 labels.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
283 pptok.h preproc.h regs.h saa.h stdscan.h
284 output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
285 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h output/pecoff.h \
286 pptok.h preproc.h raa.h regs.h saa.h
287 output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
288 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
289 output/outelf.$(O): output/outelf.c compiler.h directiv.h insnsi.h nasm.h \
290 nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
291 output/outform.h pptok.h preproc.h regs.h
292 output/outelf32.$(O): output/outelf32.c compiler.h directiv.h eval.h \
293 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
294 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
295 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
296 output/outelf64.$(O): output/outelf64.c compiler.h directiv.h eval.h \
297 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
298 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
299 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
300 output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
301 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
302 output/outieee.$(O): output/outieee.c compiler.h directiv.h insnsi.h nasm.h \
303 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
304 regs.h
305 output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \
306 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
307 output/outmac32.$(O): output/outmac32.c compiler.h directiv.h eval.h \
308 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
309 pptok.h preproc.h raa.h regs.h saa.h
310 output/outmac64.$(O): output/outmac64.c compiler.h directiv.h insnsi.h \
311 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
312 preproc.h raa.h regs.h saa.h
313 output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \
314 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
315 preproc.h regs.h stdscan.h
316 output/outrdf2.$(O): output/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
317 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
318 rdoff/rdoff.h regs.h saa.h
319 parser.$(O): parser.c compiler.h directiv.h eval.h float.h insns.h insnsi.h \
320 nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h stdscan.h \
321 tables.h tokens.h
322 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
323 preproc.$(O): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
324 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
325 tables.h tokens.h
326 quote.$(O): quote.c compiler.h nasmlib.h quote.h
327 raa.$(O): raa.c compiler.h nasmlib.h raa.h
328 rbtree.$(O): rbtree.c compiler.h rbtree.h
329 regdis.$(O): regdis.c regdis.h regs.h
330 regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
331 opflags.h pptok.h preproc.h regs.h tables.h
332 regs.$(O): regs.c compiler.h insnsi.h opflags.h tables.h
333 regvals.$(O): regvals.c compiler.h insnsi.h opflags.h tables.h
334 saa.$(O): saa.c compiler.h nasmlib.h saa.h
335 stdscan.$(O): stdscan.c compiler.h directiv.h insns.h insnsi.h nasm.h \
336 nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
337 strfunc.$(O): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
338 opflags.h pptok.h preproc.h regs.h
339 sync.$(O): sync.c compiler.h nasmlib.h sync.h
340 tokhash.$(O): tokhash.c compiler.h directiv.h hashtbl.h insns.h insnsi.h \
341 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
342 ver.$(O): ver.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h opflags.h \
343 pptok.h preproc.h regs.h version.h