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
)
75 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
76 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
77 #-- End File Lists --#
80 @echo
'Please build "dos", "win32" or "os2"'
83 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=DOS -l=DOS4G'
86 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=NT -l=NT'
89 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=OS2 -l=OS2V2'
91 all: nasm
$(X
) ndisasm
$(X
)
94 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
96 ndisasm
$(X
): $(NDISASM
)
97 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
99 # These source files are automagically generated from a single
100 # instruction-table file by a Perl script. They're distributed,
101 # though, so it isn't necessary to have Perl just to recompile NASM
102 # from the distribution.
104 insnsb.c
: insns.dat insns.pl
105 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
106 insnsa.c
: insns.dat insns.pl
107 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
108 insnsd.c
: insns.dat insns.pl
109 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
110 insnsi.h
: insns.dat insns.pl
111 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
112 insnsn.c
: insns.dat insns.pl
113 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
115 # These files contains all the standard macros that are derived from
116 # the version number.
117 version.h
: version version.pl
118 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
120 version.mac
: version version.pl
121 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
123 # This source file is generated from the standard macros file
124 # `standard.mac' by another Perl script. Again, it's part of the
125 # standard distribution.
127 macros.c
: macros.pl standard.mac version.mac
128 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
130 # These source files are generated from regs.dat by yet another
132 regs.c
: regs.dat regs.pl
133 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
134 regflags.c
: regs.dat regs.pl
135 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
136 regdis.c
: regs.dat regs.pl
137 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
138 regdis.h
: regs.dat regs.pl
139 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
140 regvals.c
: regs.dat regs.pl
141 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
142 regs.h
: regs.dat regs.pl
143 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
145 # Assembler token hash
146 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
147 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
148 $(srcdir)/tokens.dat
> tokhash.c
150 # Assembler token metadata
151 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
152 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
153 $(srcdir)/tokens.dat
> tokens.h
155 # Preprocessor token hash
156 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
157 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
158 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
159 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
161 # This target generates all files that require perl.
162 # This allows easier generation of distribution (see dist target).
163 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
164 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
165 tokhash.c tokens.h pptok.h pptok.c \
166 version.h version.mac
178 # cd rdoff && $(MAKE) clean
180 distclean: clean .SYMBOLIC
195 -rm -f
/s autom4te
*.cache
196 # cd rdoff && $(MAKE) distclean
198 cleaner
: clean .SYMBOLIC
202 # cd doc && $(MAKE) clean
204 spotless
: distclean cleaner .SYMBOLIC
213 # cd rdoff && $(MAKE)
216 # cd doc && $(MAKE) all
218 everything
: all doc rdf
220 #-- Magic hints to mkdep.pl --#
221 # @object-ending: ".$(O)"
222 # @path-separator: "/"
223 # @exclude: "config.h"
225 #-- Everything below is generated by mkdep.pl - do not edit --#
226 assemble.
$(O
): assemble.c assemble.h compiler.h directives.h insns.h \
227 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
228 crc64.
$(O
): crc64.c compiler.h nasmlib.h
229 directives.
$(O
): directives.c compiler.h directives.h hashtbl.h insnsi.h \
230 nasm.h nasmlib.h pptok.h preproc.h regs.h
231 disasm.
$(O
): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
232 nasm.h nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
233 eval.
$(O
): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h \
234 nasm.h nasmlib.h pptok.h preproc.h regs.h
235 exprlib.
$(O
): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
236 pptok.h preproc.h regs.h
237 float.
$(O
): float.c compiler.h directives.h float.h insnsi.h nasm.h \
238 nasmlib.h pptok.h preproc.h regs.h
239 hashtbl.
$(O
): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
240 nasmlib.h pptok.h preproc.h regs.h
241 insnsa.
$(O
): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h \
242 nasmlib.h pptok.h preproc.h regs.h tokens.h
243 insnsb.
$(O
): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h \
244 nasmlib.h pptok.h preproc.h regs.h tokens.h
245 insnsd.
$(O
): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h \
246 nasmlib.h pptok.h preproc.h regs.h tokens.h
247 insnsn.
$(O
): insnsn.c compiler.h insnsi.h tables.h
248 labels.
$(O
): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
249 nasmlib.h pptok.h preproc.h regs.h
250 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h nasmlib.h
251 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h nasmlib.h
252 listing.
$(O
): listing.c compiler.h directives.h insnsi.h listing.h nasm.h \
253 nasmlib.h pptok.h preproc.h regs.h
254 macros.
$(O
): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
255 nasmlib.h output
/outform.h pptok.h preproc.h regs.h tables.h
256 nasm.
$(O
): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h \
257 insnsi.h labels.h listing.h nasm.h nasmlib.h output
/outform.h parser.h \
258 pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
259 nasmlib.
$(O
): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h \
260 nasmlib.h pptok.h preproc.h regs.h tokens.h
261 ndisasm.
$(O
): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
262 nasm.h nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
263 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h directives.h insnsi.h \
264 nasm.h nasmlib.h pptok.h preproc.h regs.h
265 output
/nullout.
$(O
): output
/nullout.c compiler.h directives.h insnsi.h \
266 nasm.h nasmlib.h output
/outlib.h pptok.h preproc.h regs.h
267 output
/outaout.
$(O
): output
/outaout.c compiler.h directives.h insnsi.h \
268 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
269 regs.h saa.h stdscan.h
270 output
/outas86.
$(O
): output
/outas86.c compiler.h directives.h insnsi.h \
271 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
273 output
/outbin.
$(O
): output
/outbin.c compiler.h directives.h eval.h insnsi.h \
274 labels.h nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h \
275 preproc.h regs.h saa.h stdscan.h
276 output
/outcoff.
$(O
): output
/outcoff.c compiler.h directives.h insnsi.h \
277 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
279 output
/outdbg.
$(O
): output
/outdbg.c compiler.h directives.h insnsi.h nasm.h \
280 nasmlib.h output
/outform.h pptok.h preproc.h regs.h
281 output
/outelf.
$(O
): output
/outelf.c compiler.h directives.h insnsi.h nasm.h \
282 nasmlib.h output
/dwarf.h output
/elfcommon.h output
/outelf.h \
283 output
/outform.h pptok.h preproc.h regs.h
284 output
/outelf32.
$(O
): output
/outelf32.c compiler.h directives.h insnsi.h \
285 nasm.h nasmlib.h output
/dwarf.h output
/elf32.h output
/elfcommon.h \
286 output
/outelf.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
287 rbtree.h regs.h saa.h stdscan.h
288 output
/outelf64.
$(O
): output
/outelf64.c compiler.h directives.h insnsi.h \
289 nasm.h nasmlib.h output
/dwarf.h output
/elf64.h output
/elfcommon.h \
290 output
/outelf.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
291 rbtree.h regs.h saa.h stdscan.h
292 output
/outexe.
$(O
): output
/outexe.c compiler.h directives.h insnsi.h nasm.h \
293 nasmlib.h output
/outform.h pptok.h preproc.h regs.h
294 output
/outform.
$(O
): output
/outform.c compiler.h directives.h insnsi.h \
295 nasm.h nasmlib.h output
/outform.h pptok.h preproc.h regs.h
296 output
/outieee.
$(O
): output
/outieee.c compiler.h directives.h insnsi.h \
297 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h regs.h
298 output
/outlib.
$(O
): output
/outlib.c compiler.h directives.h insnsi.h nasm.h \
299 nasmlib.h output
/outlib.h pptok.h preproc.h regs.h
300 output
/outmacho32.
$(O
): output
/outmacho32.c compiler.h directives.h insnsi.h \
301 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
303 output
/outmacho64.
$(O
): output
/outmacho64.c compiler.h directives.h insnsi.h \
304 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
306 output
/outobj.
$(O
): output
/outobj.c compiler.h directives.h insnsi.h nasm.h \
307 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h regs.h \
309 output
/outrdf.
$(O
): output
/outrdf.c compiler.h directives.h insnsi.h nasm.h \
310 nasmlib.h output
/outform.h pptok.h preproc.h regs.h
311 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h directives.h insnsi.h \
312 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h \
313 rdoff
/rdoff.h regs.h saa.h
314 parser.
$(O
): parser.c compiler.h directives.h float.h insns.h insnsi.h \
315 nasm.h nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h tables.h \
317 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
318 preproc.
$(O
): preproc.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
319 nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
320 quote.
$(O
): quote.c compiler.h nasmlib.h quote.h
321 raa.
$(O
): raa.c compiler.h nasmlib.h raa.h
322 rbtree.
$(O
): rbtree.c compiler.h rbtree.h
323 regdis.
$(O
): regdis.c regdis.h regs.h
324 regflags.
$(O
): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
325 pptok.h preproc.h regs.h tables.h
326 regs.
$(O
): regs.c compiler.h insnsi.h tables.h
327 regvals.
$(O
): regvals.c compiler.h insnsi.h tables.h
328 saa.
$(O
): saa.c compiler.h nasmlib.h saa.h
329 stdscan.
$(O
): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h \
330 nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
331 strfunc.
$(O
): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
332 pptok.h preproc.h regs.h
333 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
334 tokhash.
$(O
): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h \
335 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
336 ver.
$(O
): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h pptok.h \
337 preproc.h regs.h version.h