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
) \
63 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
64 output
/outform.
$(O
) output
/outlib.
$(O
) output
/nulldbg.
$(O
) \
65 output
/outbin.
$(O
) output
/outaout.
$(O
) output
/outcoff.
$(O
) \
66 output
/outelf.
$(O
) output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
67 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
68 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) \
69 preproc.
$(O
) quote.
$(O
) pptok.
$(O
) macros.
$(O
) \
70 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) strfunc.
$(O
) \
71 tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
)
73 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
74 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
75 #-- End File Lists --#
78 @echo
'Please build "dos", "win32" or "os2"'
81 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=DOS -l=DOS4G'
84 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=NT -l=NT'
87 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=OS2 -l=OS2V2'
89 all: nasm
$(X
) ndisasm
$(X
)
92 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
94 ndisasm
$(X
): $(NDISASM
)
95 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
97 # These source files are automagically generated from a single
98 # instruction-table file by a Perl script. They're distributed,
99 # though, so it isn't necessary to have Perl just to recompile NASM
100 # from the distribution.
102 insnsb.c
: insns.dat insns.pl
103 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
104 insnsa.c
: insns.dat insns.pl
105 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
106 insnsd.c
: insns.dat insns.pl
107 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
108 insnsi.h
: insns.dat insns.pl
109 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
110 insnsn.c
: insns.dat insns.pl
111 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
113 # These files contains all the standard macros that are derived from
114 # the version number.
115 version.h
: version version.pl
116 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
118 version.mac
: version version.pl
119 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
121 # This source file is generated from the standard macros file
122 # `standard.mac' by another Perl script. Again, it's part of the
123 # standard distribution.
125 macros.c
: macros.pl standard.mac version.mac
126 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
128 # These source files are generated from regs.dat by yet another
130 regs.c
: regs.dat regs.pl
131 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
132 regflags.c
: regs.dat regs.pl
133 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
134 regdis.c
: regs.dat regs.pl
135 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
136 regdis.h
: regs.dat regs.pl
137 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
138 regvals.c
: regs.dat regs.pl
139 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
140 regs.h
: regs.dat regs.pl
141 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
143 # Assembler token hash
144 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
145 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
146 $(srcdir)/tokens.dat
> tokhash.c
148 # Assembler token metadata
149 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
150 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
151 $(srcdir)/tokens.dat
> tokens.h
153 # Preprocessor token hash
154 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
155 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
156 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
157 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
159 # This target generates all files that require perl.
160 # This allows easier generation of distribution (see dist target).
161 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
162 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
163 tokhash.c tokens.h pptok.h pptok.c \
164 version.h version.mac
176 # cd rdoff && $(MAKE) clean
178 distclean: clean .SYMBOLIC
193 -rm -f
/s autom4te
*.cache
194 # cd rdoff && $(MAKE) distclean
196 cleaner
: clean .SYMBOLIC
200 # cd doc && $(MAKE) clean
202 spotless
: distclean cleaner .SYMBOLIC
211 # cd rdoff && $(MAKE)
214 # cd doc && $(MAKE) all
216 everything
: all doc rdf
218 #-- Magic hints to mkdep.pl --#
219 # @object-ending: ".$(O)"
220 # @path-separator: "/"
221 # @exclude: "config.h"
223 #-- Everything below is generated by mkdep.pl - do not edit --#
224 assemble.
$(O
): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
225 nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
226 crc64.
$(O
): crc64.c compiler.h nasmlib.h
227 disasm.
$(O
): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h \
228 pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
229 eval.
$(O
): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
230 nasmlib.h pptok.h preproc.h regs.h
231 exprlib.
$(O
): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h \
233 float.
$(O
): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h pptok.h \
235 hashtbl.
$(O
): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
236 pptok.h preproc.h regs.h
237 insnsa.
$(O
): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
238 preproc.h regs.h tokens.h
239 insnsb.
$(O
): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
240 preproc.h regs.h tokens.h
241 insnsd.
$(O
): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
242 preproc.h regs.h tokens.h
243 insnsn.
$(O
): insnsn.c compiler.h insnsi.h tables.h
244 labels.
$(O
): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h pptok.h \
246 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h nasmlib.h
247 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h nasmlib.h
248 listing.
$(O
): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
249 pptok.h preproc.h regs.h
250 macros.
$(O
): macros.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
251 output
/outform.h pptok.h preproc.h regs.h tables.h
252 nasm.
$(O
): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
253 labels.h listing.h nasm.h nasmlib.h output
/outform.h parser.h pptok.h \
254 preproc.h raa.h regs.h saa.h stdscan.h tokens.h
255 nasmlib.
$(O
): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
256 preproc.h regs.h tokens.h
257 ndisasm.
$(O
): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
258 nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
259 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h insnsi.h nasm.h nasmlib.h \
260 pptok.h preproc.h regs.h
261 output
/outaout.
$(O
): output
/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
262 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h saa.h \
264 output
/outas86.
$(O
): output
/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
265 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h saa.h
266 output
/outbin.
$(O
): output
/outbin.c compiler.h eval.h insnsi.h labels.h \
267 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h regs.h \
269 output
/outcoff.
$(O
): output
/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
270 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h saa.h
271 output
/outdbg.
$(O
): output
/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
272 output
/outform.h pptok.h preproc.h regs.h
273 output
/outelf.
$(O
): output
/outelf.c compiler.h insnsi.h nasm.h nasmlib.h \
274 output
/dwarf.h output
/elfcommon.h output
/outelf.h output
/outform.h pptok.h \
276 output
/outelf32.
$(O
): output
/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
277 output
/dwarf.h output
/elf32.h output
/elfcommon.h output
/outelf.h \
278 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h rbtree.h regs.h \
280 output
/outelf64.
$(O
): output
/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
281 output
/dwarf.h output
/elf64.h output
/elfcommon.h output
/outelf.h \
282 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h rbtree.h regs.h \
284 output
/outform.
$(O
): output
/outform.c compiler.h insnsi.h nasm.h nasmlib.h \
285 output
/outform.h pptok.h preproc.h regs.h
286 output
/outieee.
$(O
): output
/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
287 output
/outform.h output
/outlib.h pptok.h preproc.h regs.h
288 output
/outlib.
$(O
): output
/outlib.c compiler.h insnsi.h nasm.h nasmlib.h \
289 output
/outlib.h pptok.h preproc.h regs.h
290 output
/outmacho.
$(O
): output
/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
291 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h saa.h
292 output
/outobj.
$(O
): output
/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
293 output
/outform.h output
/outlib.h pptok.h preproc.h regs.h stdscan.h
294 output
/outrdf.
$(O
): output
/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
295 output
/outform.h pptok.h preproc.h regs.h
296 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
297 output
/outform.h output
/outlib.h pptok.h preproc.h rdoff
/rdoff.h regs.h \
299 owtest.
$(O
): owtest.c
300 parser.
$(O
): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
301 parser.h pptok.h preproc.h regs.h stdscan.h tables.h tokens.h
302 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
303 preproc.
$(O
): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
304 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
305 quote.
$(O
): quote.c compiler.h nasmlib.h quote.h
306 raa.
$(O
): raa.c compiler.h nasmlib.h raa.h
307 rbtree.
$(O
): rbtree.c compiler.h rbtree.h
308 regdis.
$(O
): regdis.c regdis.h regs.h
309 regflags.
$(O
): regflags.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h \
310 preproc.h regs.h tables.h
311 regs.
$(O
): regs.c compiler.h insnsi.h tables.h
312 regvals.
$(O
): regvals.c compiler.h insnsi.h tables.h
313 saa.
$(O
): saa.c compiler.h nasmlib.h saa.h
314 stdscan.
$(O
): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
315 preproc.h quote.h regs.h stdscan.h tokens.h
316 strfunc.
$(O
): strfunc.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h \
318 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
319 tokhash.
$(O
): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
320 nasmlib.h pptok.h preproc.h regs.h tokens.h
321 ver.
$(O
): ver.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h preproc.h \