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
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.
25 prefix = C
:/Program Files
/NASM
26 exec_prefix = $(prefix)
27 bindir = $(prefix)/bin
28 mandir = $(prefix)/man
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
)
38 LDFLAGS
= $(ALL_CFLAGS
)
40 PERL
= perl
-I
$(srcdir)/perllib
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"
53 .SUFFIXES
: .man
.1 .
$(O
) .i .c
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
) \
64 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
65 output
/outform.
$(O
) output
/outlib.
$(O
) output
/nulldbg.
$(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
) \
78 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
79 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
80 #-- End File Lists --#
83 @echo
'Please build "dos", "win32" or "os2"'
86 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=DOS -l=DOS4G'
89 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=NT -l=NT'
92 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=OS2 -l=OS2V2'
94 all: nasm
$(X
) ndisasm
$(X
)
97 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
99 ndisasm
$(X
): $(NDISASM
)
100 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
102 # These source files are automagically generated from a single
103 # instruction-table file by a Perl script. They're distributed,
104 # though, so it isn't necessary to have Perl just to recompile NASM
105 # from the distribution.
107 insnsb.c
: insns.dat insns.pl
108 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
109 insnsa.c
: insns.dat insns.pl
110 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
111 insnsd.c
: insns.dat insns.pl
112 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
113 insnsi.h
: insns.dat insns.pl
114 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
115 insnsn.c
: insns.dat insns.pl
116 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
118 # These files contains all the standard macros that are derived from
119 # the version number.
120 version.h
: version version.pl
121 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
123 version.mac
: version version.pl
124 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
126 # This source file is generated from the standard macros file
127 # `standard.mac' by another Perl script. Again, it's part of the
128 # standard distribution.
130 macros.c
: macros.pl standard.mac version.mac
131 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
133 # These source files are generated from regs.dat by yet another
135 regs.c
: regs.dat regs.pl
136 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
137 regflags.c
: regs.dat regs.pl
138 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
139 regdis.c
: regs.dat regs.pl
140 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
141 regdis.h
: regs.dat regs.pl
142 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
143 regvals.c
: regs.dat regs.pl
144 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
145 regs.h
: regs.dat regs.pl
146 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
148 # Assembler token hash
149 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
150 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
151 $(srcdir)/tokens.dat
> tokhash.c
153 # Assembler token metadata
154 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
155 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
156 $(srcdir)/tokens.dat
> tokens.h
158 # Preprocessor token hash
159 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
160 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
161 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
162 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
164 # This target generates all files that require perl.
165 # This allows easier generation of distribution (see dist target).
166 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
167 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
168 tokhash.c tokens.h pptok.h pptok.c \
169 version.h version.mac
184 # cd rdoff && $(MAKE) clean
186 distclean: clean .SYMBOLIC
201 -rm -f
/s autom4te
*.cache
202 # cd rdoff && $(MAKE) distclean
204 cleaner
: clean .SYMBOLIC
208 # cd doc && $(MAKE) clean
210 spotless
: distclean cleaner .SYMBOLIC
219 # cd rdoff && $(MAKE)
222 # cd doc && $(MAKE) all
224 everything
: all doc rdf
226 #-- Magic hints to mkdep.pl --#
227 # @object-ending: ".$(O)"
228 # @path-separator: "/"
229 # @exclude: "config.h"
231 #-- Everything below is generated by mkdep.pl - do not edit --#
232 assemble.
$(O
): assemble.c assemble.h compiler.h directiv.h insns.h insnsi.h \
233 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h tokens.h
234 crc64.
$(O
): crc64.c compiler.h nasmlib.h
235 directiv.
$(O
): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
236 nasmlib.h opflags.h pptok.h preproc.h regs.h
237 disasm.
$(O
): disasm.c compiler.h directiv.h disasm.h insns.h insnsi.h nasm.h \
238 nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h sync.h tables.h \
240 eval.
$(O
): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
241 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
242 exprlib.
$(O
): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
243 opflags.h pptok.h preproc.h regs.h
244 float.
$(O
): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmlib.h \
245 opflags.h pptok.h preproc.h regs.h
246 hashtbl.
$(O
): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
247 nasmlib.h opflags.h pptok.h preproc.h regs.h
248 ilog2.
$(O
): ilog2.c compiler.h nasmlib.h
249 insnsa.
$(O
): insnsa.c compiler.h directiv.h insns.h insnsi.h nasm.h \
250 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
251 insnsb.
$(O
): insnsb.c compiler.h directiv.h insns.h insnsi.h nasm.h \
252 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
253 insnsd.
$(O
): insnsd.c compiler.h directiv.h insns.h insnsi.h nasm.h \
254 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
255 insnsn.
$(O
): insnsn.c compiler.h insnsi.h opflags.h tables.h
256 labels.
$(O
): labels.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
257 nasmlib.h opflags.h pptok.h preproc.h regs.h
258 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h nasmlib.h
259 lib
/strlcpy.
$(O
): lib
/strlcpy.c compiler.h
260 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h nasmlib.h
261 listing.
$(O
): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
262 nasmlib.h opflags.h pptok.h preproc.h regs.h
263 macros.
$(O
): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
264 nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h tables.h
265 nasm.
$(O
): nasm.c assemble.h compiler.h directiv.h eval.h float.h insns.h \
266 insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h output
/outform.h \
267 parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
268 nasmlib.
$(O
): nasmlib.c compiler.h directiv.h insns.h insnsi.h nasm.h \
269 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
270 ndisasm.
$(O
): ndisasm.c compiler.h directiv.h disasm.h insns.h insnsi.h \
271 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h tokens.h
272 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
273 nasmlib.h opflags.h pptok.h preproc.h regs.h
274 output
/nullout.
$(O
): output
/nullout.c compiler.h directiv.h insnsi.h nasm.h \
275 nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
276 output
/outaout.
$(O
): output
/outaout.c compiler.h directiv.h eval.h insnsi.h \
277 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
278 preproc.h raa.h regs.h saa.h stdscan.h
279 output
/outas86.
$(O
): output
/outas86.c compiler.h directiv.h insnsi.h nasm.h \
280 nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h preproc.h \
282 output
/outbin.
$(O
): output
/outbin.c compiler.h directiv.h eval.h insnsi.h \
283 labels.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
284 pptok.h preproc.h regs.h saa.h stdscan.h
285 output
/outcoff.
$(O
): output
/outcoff.c compiler.h directiv.h eval.h insnsi.h \
286 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h output
/pecoff.h \
287 pptok.h preproc.h raa.h regs.h saa.h
288 output
/outdbg.
$(O
): output
/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
289 nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
290 output
/outelf.
$(O
): output
/outelf.c compiler.h directiv.h insnsi.h nasm.h \
291 nasmlib.h opflags.h output
/dwarf.h output
/elf.h output
/outelf.h \
292 output
/outform.h pptok.h preproc.h regs.h
293 output
/outelf32.
$(O
): output
/outelf32.c compiler.h directiv.h eval.h \
294 insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
295 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
296 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
297 output
/outelf64.
$(O
): output
/outelf64.c compiler.h directiv.h eval.h \
298 insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
299 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
300 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
301 output
/outelfx32.
$(O
): output
/outelfx32.c compiler.h directiv.h eval.h \
302 insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
303 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
304 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
305 output
/outform.
$(O
): output
/outform.c compiler.h directiv.h insnsi.h nasm.h \
306 nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
307 output
/outieee.
$(O
): output
/outieee.c compiler.h directiv.h insnsi.h nasm.h \
308 nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h preproc.h \
310 output
/outlib.
$(O
): output
/outlib.c compiler.h directiv.h insnsi.h nasm.h \
311 nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
312 output
/outmac32.
$(O
): output
/outmac32.c compiler.h directiv.h eval.h \
313 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
314 pptok.h preproc.h raa.h regs.h saa.h
315 output
/outmac64.
$(O
): output
/outmac64.c compiler.h directiv.h insnsi.h \
316 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
317 preproc.h raa.h regs.h saa.h
318 output
/outobj.
$(O
): output
/outobj.c compiler.h directiv.h eval.h insnsi.h \
319 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
320 preproc.h regs.h stdscan.h
321 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
322 nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h preproc.h \
323 rdoff
/rdoff.h regs.h saa.h
324 parser.
$(O
): parser.c compiler.h directiv.h eval.h float.h insns.h insnsi.h \
325 nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h stdscan.h \
327 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
328 preproc.
$(O
): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
329 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
331 quote.
$(O
): quote.c compiler.h nasmlib.h quote.h
332 raa.
$(O
): raa.c compiler.h nasmlib.h raa.h
333 rbtree.
$(O
): rbtree.c compiler.h rbtree.h
334 regdis.
$(O
): regdis.c regdis.h regs.h
335 regflags.
$(O
): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
336 opflags.h pptok.h preproc.h regs.h tables.h
337 regs.
$(O
): regs.c compiler.h insnsi.h opflags.h tables.h
338 regvals.
$(O
): regvals.c compiler.h insnsi.h opflags.h tables.h
339 saa.
$(O
): saa.c compiler.h nasmlib.h saa.h
340 stdscan.
$(O
): stdscan.c compiler.h directiv.h insns.h insnsi.h nasm.h \
341 nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
342 strfunc.
$(O
): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
343 opflags.h pptok.h preproc.h regs.h
344 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
345 tokhash.
$(O
): tokhash.c compiler.h directiv.h hashtbl.h insns.h insnsi.h \
346 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
347 ver.
$(O
): ver.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h opflags.h \
348 pptok.h preproc.h regs.h version.h