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
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
70 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho32.
$(O
) \
71 output
/outmacho64.
$(O
) preproc.
$(O
) quote.
$(O
) pptok.
$(O
) \
72 macros.
$(O
) listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) \
73 strfunc.
$(O
) tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
) \
77 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
78 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
79 #-- End File Lists --#
82 @echo
'Please build "dos", "win32" or "os2"'
85 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=DOS -l=DOS4G'
88 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=NT -l=NT'
91 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=OS2 -l=OS2V2'
93 all: nasm
$(X
) ndisasm
$(X
)
96 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
98 ndisasm
$(X
): $(NDISASM
)
99 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
101 # These source files are automagically generated from a single
102 # instruction-table file by a Perl script. They're distributed,
103 # though, so it isn't necessary to have Perl just to recompile NASM
104 # from the distribution.
106 insnsb.c
: insns.dat insns.pl
107 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
108 insnsa.c
: insns.dat insns.pl
109 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
110 insnsd.c
: insns.dat insns.pl
111 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
112 insnsi.h
: insns.dat insns.pl
113 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
114 insnsn.c
: insns.dat insns.pl
115 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
117 # These files contains all the standard macros that are derived from
118 # the version number.
119 version.h
: version version.pl
120 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
122 version.mac
: version version.pl
123 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
125 # This source file is generated from the standard macros file
126 # `standard.mac' by another Perl script. Again, it's part of the
127 # standard distribution.
129 macros.c
: macros.pl standard.mac version.mac
130 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
132 # These source files are generated from regs.dat by yet another
134 regs.c
: regs.dat regs.pl
135 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
136 regflags.c
: regs.dat regs.pl
137 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
138 regdis.c
: regs.dat regs.pl
139 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
140 regdis.h
: regs.dat regs.pl
141 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
142 regvals.c
: regs.dat regs.pl
143 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
144 regs.h
: regs.dat regs.pl
145 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
147 # Assembler token hash
148 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
149 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
150 $(srcdir)/tokens.dat
> tokhash.c
152 # Assembler token metadata
153 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
154 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
155 $(srcdir)/tokens.dat
> tokens.h
157 # Preprocessor token hash
158 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
159 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
160 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
161 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
163 # This target generates all files that require perl.
164 # This allows easier generation of distribution (see dist target).
165 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
166 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
167 tokhash.c tokens.h pptok.h pptok.c \
168 version.h version.mac
183 # cd rdoff && $(MAKE) clean
185 distclean: clean .SYMBOLIC
200 -rm -f
/s autom4te
*.cache
201 # cd rdoff && $(MAKE) distclean
203 cleaner
: clean .SYMBOLIC
207 # cd doc && $(MAKE) clean
209 spotless
: distclean cleaner .SYMBOLIC
218 # cd rdoff && $(MAKE)
221 # cd doc && $(MAKE) all
223 everything
: all doc rdf
225 #-- Magic hints to mkdep.pl --#
226 # @object-ending: ".$(O)"
227 # @path-separator: "/"
228 # @exclude: "config.h"
230 #-- Everything below is generated by mkdep.pl - do not edit --#
231 assemble.
$(O
): assemble.c assemble.h compiler.h directives.h insns.h \
232 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
234 crc64.
$(O
): crc64.c compiler.h nasmlib.h
235 directives.
$(O
): directives.c compiler.h directives.h hashtbl.h insnsi.h \
236 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
237 disasm.
$(O
): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
238 nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h sync.h \
240 eval.
$(O
): eval.c compiler.h directives.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 directives.h insnsi.h nasm.h nasmlib.h \
243 opflags.h pptok.h preproc.h regs.h
244 float.
$(O
): float.c compiler.h directives.h float.h insnsi.h nasm.h \
245 nasmlib.h opflags.h pptok.h preproc.h regs.h
246 hashtbl.
$(O
): hashtbl.c compiler.h directives.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 directives.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 directives.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 directives.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 directives.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 directives.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 directives.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 directives.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 directives.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 directives.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 directives.h insnsi.h \
273 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
274 output
/nullout.
$(O
): output
/nullout.c compiler.h directives.h insnsi.h \
275 nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
276 output
/outaout.
$(O
): output
/outaout.c compiler.h directives.h eval.h \
277 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
278 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
279 output
/outas86.
$(O
): output
/outas86.c compiler.h directives.h insnsi.h \
280 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
281 preproc.h raa.h regs.h saa.h
282 output
/outbin.
$(O
): output
/outbin.c compiler.h directives.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 directives.h eval.h \
286 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
287 output
/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
288 output
/outdbg.
$(O
): output
/outdbg.c compiler.h directives.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 directives.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 directives.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 directives.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
/outform.
$(O
): output
/outform.c compiler.h directives.h insnsi.h \
302 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
303 output
/outieee.
$(O
): output
/outieee.c compiler.h directives.h insnsi.h \
304 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
306 output
/outlib.
$(O
): output
/outlib.c compiler.h directives.h insnsi.h nasm.h \
307 nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
308 output
/outmacho32.
$(O
): output
/outmacho32.c compiler.h directives.h eval.h \
309 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
310 pptok.h preproc.h raa.h regs.h saa.h
311 output
/outmacho64.
$(O
): output
/outmacho64.c compiler.h directives.h insnsi.h \
312 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
313 preproc.h raa.h regs.h saa.h
314 output
/outobj.
$(O
): output
/outobj.c compiler.h directives.h eval.h insnsi.h \
315 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
316 preproc.h regs.h stdscan.h
317 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h directives.h insnsi.h \
318 nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
319 preproc.h rdoff
/rdoff.h regs.h saa.h
320 parser.
$(O
): parser.c compiler.h directives.h eval.h float.h insns.h \
321 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
322 stdscan.h tables.h tokens.h
323 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
324 preproc.
$(O
): preproc.c compiler.h directives.h eval.h hashtbl.h insnsi.h \
325 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
327 quote.
$(O
): quote.c compiler.h nasmlib.h quote.h
328 raa.
$(O
): raa.c compiler.h nasmlib.h raa.h
329 rbtree.
$(O
): rbtree.c compiler.h rbtree.h
330 regdis.
$(O
): regdis.c regdis.h regs.h
331 regflags.
$(O
): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
332 opflags.h pptok.h preproc.h regs.h tables.h
333 regs.
$(O
): regs.c compiler.h insnsi.h opflags.h tables.h
334 regvals.
$(O
): regvals.c compiler.h insnsi.h opflags.h tables.h
335 saa.
$(O
): saa.c compiler.h nasmlib.h saa.h
336 stdscan.
$(O
): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h \
337 nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
338 strfunc.
$(O
): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
339 opflags.h pptok.h preproc.h regs.h
340 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
341 tokhash.
$(O
): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h \
342 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
343 ver.
$(O
): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h opflags.h \
344 pptok.h preproc.h regs.h version.h