Add generic ilog2 functions
[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         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 /f *.$(O)
163         -del /f *.s
164         -del /f *.i
165         -del /f lib\*.$(O)
166         -del /f lib\*.s
167         -del /f lib\*.i
168         -del /f output\*.$(O)
169         -del /f output\*.s
170         -del /f output\*.i
171         -del /f nasm$(X)
172         -del /f ndisasm$(X)
173         rem cd rdoff && $(MAKE) clean
174
175 distclean: clean .SYMBOLIC
176         -del /f config.h
177         -del /f config.log
178         -del /f config.status
179         -del /f Makefile
180         -del /f *~
181         -del /f *.bak
182         -del /f *.lst
183         -del /f *.bin
184         -del /f output\*~
185         -del /f output\*.bak
186         -del /f test\*.lst
187         -del /f test\*.bin
188         -del /f test\*.$(O)
189         -del /f test\*.bin
190         -del /f/s autom4te*.cache
191         rem cd rdoff && $(MAKE) distclean
192
193 cleaner: clean .SYMBOLIC
194         -del /f $(PERLREQ)
195         -del /f *.man
196         -del /f nasm.spec
197         rem cd doc && $(MAKE) clean
198
199 spotless: distclean cleaner .SYMBOLIC
200         -del /f 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 directives.h insns.h &
222  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h &
223  tokens.h
224 crc64.$(O): crc64.c compiler.h nasmlib.h
225 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h &
226  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
227 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h &
228  nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h sync.h &
229  tables.h tokens.h
230 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h &
231  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
232 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
233  opflags.h pptok.h preproc.h regs.h
234 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h &
235  nasmlib.h opflags.h pptok.h preproc.h regs.h
236 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
237  nasmlib.h opflags.h pptok.h preproc.h regs.h
238 ilog2.$(O): ilog2.c compiler.h nasmlib.h
239 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h &
240  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
241 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h &
242  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
243 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h &
244  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
245 insnsn.$(O): insnsn.c compiler.h insnsi.h opflags.h tables.h
246 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
247  nasmlib.h opflags.h pptok.h preproc.h regs.h
248 lib\snprintf.$(O): lib\snprintf.c compiler.h nasmlib.h
249 lib\strlcpy.$(O): lib\strlcpy.c compiler.h
250 lib\vsnprintf.$(O): lib\vsnprintf.c compiler.h nasmlib.h
251 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h &
252  nasmlib.h opflags.h pptok.h preproc.h regs.h
253 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
254  nasmlib.h opflags.h output\outform.h pptok.h preproc.h regs.h tables.h
255 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h &
256  insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h output\outform.h &
257  parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
258 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h &
259  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
260 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h &
261  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h tokens.h
262 output\nulldbg.$(O): output\nulldbg.c compiler.h directives.h insnsi.h &
263  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
264 output\nullout.$(O): output\nullout.c compiler.h directives.h insnsi.h &
265  nasm.h nasmlib.h opflags.h output\outlib.h pptok.h preproc.h regs.h
266 output\outaout.$(O): output\outaout.c compiler.h directives.h eval.h &
267  insnsi.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
268  pptok.h preproc.h raa.h regs.h saa.h stdscan.h
269 output\outas86.$(O): output\outas86.c compiler.h directives.h insnsi.h &
270  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
271  preproc.h raa.h regs.h saa.h
272 output\outbin.$(O): output\outbin.c compiler.h directives.h eval.h insnsi.h &
273  labels.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
274  pptok.h preproc.h regs.h saa.h stdscan.h
275 output\outcoff.$(O): output\outcoff.c compiler.h directives.h eval.h &
276  insnsi.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
277  output\pecoff.h pptok.h preproc.h raa.h regs.h saa.h
278 output\outdbg.$(O): output\outdbg.c compiler.h directives.h insnsi.h nasm.h &
279  nasmlib.h opflags.h output\outform.h pptok.h preproc.h regs.h
280 output\outelf.$(O): output\outelf.c compiler.h directives.h insnsi.h nasm.h &
281  nasmlib.h opflags.h output\dwarf.h output\elf.h output\outelf.h &
282  output\outform.h pptok.h preproc.h regs.h
283 output\outelf32.$(O): output\outelf32.c compiler.h directives.h eval.h &
284  insnsi.h nasm.h nasmlib.h opflags.h output\dwarf.h output\elf.h &
285  output\outelf.h output\outform.h output\outlib.h output\stabs.h pptok.h &
286  preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
287 output\outelf64.$(O): output\outelf64.c compiler.h directives.h eval.h &
288  insnsi.h nasm.h nasmlib.h opflags.h output\dwarf.h output\elf.h &
289  output\outelf.h output\outform.h output\outlib.h output\stabs.h pptok.h &
290  preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
291 output\outform.$(O): output\outform.c compiler.h directives.h insnsi.h &
292  nasm.h nasmlib.h opflags.h output\outform.h pptok.h preproc.h regs.h
293 output\outieee.$(O): output\outieee.c compiler.h directives.h insnsi.h &
294  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
295  preproc.h regs.h
296 output\outlib.$(O): output\outlib.c compiler.h directives.h insnsi.h nasm.h &
297  nasmlib.h opflags.h output\outlib.h pptok.h preproc.h regs.h
298 output\outmacho32.$(O): output\outmacho32.c compiler.h directives.h eval.h &
299  insnsi.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
300  pptok.h preproc.h raa.h regs.h saa.h
301 output\outmacho64.$(O): output\outmacho64.c compiler.h directives.h insnsi.h &
302  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
303  preproc.h raa.h regs.h saa.h
304 output\outobj.$(O): output\outobj.c compiler.h directives.h eval.h insnsi.h &
305  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
306  preproc.h regs.h stdscan.h
307 output\outrdf2.$(O): output\outrdf2.c compiler.h directives.h insnsi.h &
308  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
309  preproc.h rdoff\rdoff.h regs.h saa.h
310 parser.$(O): parser.c compiler.h directives.h eval.h float.h insns.h &
311  insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h &
312  stdscan.h tables.h tokens.h
313 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
314 preproc.$(O): preproc.c compiler.h directives.h eval.h hashtbl.h insnsi.h &
315  nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h &
316  tables.h tokens.h
317 quote.$(O): quote.c compiler.h nasmlib.h quote.h
318 raa.$(O): raa.c compiler.h nasmlib.h raa.h
319 rbtree.$(O): rbtree.c compiler.h rbtree.h
320 regdis.$(O): regdis.c regdis.h regs.h
321 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
322  opflags.h pptok.h preproc.h regs.h tables.h
323 regs.$(O): regs.c compiler.h insnsi.h opflags.h tables.h
324 regvals.$(O): regvals.c compiler.h insnsi.h opflags.h tables.h
325 saa.$(O): saa.c compiler.h nasmlib.h saa.h
326 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h &
327  nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
328 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
329  opflags.h pptok.h preproc.h regs.h
330 sync.$(O): sync.c compiler.h nasmlib.h sync.h
331 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h &
332  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
333 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h opflags.h &
334  pptok.h preproc.h regs.h version.h