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