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