Fix memory management issues with expanded %include
[nasm/avx512.git] / Mkfiles / owlinux.mak
blobab44fbb619b7cc597c5206c99bbb53cb9033af81
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 NASM = nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) insnsb.$(O) \
59 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
60 outform.$(O) output/outbin.$(O) \
61 output/outaout.$(O) output/outcoff.$(O) \
62 output/outelf32.$(O) output/outelf64.$(O) \
63 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
64 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
65 preproc.$(O) quote.$(O) pptok.$(O) macros.$(O) \
66 listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) tokhash.$(O) \
67 regvals.$(O) regflags.$(O)
69 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) \
70 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
72 what:
73 @echo 'Please build "dos", "win32" or "os2"'
75 dos:
76 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G'
78 win32:
79 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT'
81 os2:
82 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2'
84 all: nasm$(X) ndisasm$(X)
86 nasm$(X): $(NASM)
87 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
89 ndisasm$(X): $(NDISASM)
90 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
92 # These source files are automagically generated from a single
93 # instruction-table file by a Perl script. They're distributed,
94 # though, so it isn't necessary to have Perl just to recompile NASM
95 # from the distribution.
97 insnsb.c: insns.dat insns.pl
98 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
99 insnsa.c: insns.dat insns.pl
100 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
101 insnsd.c: insns.dat insns.pl
102 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
103 insnsi.h: insns.dat insns.pl
104 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
105 insnsn.c: insns.dat insns.pl
106 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
108 # These files contains all the standard macros that are derived from
109 # the version number.
110 version.h: version version.pl
111 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
113 version.mac: version version.pl
114 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
116 # This source file is generated from the standard macros file
117 # `standard.mac' by another Perl script. Again, it's part of the
118 # standard distribution.
120 macros.c: macros.pl standard.mac version.mac
121 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
123 # These source files are generated from regs.dat by yet another
124 # perl script.
125 regs.c: regs.dat regs.pl
126 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
127 regflags.c: regs.dat regs.pl
128 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
129 regdis.c: regs.dat regs.pl
130 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
131 regdis.h: regs.dat regs.pl
132 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
133 regvals.c: regs.dat regs.pl
134 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
135 regs.h: regs.dat regs.pl
136 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
138 # Assembler token hash
139 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
140 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
141 $(srcdir)/tokens.dat > tokhash.c
143 # Assembler token metadata
144 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
145 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
146 $(srcdir)/tokens.dat > tokens.h
148 # Preprocessor token hash
149 pptok.h: pptok.dat pptok.pl perllib/phash.ph
150 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
151 pptok.c: pptok.dat pptok.pl perllib/phash.ph
152 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
154 # This target generates all files that require perl.
155 # This allows easier generation of distribution (see dist target).
156 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
157 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
158 tokhash.c tokens.h pptok.h pptok.c \
159 version.h version.mac
160 perlreq: $(PERLREQ)
162 clean:
163 -rm -f *.$(O)
164 -rm -f *.s
165 -rm -f *.i
166 -rm -f output/*.$(O)
167 -rm -f output/*.s
168 -rm -f output/*.i
169 -rm -f nasm$(X)
170 -rm -f ndisasm$(X)
171 # cd rdoff && $(MAKE) clean
173 distclean: clean .SYMBOLIC
174 -rm -f config.h
175 -rm -f config.log
176 -rm -f config.status
177 -rm -f Makefile
178 -rm -f *~
179 -rm -f *.bak
180 -rm -f *.lst
181 -rm -f *.bin
182 -rm -f output/*~
183 -rm -f output/*.bak
184 -rm -f test/*.lst
185 -rm -f test/*.bin
186 -rm -f test/*.$(O)
187 -rm -f test/*.bin
188 -rm -f/s autom4te*.cache
189 # cd rdoff && $(MAKE) distclean
191 cleaner: clean .SYMBOLIC
192 -rm -f $(PERLREQ)
193 -rm -f *.man
194 -rm -f nasm.spec
195 # cd doc && $(MAKE) clean
197 spotless: distclean cleaner .SYMBOLIC
198 -rm -f doc/Makefile
199 -rm -f doc/*~
200 -rm -f doc/*.bak
202 strip:
203 $(STRIP) *.exe
205 rdf:
206 # cd rdoff && $(MAKE)
208 doc:
209 # cd doc && $(MAKE) all
211 everything: all doc rdf
213 #-- Magic hints to mkdep.pl --#
214 # @object-ending: ".$(O)"
215 # @path-separator: "/"
216 # @exclude: "config.h"
217 # @continuation: "\"
218 #-- Everything below is generated by mkdep.pl - do not edit --#
219 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
220 nasmlib.h regs.h tables.h tokens.h version.h
221 crc64.$(O): crc64.c compiler.h
222 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h \
223 regdis.h regs.h sync.h tables.h tokens.h version.h
224 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
225 nasmlib.h regs.h version.h
226 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
227 version.h
228 float.$(O): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h \
229 version.h
230 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
231 regs.h version.h
232 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
233 tokens.h version.h
234 insnsb.$(O): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
235 tokens.h version.h
236 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
237 tokens.h version.h
238 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
239 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h \
240 version.h
241 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
242 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
243 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
244 regs.h version.h
245 macros.$(O): macros.c compiler.h insnsi.h tables.h
246 nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
247 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
248 regs.h stdscan.h tokens.h version.h
249 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
250 tokens.h version.h
251 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
252 nasmlib.h regs.h sync.h tokens.h version.h
253 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
254 regs.h version.h
255 output/outaout.$(O): output/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
256 outform.h regs.h stdscan.h version.h
257 output/outas86.$(O): output/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
258 outform.h regs.h version.h
259 output/outbin.$(O): output/outbin.c compiler.h eval.h insnsi.h labels.h \
260 nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
261 output/outcoff.$(O): output/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
262 outform.h regs.h version.h
263 output/outdbg.$(O): output/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
264 outform.h regs.h version.h
265 output/outelf32.$(O): output/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
266 outform.h regs.h stdscan.h version.h wsaa.h
267 output/outelf64.$(O): output/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
268 outform.h regs.h stdscan.h version.h wsaa.h
269 output/outieee.$(O): output/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
270 outform.h regs.h version.h
271 output/outmacho.$(O): output/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
272 outform.h regs.h version.h
273 output/outobj.$(O): output/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
274 outform.h regs.h stdscan.h version.h
275 output/outrdf.$(O): output/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
276 outform.h regs.h version.h
277 output/outrdf2.$(O): output/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
278 outform.h rdoff/rdoff.h regs.h version.h
279 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
280 parser.h regs.h stdscan.h tables.h tokens.h version.h
281 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
282 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
283 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
284 quote.$(O): quote.c compiler.h nasmlib.h quote.h
285 regdis.$(O): regdis.c regdis.h regs.h
286 regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
287 tables.h version.h
288 regs.$(O): regs.c compiler.h insnsi.h tables.h
289 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
290 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h quote.h \
291 regs.h stdscan.h tokens.h version.h
292 sync.$(O): sync.c compiler.h nasmlib.h sync.h
293 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
294 nasmlib.h regs.h tokens.h version.h