Merge branch 'master' into new-preproc
[platform/upstream/nasm.git] / Mkfiles / openwcom.mak
1 # -*- makefile -*-
2 #
3 # Makefile for building NASM using OpenWatcom 1.7
4 # building on a DOS/Win/OS2 platform host (backslashes
5 # used in pathnames)
6 #
7
8 top_srcdir      = .
9 srcdir          = .
10 VPATH           = .\output
11 prefix          = C:\Program Files\NASM
12 exec_prefix     = $(prefix)
13 bindir          = $(prefix)\bin
14 mandir          = $(prefix)\man
15
16 CC              = wcl386
17 DEBUG           =
18 CFLAGS          = -6 -ox -wx -ze -fpi $(DEBUG)
19 BUILD_CFLAGS    = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes
20 INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
21 ALL_CFLAGS      = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
22 LD              = $(CC)
23 LDFLAGS         = $(ALL_CFLAGS)
24 LIBS            =
25 PERL            = perl -I$(srcdir)/perllib
26
27 STRIP           = wstrip
28
29 # Binary suffixes
30 O               = obj
31 X               = .exe
32
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
39
40 # Needed to find C files anywhere but in the current directory
41 .c : $(VPATH)
42
43 .c.$(O):
44         $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
45
46 # Note: wcl386 is broken if forward slashes are used as path separators.
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         directives.$(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\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) &
59         output\outdbg.$(O) output\outieee.$(O) output\outmacho32.$(O) &
60         output\outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) &
61         macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) &
62         strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O)
63
64 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) &
65         insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
66 #-- End File Lists --#
67
68 what:   .SYMBOLIC
69         @echo Please build "dos", "win32" or "os2"
70
71 dos:    .SYMBOLIC
72         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=DOS -l=DOS4G"
73
74 win32:  .SYMBOLIC
75         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=NT  -l=NT"
76
77 os2:    .SYMBOLIC
78         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=OS2 -l=OS2V2"
79
80 all: nasm$(X) ndisasm$(X) .SYMBOLIC
81         rem cd rdoff && $(MAKE) all
82
83 nasm$(X): $(NASM)
84         $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
85
86 ndisasm$(X): $(NDISASM)
87         $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
88
89 # These source files are automagically generated from a single
90 # instruction-table file by a Perl script. They're distributed,
91 # though, so it isn't necessary to have Perl just to recompile NASM
92 # from the distribution.
93
94 insnsb.c: insns.dat insns.pl
95         $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
96 insnsa.c: insns.dat insns.pl
97         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
98 insnsd.c: insns.dat insns.pl
99         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
100 insnsi.h: insns.dat insns.pl
101         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
102 insnsn.c: insns.dat insns.pl
103         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
104
105 # These files contains all the standard macros that are derived from
106 # the version number.
107 version.h: version version.pl
108         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
109
110 version.mac: version version.pl
111         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
112
113 # This source file is generated from the standard macros file
114 # `standard.mac' by another Perl script. Again, it's part of the
115 # standard distribution.
116
117 macros.c: macros.pl standard.mac version.mac
118         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
119
120 # These source files are generated from regs.dat by yet another
121 # perl script.
122 regs.c: regs.dat regs.pl
123         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
124 regflags.c: regs.dat regs.pl
125         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
126 regdis.c: regs.dat regs.pl
127         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
128 regdis.h: regs.dat regs.pl
129         $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
130 regvals.c: regs.dat regs.pl
131         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
132 regs.h: regs.dat regs.pl
133         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
134
135 # Assembler token hash
136 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
137         $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat &
138                 $(srcdir)/tokens.dat > tokhash.c
139
140 # Assembler token metadata
141 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
142         $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat &
143                 $(srcdir)/tokens.dat > tokens.h
144
145 # Preprocessor token hash
146 pptok.h: pptok.dat pptok.pl perllib/phash.ph
147         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
148 pptok.c: pptok.dat pptok.pl perllib/phash.ph
149         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
150
151 # This target generates all files that require perl.
152 # This allows easier generation of distribution (see dist target).
153 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c &
154           regs.c regs.h regflags.c regdis.c regdis.h regvals.c &
155           tokhash.c tokens.h pptok.h pptok.c &
156           version.h version.mac
157 perlreq: $(PERLREQ)
158
159 clean: .SYMBOLIC
160         -del /f *.$(O)
161         -del /f *.s
162         -del /f *.i
163         -del /f output\*.$(O)
164         -del /f output\*.s
165         -del /f output\*.i
166         -del /f nasm$(X)
167         -del /f ndisasm$(X)
168         rem cd rdoff && $(MAKE) clean
169
170 distclean: clean .SYMBOLIC
171         -del /f config.h
172         -del /f config.log
173         -del /f config.status
174         -del /f Makefile
175         -del /f *~
176         -del /f *.bak
177         -del /f *.lst
178         -del /f *.bin
179         -del /f output\*~
180         -del /f output\*.bak
181         -del /f test\*.lst
182         -del /f test\*.bin
183         -del /f test\*.$(O)
184         -del /f test\*.bin
185         -del /f/s autom4te*.cache
186         rem cd rdoff && $(MAKE) distclean
187
188 cleaner: clean .SYMBOLIC
189         -del /f $(PERLREQ)
190         -del /f *.man
191         -del /f nasm.spec
192         rem cd doc && $(MAKE) clean
193
194 spotless: distclean cleaner .SYMBOLIC
195         -del /f doc\Makefile
196         -del doc\*~
197         -del doc\*.bak
198
199 strip: .SYMBOLIC
200         $(STRIP) *.exe
201
202 rdf:
203         # cd rdoff && $(MAKE)
204
205 doc:
206         # cd doc && $(MAKE) all
207
208 everything: all doc rdf
209
210 #-- Magic hints to mkdep.pl --#
211 # @object-ending: ".$(O)"
212 # @path-separator: "\"
213 # @exclude: "config.h"
214 # @continuation: "&"
215 #-- Everything below is generated by mkdep.pl - do not edit --#
216 assemble.$(O): assemble.c assemble.h compiler.h directives.h insns.h &
217  insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
218 crc64.$(O): crc64.c compiler.h nasmlib.h
219 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h &
220  nasm.h nasmlib.h pptok.h preproc.h regs.h
221 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h &
222  nasm.h nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
223 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h &
224  nasm.h nasmlib.h pptok.h preproc.h regs.h
225 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
226  pptok.h preproc.h regs.h
227 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h &
228  nasmlib.h pptok.h preproc.h regs.h
229 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
230  nasmlib.h pptok.h preproc.h regs.h
231 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h &
232  nasmlib.h pptok.h preproc.h regs.h tokens.h
233 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h &
234  nasmlib.h pptok.h preproc.h regs.h tokens.h
235 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h &
236  nasmlib.h pptok.h preproc.h regs.h tokens.h
237 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
238 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
239  nasmlib.h pptok.h preproc.h regs.h
240 lib\snprintf.$(O): lib\snprintf.c compiler.h nasmlib.h
241 lib\vsnprintf.$(O): lib\vsnprintf.c compiler.h nasmlib.h
242 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h &
243  nasmlib.h pptok.h preproc.h regs.h
244 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
245  nasmlib.h output\outform.h pptok.h preproc.h regs.h tables.h
246 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h &
247  insnsi.h labels.h listing.h nasm.h nasmlib.h output\outform.h parser.h &
248  pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
249 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h &
250  nasmlib.h pptok.h preproc.h regs.h tokens.h
251 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h &
252  nasm.h nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
253 output\nulldbg.$(O): output\nulldbg.c compiler.h directives.h insnsi.h &
254  nasm.h nasmlib.h pptok.h preproc.h regs.h
255 output\nullout.$(O): output\nullout.c compiler.h directives.h insnsi.h &
256  nasm.h nasmlib.h output\outlib.h pptok.h preproc.h regs.h
257 output\outaout.$(O): output\outaout.c compiler.h directives.h insnsi.h &
258  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
259  regs.h saa.h stdscan.h
260 output\outas86.$(O): output\outas86.c compiler.h directives.h insnsi.h &
261  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
262  regs.h saa.h
263 output\outbin.$(O): output\outbin.c compiler.h directives.h eval.h insnsi.h &
264  labels.h nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h &
265  preproc.h regs.h saa.h stdscan.h
266 output\outcoff.$(O): output\outcoff.c compiler.h directives.h insnsi.h &
267  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
268  regs.h saa.h
269 output\outdbg.$(O): output\outdbg.c compiler.h directives.h insnsi.h nasm.h &
270  nasmlib.h output\outform.h pptok.h preproc.h regs.h
271 output\outelf.$(O): output\outelf.c compiler.h directives.h insnsi.h nasm.h &
272  nasmlib.h output\dwarf.h output\elfcommon.h output\outelf.h &
273  output\outform.h pptok.h preproc.h regs.h
274 output\outelf32.$(O): output\outelf32.c compiler.h directives.h insnsi.h &
275  nasm.h nasmlib.h output\dwarf.h output\elf32.h output\elfcommon.h &
276  output\outelf.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
277  rbtree.h regs.h saa.h stdscan.h
278 output\outelf64.$(O): output\outelf64.c compiler.h directives.h insnsi.h &
279  nasm.h nasmlib.h output\dwarf.h output\elf64.h output\elfcommon.h &
280  output\outelf.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
281  rbtree.h regs.h saa.h stdscan.h
282 output\outexe.$(O): output\outexe.c compiler.h directives.h insnsi.h nasm.h &
283  nasmlib.h output\outform.h pptok.h preproc.h regs.h
284 output\outform.$(O): output\outform.c compiler.h directives.h insnsi.h &
285  nasm.h nasmlib.h output\outform.h pptok.h preproc.h regs.h
286 output\outieee.$(O): output\outieee.c compiler.h directives.h insnsi.h &
287  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h regs.h
288 output\outlib.$(O): output\outlib.c compiler.h directives.h insnsi.h nasm.h &
289  nasmlib.h output\outlib.h pptok.h preproc.h regs.h
290 output\outmacho32.$(O): output\outmacho32.c compiler.h directives.h insnsi.h &
291  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
292  regs.h saa.h
293 output\outmacho64.$(O): output\outmacho64.c compiler.h directives.h insnsi.h &
294  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h raa.h &
295  regs.h saa.h
296 output\outobj.$(O): output\outobj.c compiler.h directives.h insnsi.h nasm.h &
297  nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h regs.h &
298  stdscan.h
299 output\outrdf.$(O): output\outrdf.c compiler.h directives.h insnsi.h nasm.h &
300  nasmlib.h output\outform.h pptok.h preproc.h regs.h
301 output\outrdf2.$(O): output\outrdf2.c compiler.h directives.h insnsi.h &
302  nasm.h nasmlib.h output\outform.h output\outlib.h pptok.h preproc.h &
303  rdoff\rdoff.h regs.h saa.h
304 parser.$(O): parser.c compiler.h directives.h float.h insns.h insnsi.h &
305  nasm.h nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h tables.h &
306  tokens.h
307 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
308 preproc.$(O): preproc.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
309  nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
310 quote.$(O): quote.c compiler.h nasmlib.h quote.h
311 raa.$(O): raa.c compiler.h nasmlib.h raa.h
312 rbtree.$(O): rbtree.c compiler.h rbtree.h
313 regdis.$(O): regdis.c regdis.h regs.h
314 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
315  pptok.h preproc.h regs.h tables.h
316 regs.$(O): regs.c compiler.h insnsi.h tables.h
317 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
318 saa.$(O): saa.c compiler.h nasmlib.h saa.h
319 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h &
320  nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
321 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
322  pptok.h preproc.h regs.h
323 sync.$(O): sync.c compiler.h nasmlib.h sync.h
324 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h &
325  nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
326 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h pptok.h &
327  preproc.h regs.h version.h