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