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
) raa.
$(O
) saa.
$(O
) \
61 float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) \
62 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
63 outform.
$(O
) output
/outbin.
$(O
) \
64 output
/outaout.
$(O
) output
/outcoff.
$(O
) \
65 output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
66 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
67 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) \
68 preproc.
$(O
) quote.
$(O
) pptok.
$(O
) macros.
$(O
) \
69 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) strfunc.
$(O
) \
70 tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
)
72 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) \
73 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
74 #-- End File Lists --#
77 @echo
'Please build "dos", "win32" or "os2"'
80 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=DOS -l=DOS4G'
83 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=NT -l=NT'
86 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET_FLAGS
='-bt=OS2 -l=OS2V2'
88 all: nasm
$(X
) ndisasm
$(X
)
91 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
93 ndisasm
$(X
): $(NDISASM
)
94 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
96 # These source files are automagically generated from a single
97 # instruction-table file by a Perl script. They're distributed,
98 # though, so it isn't necessary to have Perl just to recompile NASM
99 # from the distribution.
101 insnsb.c
: insns.dat insns.pl
102 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
103 insnsa.c
: insns.dat insns.pl
104 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
105 insnsd.c
: insns.dat insns.pl
106 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
107 insnsi.h
: insns.dat insns.pl
108 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
109 insnsn.c
: insns.dat insns.pl
110 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
112 # These files contains all the standard macros that are derived from
113 # the version number.
114 version.h
: version version.pl
115 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
117 version.mac
: version version.pl
118 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
120 # This source file is generated from the standard macros file
121 # `standard.mac' by another Perl script. Again, it's part of the
122 # standard distribution.
124 macros.c
: macros.pl standard.mac version.mac
125 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
127 # These source files are generated from regs.dat by yet another
129 regs.c
: regs.dat regs.pl
130 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
131 regflags.c
: regs.dat regs.pl
132 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
133 regdis.c
: regs.dat regs.pl
134 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
135 regdis.h
: regs.dat regs.pl
136 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
137 regvals.c
: regs.dat regs.pl
138 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
139 regs.h
: regs.dat regs.pl
140 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
142 # Assembler token hash
143 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
144 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
145 $(srcdir)/tokens.dat
> tokhash.c
147 # Assembler token metadata
148 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
149 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
150 $(srcdir)/tokens.dat
> tokens.h
152 # Preprocessor token hash
153 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
154 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
155 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
156 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
158 # This target generates all files that require perl.
159 # This allows easier generation of distribution (see dist target).
160 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
161 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
162 tokhash.c tokens.h pptok.h pptok.c \
163 version.h version.mac
175 # cd rdoff && $(MAKE) clean
177 distclean: clean .SYMBOLIC
192 -rm -f
/s autom4te
*.cache
193 # cd rdoff && $(MAKE) distclean
195 cleaner
: clean .SYMBOLIC
199 # cd doc && $(MAKE) clean
201 spotless
: distclean cleaner .SYMBOLIC
210 # cd rdoff && $(MAKE)
213 # cd doc && $(MAKE) all
215 everything
: all doc rdf
217 #-- Magic hints to mkdep.pl --#
218 # @object-ending: ".$(O)"
219 # @path-separator: "/"
220 # @exclude: "config.h"
222 #-- Everything below is generated by mkdep.pl - do not edit --#
223 assemble.
$(O
): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
224 nasmlib.h regs.h tables.h tokens.h version.h
225 crc64.
$(O
): crc64.c compiler.h nasmlib.h
226 disasm.
$(O
): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h \
227 regdis.h regs.h sync.h tables.h tokens.h version.h
228 eval.
$(O
): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
229 nasmlib.h regs.h version.h
230 exprlib.
$(O
): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
232 float.
$(O
): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h \
234 hashtbl.
$(O
): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
236 insnsa.
$(O
): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
238 insnsb.
$(O
): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
240 insnsd.
$(O
): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
242 insnsn.
$(O
): insnsn.c compiler.h insnsi.h tables.h
243 labels.
$(O
): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h \
245 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h nasmlib.h
246 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h nasmlib.h
247 listing.
$(O
): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
249 macros.
$(O
): macros.c compiler.h hashtbl.h insnsi.h nasmlib.h tables.h
250 nasm.
$(O
): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
251 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
252 raa.h regs.h saa.h stdscan.h tokens.h version.h
253 nasmlib.
$(O
): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
255 ndisasm.
$(O
): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
256 nasmlib.h regs.h sync.h tokens.h version.h
257 outform.
$(O
): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
259 output
/outaout.
$(O
): output
/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
260 outform.h raa.h regs.h saa.h stdscan.h version.h
261 output
/outas86.
$(O
): output
/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
262 outform.h raa.h regs.h saa.h version.h
263 output
/outbin.
$(O
): output
/outbin.c compiler.h eval.h insnsi.h labels.h \
264 nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
265 output
/outcoff.
$(O
): output
/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
266 outform.h raa.h regs.h saa.h version.h
267 output
/outdbg.
$(O
): output
/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
268 outform.h regs.h version.h
269 output
/outelf32.
$(O
): output
/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
270 outform.h raa.h regs.h saa.h stdscan.h version.h
271 output
/outelf64.
$(O
): output
/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
272 outform.h raa.h regs.h saa.h stdscan.h version.h
273 output
/outieee.
$(O
): output
/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
274 outform.h regs.h version.h
275 output
/outmacho.
$(O
): output
/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
276 outform.h raa.h regs.h saa.h version.h
277 output
/outobj.
$(O
): output
/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
278 outform.h regs.h stdscan.h version.h
279 output
/outrdf.
$(O
): output
/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
280 outform.h regs.h version.h
281 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
282 outform.h rdoff
/rdoff.h regs.h saa.h version.h
283 parser.
$(O
): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
284 parser.h regs.h stdscan.h tables.h tokens.h version.h
285 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
286 preproc.
$(O
): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
287 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
288 quote.
$(O
): quote.c compiler.h nasmlib.h quote.h
289 raa.
$(O
): raa.c compiler.h nasmlib.h raa.h
290 regdis.
$(O
): regdis.c regdis.h regs.h
291 regflags.
$(O
): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
293 regs.
$(O
): regs.c compiler.h insnsi.h tables.h
294 regvals.
$(O
): regvals.c compiler.h insnsi.h tables.h
295 saa.
$(O
): saa.c compiler.h nasmlib.h saa.h
296 stdscan.
$(O
): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h quote.h \
297 regs.h stdscan.h tokens.h version.h
298 strfunc.
$(O
): strfunc.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
300 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
301 tokhash.
$(O
): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
302 nasmlib.h regs.h tokens.h version.h