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