BR3392240: preproc: Don't fail on pasting of space expanded rvalue tokens
[nasm.git] / Mkfiles / openwcom.mak
blobf70e59b4a6821d94826b3f8410148cb23da078c1
1 # -*- makefile -*-
3 # Makefile for building NASM using OpenWatcom
4 # cross-compile on a DOS/Win32/OS2/Linux platform host
7 top_srcdir = .
8 srcdir = .
9 VPATH = .;$(srcdir)/output;$(srcdir)/lib
10 prefix = C:\Program Files\NASM
11 exec_prefix = $(prefix)
12 bindir = $(prefix)\bin
13 mandir = $(prefix)\man
15 CC = *wcl386
16 DEBUG =
17 CFLAGS = -zq -6 -ox -wx -ze -fpi $(DEBUG)
18 BUILD_CFLAGS = $(CFLAGS) $(%TARGET_CFLAGS)
19 INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_CONFIG_H
20 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
21 LD = *wlink
22 LDEBUG =
23 LDFLAGS = op quiet $(%TARGET_LFLAGS) $(LDEBUG)
24 LIBS =
25 PERL = perl -I$(srcdir)/perllib
27 STRIP = wstrip
29 # Binary suffixes
30 O = obj
31 X = .exe
33 # WMAKE errors out if a suffix is declared more than once, including
34 # its own built-in declarations. Thus, we need to explicitly clear the list
35 # first. Also, WMAKE only allows implicit rules that point "to the left"
36 # in this list!
37 .SUFFIXES:
38 .SUFFIXES: .man .1 .$(O) .i .c
40 # Needed to find C files anywhere but in the current directory
41 .c : $(VPATH)
43 .c.$(O):
44 @set INCLUDE=
45 $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
47 #-- Begin File Lists --#
48 # Edit in Makefile.in, not here!
49 NASM = nasm.$(O) nasmlib.$(O) ver.$(O) &
50 raa.$(O) saa.$(O) rbtree.$(O) &
51 float.$(O) insnsa.$(O) insnsb.$(O) &
52 directiv.$(O) &
53 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) &
54 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) &
55 output/nullout.$(O) &
56 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) &
57 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) &
58 output/outelfx32.$(O) &
59 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) &
60 output/outdbg.$(O) output/outieee.$(O) output/outmac32.$(O) &
61 output/outmac64.$(O) preproc.$(O) quote.$(O) pptok.$(O) &
62 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) &
63 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) &
64 ilog2.$(O) &
65 lib/strlcpy.$(O) &
66 preproc-nop.$(O)
68 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) &
69 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
70 #-- End File Lists --#
72 what: .SYMBOLIC
73 @echo Please build "dos", "win32", "os2" or "linux386"
75 dos: .SYMBOLIC
76 @set TARGET_CFLAGS=-bt=DOS -I"$(%WATCOM)/h"
77 @set TARGET_LFLAGS=sys causeway
78 @%make all
80 win32: .SYMBOLIC
81 @set TARGET_CFLAGS=-bt=NT -I"$(%WATCOM)/h" -I"$(%WATCOM)/h/nt"
82 @set TARGET_LFLAGS=sys nt
83 @%make all
85 os2: .SYMBOLIC
86 @set TARGET_CFLAGS=-bt=OS2 -I"$(%WATCOM)/h" -I"$(%WATCOM)/h/os2"
87 @set TARGET_LFLAGS=sys os2v2
88 @%make all
90 linux386: .SYMBOLIC
91 @set TARGET_CFLAGS=-bt=LINUX -I"$(%WATCOM)/lh"
92 @set TARGET_LFLAGS=sys linux
93 @%make all
95 all: config.h perlreq nasm$(X) ndisasm$(X) .SYMBOLIC
96 # cd rdoff && $(MAKE) all
98 nasm$(X): $(NASM)
99 $(LD) $(LDFLAGS) name nasm$(X) file {$(NASM)} $(LIBS)
101 ndisasm$(X): $(NDISASM)
102 $(LD) $(LDFLAGS) name ndisasm$(X) file {$(NDISASM)} $(LIBS)
104 # These source files are automagically generated from a single
105 # instruction-table file by a Perl script. They're distributed,
106 # though, so it isn't necessary to have Perl just to recompile NASM
107 # from the distribution.
109 insnsb.c: insns.dat insns.pl
110 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
111 insnsa.c: insns.dat insns.pl
112 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
113 insnsd.c: insns.dat insns.pl
114 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
115 insnsi.h: insns.dat insns.pl
116 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
117 insnsn.c: insns.dat insns.pl
118 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
120 # These files contains all the standard macros that are derived from
121 # the version number.
122 version.h: version version.pl
123 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
125 version.mac: version version.pl
126 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
128 # This source file is generated from the standard macros file
129 # `standard.mac' by another Perl script. Again, it's part of the
130 # standard distribution.
132 macros.c: macros.pl standard.mac version.mac macros/*.mac output/*.mac
133 $(PERL) $<
135 # These source files are generated from regs.dat by yet another
136 # perl script.
137 regs.c: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
139 regflags.c: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
141 regdis.c: regs.dat regs.pl
142 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
143 regdis.h: regs.dat regs.pl
144 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
145 regvals.c: regs.dat regs.pl
146 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
147 regs.h: regs.dat regs.pl
148 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
150 # Assembler token hash
151 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
152 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat &
153 $(srcdir)/tokens.dat > tokhash.c
155 # Assembler token metadata
156 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
157 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat &
158 $(srcdir)/tokens.dat > tokens.h
160 # Preprocessor token hash
161 pptok.h: pptok.dat pptok.pl perllib/phash.ph
162 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
163 pptok.c: pptok.dat pptok.pl perllib/phash.ph
164 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
165 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
166 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
168 # Directives hash
169 directiv.h: directiv.dat directiv.pl perllib/phash.ph
170 $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
171 directiv.c: directiv.dat directiv.pl perllib/phash.ph
172 $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
174 # This target generates all files that require perl.
175 # This allows easier generation of distribution (see dist target).
176 PERLREQ = pptok.ph macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c &
177 regs.c regs.h regflags.c regdis.c regdis.h regvals.c &
178 tokhash.c tokens.h pptok.h pptok.c &
179 directiv.c directiv.h &
180 version.h version.mac
181 perlreq: $(PERLREQ) .SYMBOLIC
183 clean: .SYMBOLIC
184 rm -f *.$(O) *.s *.i
185 rm -f lib/*.$(O) lib/*.s lib/*.i
186 rm -f output/*.$(O) output/*.s output/*.i
187 rm -f config.h config.log config.status
188 rm -f nasm$(X) ndisasm$(X)
189 # cd rdoff && $(MAKE) clean
191 distclean: clean .SYMBOLIC
192 rm -f config.h config.log config.status
193 rm -f Makefile *~ *.bak *.lst *.bin
194 rm -f output/*~ output/*.bak
195 rm -f test/*.lst test/*.bin test/*.$(O) test/*.bin
196 # -del /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 doc/*~ doc/*.bak
208 strip: .SYMBOLIC
209 $(STRIP) *.exe
211 rdf:
212 # cd rdoff && $(MAKE)
214 doc:
215 # cd doc && $(MAKE) all
217 everything: all doc rdf
219 config.h: Mkfiles/openwcom.mak
220 @echo Creating $@
221 @%create $@
222 @%append $@ $#define HAVE_DECL_STRCASECMP 1
223 @%append $@ $#define HAVE_DECL_STRICMP 1
224 @%append $@ $#define HAVE_DECL_STRLCPY 1
225 @%append $@ $#define HAVE_DECL_STRNCASECMP 1
226 @%append $@ $#define HAVE_DECL_STRNICMP 1
227 @%append $@ $#define HAVE_INTTYPES_H 1
228 @%append $@ $#define HAVE_LIMITS_H 1
229 @%append $@ $#define HAVE_MEMORY_H 1
230 @%append $@ $#define HAVE_SNPRINTF 1
231 @%append $@ $#define HAVE_STDBOOL_H 1
232 @%append $@ $#define HAVE_STDINT_H 1
233 @%append $@ $#define HAVE_STDLIB_H 1
234 @%append $@ $#define HAVE_STRCASECMP 1
235 @%append $@ $#define HAVE_STRCSPN 1
236 @%append $@ $#define HAVE_STRICMP 1
237 @%append $@ $#define HAVE_STRINGS_H 1
238 @%append $@ $#define HAVE_STRING_H 1
239 @%append $@ $#define HAVE_STRLCPY 1
240 @%append $@ $#define HAVE_STRNCASECMP 1
241 @%append $@ $#define HAVE_STRNICMP 1
242 @%append $@ $#define HAVE_STRSPN 1
243 @%append $@ $#define HAVE_SYS_STAT_H 1
244 @%append $@ $#define HAVE_SYS_TYPES_H 1
245 @%append $@ $#define HAVE_UNISTD_H 1
246 @%append $@ $#define HAVE_VSNPRINTF 1
247 @%append $@ $#define STDC_HEADERS 1
250 # This build dependencies in *ALL* makefiles. Partially for that reason,
251 # it's expected to be invoked manually.
253 alldeps: perlreq .SYMBOLIC
254 $(PERL) syncfiles.pl Makefile.in Mkfiles/openwcom.mak
255 $(PERL) mkdep.pl -M Makefile.in Mkfiles/openwcom.mak -- . output lib
257 #-- Magic hints to mkdep.pl --#
258 # @object-ending: ".$(O)"
259 # @path-separator: "/"
260 # @exclude: ""
261 # @continuation: "&"
262 #-- Everything below is generated by mkdep.pl - do not edit --#
263 assemble.$(O): assemble.c assemble.h compiler.h config.h directiv.h insns.h &
264 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h &
265 tokens.h
266 crc64.$(O): crc64.c compiler.h config.h nasmlib.h
267 directiv.$(O): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h &
268 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
269 disasm.$(O): disasm.c compiler.h config.h directiv.h disasm.h insns.h &
270 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h &
271 sync.h tables.h tokens.h
272 eval.$(O): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h &
273 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
274 exprlib.$(O): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h &
275 nasmlib.h opflags.h pptok.h preproc.h regs.h
276 float.$(O): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h &
277 nasmlib.h opflags.h pptok.h preproc.h regs.h
278 hashtbl.$(O): hashtbl.c compiler.h config.h directiv.h hashtbl.h insnsi.h &
279 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
280 ilog2.$(O): ilog2.c compiler.h config.h nasmlib.h
281 insnsa.$(O): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h &
282 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
283 insnsb.$(O): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h &
284 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
285 insnsd.$(O): insnsd.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h &
286 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
287 insnsn.$(O): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
288 labels.$(O): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h &
289 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
290 lib/snprintf.$(O): lib/snprintf.c compiler.h config.h nasmlib.h
291 lib/strlcpy.$(O): lib/strlcpy.c compiler.h config.h
292 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h config.h nasmlib.h
293 listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h &
294 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
295 macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h &
296 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h &
297 tables.h
298 nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h &
299 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h &
300 output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h &
301 tokens.h
302 nasmlib.$(O): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h &
303 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
304 ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h &
305 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h &
306 tokens.h
307 output/nulldbg.$(O): output/nulldbg.c compiler.h config.h directiv.h &
308 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
309 output/nullout.$(O): output/nullout.c compiler.h config.h directiv.h &
310 insnsi.h nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h &
311 regs.h
312 output/outaout.$(O): output/outaout.c compiler.h config.h directiv.h eval.h &
313 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
314 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
315 output/outas86.$(O): output/outas86.c compiler.h config.h directiv.h &
316 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
317 pptok.h preproc.h raa.h regs.h saa.h
318 output/outbin.$(O): output/outbin.c compiler.h config.h directiv.h eval.h &
319 insnsi.h labels.h nasm.h nasmlib.h opflags.h output/outform.h &
320 output/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
321 output/outcoff.$(O): output/outcoff.c compiler.h config.h directiv.h eval.h &
322 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
323 output/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
324 output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h &
325 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
326 output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h insnsi.h &
327 nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h &
328 output/outform.h pptok.h preproc.h regs.h
329 output/outelf32.$(O): output/outelf32.c compiler.h config.h directiv.h &
330 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h &
331 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h &
332 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
333 output/outelf64.$(O): output/outelf64.c compiler.h config.h directiv.h &
334 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h &
335 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h &
336 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
337 output/outelfx32.$(O): output/outelfx32.c compiler.h config.h directiv.h &
338 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h &
339 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h &
340 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
341 output/outform.$(O): output/outform.c compiler.h config.h directiv.h &
342 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h &
343 regs.h
344 output/outieee.$(O): output/outieee.c compiler.h config.h directiv.h &
345 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
346 pptok.h preproc.h regs.h
347 output/outlib.$(O): output/outlib.c compiler.h config.h directiv.h insnsi.h &
348 nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
349 output/outmac32.$(O): output/outmac32.c compiler.h config.h directiv.h &
350 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
351 pptok.h preproc.h raa.h regs.h saa.h
352 output/outmac64.$(O): output/outmac64.c compiler.h config.h directiv.h &
353 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
354 pptok.h preproc.h raa.h regs.h saa.h
355 output/outobj.$(O): output/outobj.c compiler.h config.h directiv.h eval.h &
356 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
357 pptok.h preproc.h regs.h stdscan.h
358 output/outrdf2.$(O): output/outrdf2.c compiler.h config.h directiv.h &
359 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h &
360 pptok.h preproc.h rdoff/rdoff.h regs.h saa.h
361 parser.$(O): parser.c compiler.h config.h directiv.h eval.h float.h insns.h &
362 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h &
363 stdscan.h tables.h tokens.h
364 pptok.$(O): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h &
365 preproc.h
366 preproc-nop.$(O): preproc-nop.c compiler.h config.h directiv.h insnsi.h &
367 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
368 preproc.$(O): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h &
369 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h &
370 stdscan.h tables.h tokens.h
371 quote.$(O): quote.c compiler.h config.h nasmlib.h quote.h
372 raa.$(O): raa.c compiler.h config.h nasmlib.h raa.h
373 rbtree.$(O): rbtree.c compiler.h config.h rbtree.h
374 regdis.$(O): regdis.c regdis.h regs.h
375 regflags.$(O): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h &
376 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
377 regs.$(O): regs.c compiler.h config.h insnsi.h opflags.h tables.h
378 regvals.$(O): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
379 saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h
380 stdscan.$(O): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h &
381 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h &
382 tokens.h
383 strfunc.$(O): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h &
384 nasmlib.h opflags.h pptok.h preproc.h regs.h
385 sync.$(O): sync.c compiler.h config.h nasmlib.h sync.h
386 tokhash.$(O): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h &
387 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
388 ver.$(O): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h &
389 opflags.h pptok.h preproc.h regs.h version.h