doc: Make the bit about mib operands a bit clearer
[nasm.git] / Mkfiles / owlinux.mak
bloba9137c31115dee1c8df3341717275e50c130276f
1 # -*- makefile -*-
3 # Makefile for cross-compiling NASM from Linux
4 # to DOS, Win32 or OS/2 using OpenWatcom.
6 # Please see http://bugzilla.openwatcom.org/show_bug.cgi?id=751
7 # for some caveats in using OpenWatcom as a cross-compiler
8 # from Linux, in particular:
10 # > Second and more importantly, the makefile needs to ensure that the
11 # > proper headers are included. This is normally not a problem when
12 # > building on DOS, Windows, or OS/2, as they share the same C
13 # > library headers. But when cross-compiling from (or to) Linux, it
14 # > is crucial.
15 # >
16 # > This may be accomplished by setting the INCLUDE env var in the
17 # > makefile, or setting OS2_INCLUDE, DOS_INCLUDE, NT_INCLUDE env vars
18 # > *and* making sure that the proper -bt switch is used, or passing a
19 # > switch like -I"$(%WATCOM)/h". The last variant is probably the
20 # > easiest to implement and least likely to break.
23 top_srcdir = .
24 srcdir = .
25 prefix = C:/Program Files/NASM
26 exec_prefix = $(prefix)
27 bindir = $(prefix)/bin
28 mandir = $(prefix)/man
30 CC = wcl386
31 DEBUG =
32 CFLAGS = -6 -ox -wx -ze -fpi $(DEBUG)
33 BUILD_CFLAGS = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes
34 INTERNAL_CFLAGS = -I$(srcdir) -I. \
35 -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
36 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
37 LD = $(CC)
38 LDFLAGS = $(ALL_CFLAGS)
39 LIBS =
40 PERL = perl -I$(srcdir)/perllib
42 STRIP = wstrip
44 # Binary suffixes
45 O = obj
46 X = .exe
48 # WMAKE errors out if a suffix is declared more than once, including
49 # its own built-in declarations. Thus, we need to explicitly clear the list
50 # first. Also, WMAKE only allows implicit rules that point "to the left"
51 # in this list!
52 .SUFFIXES:
53 .SUFFIXES: .man .1 .$(O) .i .c
55 .c.$(O):
56 $(CC) -c $(ALL_CFLAGS) -fo=$@ $<
58 #-- Begin File Lists --#
59 # Edit in Makefile.in, not here!
60 NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \
61 raa.$(O) saa.$(O) rbtree.$(O) \
62 float.$(O) insnsa.$(O) insnsb.$(O) \
63 directiv.$(O) \
64 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
65 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
66 output/nullout.$(O) \
67 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
68 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
69 output/outelfx32.$(O) \
70 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
71 output/outdbg.$(O) output/outieee.$(O) output/outmac32.$(O) \
72 output/outmac64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
73 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
74 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
75 ilog2.$(O) \
76 lib/strlcpy.$(O) \
77 preproc-nop.$(O) \
78 disp8.$(O) \
79 iflag.$(O)
81 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
82 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \
83 disp8.$(O) iflag.$(O)
84 #-- End File Lists --#
86 what:
87 @echo 'Please build "dos", "win32" or "os2"'
89 dos:
90 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G'
92 win32:
93 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT'
95 os2:
96 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2'
98 all: nasm$(X) ndisasm$(X)
100 nasm$(X): $(NASM)
101 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
103 ndisasm$(X): $(NDISASM)
104 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
106 # These source files are automagically generated from a single
107 # instruction-table file by a Perl script. They're distributed,
108 # though, so it isn't necessary to have Perl just to recompile NASM
109 # from the distribution.
111 insns.pl: insns-iflags.pl
113 iflag.c iflag.h: insns.dat insns.pl
114 $(PERL) $(srcdir)/insns.pl -t $(srcdir)/insns.dat
115 insnsb.c: insns.dat insns.pl
116 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
117 insnsa.c: insns.dat insns.pl
118 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
119 insnsd.c: insns.dat insns.pl
120 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
121 insnsi.h: insns.dat insns.pl
122 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
123 insnsn.c: insns.dat insns.pl
124 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
126 # These files contains all the standard macros that are derived from
127 # the version number.
128 version.h: version version.pl
129 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
131 version.mac: version version.pl
132 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
134 # This source file is generated from the standard macros file
135 # `standard.mac' by another Perl script. Again, it's part of the
136 # standard distribution.
138 macros.c: macros.pl standard.mac version.mac
139 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
141 # These source files are generated from regs.dat by yet another
142 # perl script.
143 regs.c: regs.dat regs.pl
144 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
145 regflags.c: regs.dat regs.pl
146 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
147 regdis.c: regs.dat regs.pl
148 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
149 regdis.h: regs.dat regs.pl
150 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
151 regvals.c: regs.dat regs.pl
152 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
153 regs.h: regs.dat regs.pl
154 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
156 # Assembler token hash
157 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
158 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
159 $(srcdir)/tokens.dat > tokhash.c
161 # Assembler token metadata
162 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
163 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
164 $(srcdir)/tokens.dat > tokens.h
166 # Preprocessor token hash
167 pptok.h: pptok.dat pptok.pl perllib/phash.ph
168 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
169 pptok.c: pptok.dat pptok.pl perllib/phash.ph
170 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
172 # This target generates all files that require perl.
173 # This allows easier generation of distribution (see dist target).
174 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
175 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
176 tokhash.c tokens.h pptok.h pptok.c \
177 version.h version.mac iflag.c iflag.h
178 perlreq: $(PERLREQ)
180 clean:
181 -rm -f *.$(O)
182 -rm -f *.s
183 -rm -f *.i
184 -rm -f lib/*.$(O)
185 -rm -f lib/*.s
186 -rm -f lib/*.i
187 -rm -f output/*.$(O)
188 -rm -f output/*.s
189 -rm -f output/*.i
190 -rm -f nasm$(X)
191 -rm -f ndisasm$(X)
192 # cd rdoff && $(MAKE) clean
194 distclean: clean .SYMBOLIC
195 -rm -f config.h
196 -rm -f config.log
197 -rm -f config.status
198 -rm -f Makefile
199 -rm -f *~
200 -rm -f *.bak
201 -rm -f *.lst
202 -rm -f *.bin
203 -rm -f output/*~
204 -rm -f output/*.bak
205 -rm -f test/*.lst
206 -rm -f test/*.bin
207 -rm -f test/*.$(O)
208 -rm -f test/*.bin
209 -rm -f/s autom4te*.cache
210 # cd rdoff && $(MAKE) distclean
212 cleaner: clean .SYMBOLIC
213 -rm -f $(PERLREQ)
214 -rm -f *.man
215 -rm -f nasm.spec
216 # cd doc && $(MAKE) clean
218 spotless: distclean cleaner .SYMBOLIC
219 -rm -f doc/Makefile
220 -rm -f doc/*~
221 -rm -f doc/*.bak
223 strip:
224 $(STRIP) *.exe
226 rdf:
227 # cd rdoff && $(MAKE)
229 doc:
230 # cd doc && $(MAKE) all
232 everything: all doc rdf
234 #-- Magic hints to mkdep.pl --#
235 # @object-ending: ".$(O)"
236 # @path-separator: "/"
237 # @exclude: "config.h"
238 # @continuation: "\"
239 #-- Everything below is generated by mkdep.pl - do not edit --#
240 assemble.$(O): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \
241 iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \
242 regs.h tables.h tokens.h
243 crc64.$(O): crc64.c compiler.h nasmlib.h
244 directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
245 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
246 disasm.$(O): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h \
247 iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \
248 regdis.h regs.h sync.h tables.h tokens.h
249 disp8.$(O): disp8.c compiler.h directiv.h disp8.h insnsi.h nasm.h nasmlib.h \
250 opflags.h pptok.h preproc.h regs.h tables.h
251 eval.$(O): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
252 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
253 exprlib.$(O): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
254 opflags.h pptok.h preproc.h regs.h tables.h
255 float.$(O): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmlib.h \
256 opflags.h pptok.h preproc.h regs.h tables.h
257 hashtbl.$(O): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
258 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
259 iflag.$(O): iflag.c compiler.h iflag.h iflaggen.h
260 ilog2.$(O): ilog2.c compiler.h nasmlib.h
261 insnsa.$(O): insnsa.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
262 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
263 tokens.h
264 insnsb.$(O): insnsb.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
265 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
266 tokens.h
267 insnsd.$(O): insnsd.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
268 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
269 tokens.h
270 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
271 labels.$(O): labels.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
272 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
273 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
274 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
275 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
276 listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
277 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
278 macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
279 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
280 nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
281 iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
282 output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
283 tables.h tokens.h
284 nasmlib.$(O): nasmlib.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
285 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
286 tokens.h
287 ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
288 insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
289 tables.h tokens.h
290 output/nulldbg.$(O): output/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
291 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
292 output/nullout.$(O): output/nullout.c compiler.h directiv.h insnsi.h nasm.h \
293 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
294 output/outaout.$(O): output/outaout.c compiler.h directiv.h eval.h insnsi.h \
295 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
296 preproc.h raa.h regs.h saa.h stdscan.h tables.h
297 output/outas86.$(O): output/outas86.c compiler.h directiv.h insnsi.h nasm.h \
298 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
299 raa.h regs.h saa.h tables.h
300 output/outbin.$(O): output/outbin.c compiler.h directiv.h eval.h insnsi.h \
301 labels.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
302 pptok.h preproc.h regs.h saa.h stdscan.h tables.h
303 output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
304 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h output/pecoff.h \
305 pptok.h preproc.h raa.h regs.h saa.h tables.h
306 output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
307 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
308 output/outelf.$(O): output/outelf.c compiler.h directiv.h insnsi.h nasm.h \
309 nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
310 output/outform.h pptok.h preproc.h regs.h tables.h
311 output/outelf32.$(O): output/outelf32.c compiler.h directiv.h eval.h \
312 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
313 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
314 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
315 output/outelf64.$(O): output/outelf64.c compiler.h directiv.h eval.h \
316 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
317 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
318 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
319 output/outelfx32.$(O): output/outelfx32.c compiler.h directiv.h eval.h \
320 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
321 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
322 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
323 output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
324 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
325 output/outieee.$(O): output/outieee.c compiler.h directiv.h insnsi.h nasm.h \
326 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
327 regs.h tables.h
328 output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \
329 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
330 output/outmac32.$(O): output/outmac32.c compiler.h directiv.h eval.h \
331 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
332 pptok.h preproc.h raa.h regs.h saa.h tables.h
333 output/outmac64.$(O): output/outmac64.c compiler.h directiv.h insnsi.h \
334 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
335 preproc.h raa.h regs.h saa.h tables.h
336 output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \
337 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
338 preproc.h regs.h stdscan.h tables.h
339 output/outrdf2.$(O): output/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
340 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
341 rdoff/rdoff.h regs.h saa.h tables.h
342 parser.$(O): parser.c compiler.h directiv.h eval.h float.h iflag.h \
343 iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h \
344 preproc.h regs.h stdscan.h tables.h tokens.h
345 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
346 preproc-nop.$(O): preproc-nop.c compiler.h directiv.h insnsi.h nasm.h \
347 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
348 preproc.$(O): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
349 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
350 tables.h tokens.h
351 quote.$(O): quote.c compiler.h nasmlib.h quote.h
352 raa.$(O): raa.c compiler.h nasmlib.h raa.h
353 rbtree.$(O): rbtree.c compiler.h rbtree.h
354 regdis.$(O): regdis.c regdis.h regs.h
355 regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
356 opflags.h pptok.h preproc.h regs.h tables.h
357 regs.$(O): regs.c compiler.h insnsi.h tables.h
358 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
359 saa.$(O): saa.c compiler.h nasmlib.h saa.h
360 stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
361 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
362 stdscan.h tables.h tokens.h
363 strfunc.$(O): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
364 opflags.h pptok.h preproc.h regs.h tables.h
365 sync.$(O): sync.c compiler.h nasmlib.h sync.h
366 tokhash.$(O): tokhash.c compiler.h directiv.h hashtbl.h iflag.h iflaggen.h \
367 insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
368 tables.h tokens.h
369 ver.$(O): ver.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h opflags.h \
370 pptok.h preproc.h regs.h tables.h version.h