3 # Makefile for cross-compiling NASM from Linux
4 # to DOS, Win32 or OS/2 using OpenWatcom.
9 prefix = C
:/Program Files
/NASM
10 exec_prefix = $(prefix)
11 bindir = $(prefix)/bin
12 mandir = $(prefix)/man
15 CFLAGS
= -3 -bcl
=$(TARGET
) -ox
-wx
-ze
-fpi
16 BUILD_CFLAGS
= $(CFLAGS
) # -I$(srcdir)/inttypes
17 INTERNAL_CFLAGS
= -I
$(srcdir) -I. \
18 -DHAVE_SNPRINTF
-DHAVE_VSNPRINTF
19 ALL_CFLAGS
= $(BUILD_CFLAGS
) $(INTERNAL_CFLAGS
)
21 LDFLAGS
= $(ALL_CFLAGS
)
23 PERL
= perl
-I
$(srcdir)/perllib
31 # WMAKE errors out if a suffix is declared more than once, including
32 # its own built-in declarations. Thus, we need to explicitly clear the list
33 # first. Also, WMAKE only allows implicit rules that point "to the left"
36 .SUFFIXES
: .man
.1 .
$(O
) .i .c
39 $(CC
) -c
$(ALL_CFLAGS
) -fo
=$@
$<
41 NASM
= nasm.
$(O
) nasmlib.
$(O
) float.
$(O
) insnsa.
$(O
) assemble.
$(O
) \
42 labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
43 outform.
$(O
) output
/outbin.
$(O
) \
44 output
/outaout.
$(O
) output
/outcoff.
$(O
) \
45 output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
46 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
47 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) \
48 preproc.
$(O
) pptok.
$(O
) \
49 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) tokhash.
$(O
)
51 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) insnsd.
$(O
)
54 @echo
'Please build "dos", "win32" or "os2"'
57 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET
=DOS4G
60 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET
=NT
63 $(MAKE
) -f
$(MAKEFILE_LIST
) all TARGET
=OS2V2
65 all: nasm
$(X
) ndisasm
$(X
)
68 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
70 ndisasm
$(X
): $(NDISASM
)
71 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
73 # These source files are automagically generated from a single
74 # instruction-table file by a Perl script. They're distributed,
75 # though, so it isn't necessary to have Perl just to recompile NASM
76 # from the distribution.
78 insnsa.c
: insns.dat insns.pl
79 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
80 insnsd.c
: insns.dat insns.pl
81 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
82 insnsi.h
: insns.dat insns.pl
83 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
84 insnsn.c
: insns.dat insns.pl
85 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
87 # These files contains all the standard macros that are derived from
89 version.h
: version version.pl
90 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
92 version.mac
: version version.pl
93 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
95 # This source file is generated from the standard macros file
96 # `standard.mac' by another Perl script. Again, it's part of the
97 # standard distribution.
99 macros.c
: macros.pl standard.mac version.mac
100 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
102 # These source files are generated from regs.dat by yet another
104 regs.c
: regs.dat regs.pl
105 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
106 regflags.c
: regs.dat regs.pl
107 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
108 regdis.c
: regs.dat regs.pl
109 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
110 regvals.c
: regs.dat regs.pl
111 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
112 regs.h
: regs.dat regs.pl
113 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
115 # Assembler token hash
116 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
117 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
118 $(srcdir)/tokens.dat
> tokhash.c
120 # Assembler token metadata
121 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
122 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
123 $(srcdir)/tokens.dat
> tokens.h
125 # Preprocessor token hash
126 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
127 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
128 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
129 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
131 # This target generates all files that require perl.
132 # This allows easier generation of distribution (see dist target).
133 PERLREQ
= macros.c insnsa.c insnsd.c insnsi.h insnsn.c \
134 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
135 version.h version.mac pptok.h pptok.c
147 # cd rdoff && $(MAKE) clean
149 distclean: clean .SYMBOLIC
164 -rm -f
/s autom4te
*.cache
165 # cd rdoff && $(MAKE) distclean
167 cleaner
: clean .SYMBOLIC
171 # cd doc && $(MAKE) clean
173 spotless
: distclean cleaner .SYMBOLIC
182 # cd rdoff && $(MAKE)
185 # cd doc && $(MAKE) all
187 everything
: all doc rdf
189 #-- Magic hints to mkdep.pl --#
190 # @object-ending: ".$(O)"
191 # @path-separator: "/"
192 # @exclude: "config.h"
194 #-- Everything below is generated by mkdep.pl - do not edit --#
195 assemble.
$(O
): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
196 nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c tokens.h version.h
197 crc64.
$(O
): crc64.c compiler.h
198 disasm.
$(O
): disasm.c compiler.h disasm.h insns.h insnsi.h insnsn.c names.c \
199 nasm.h nasmlib.h regdis.c regs.c regs.h sync.h tokens.h version.h
200 eval.
$(O
): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
201 nasmlib.h regs.h version.h
202 exprlib.
$(O
): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
204 float.
$(O
): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h \
206 hashtbl.
$(O
): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
208 insnsa.
$(O
): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
210 insnsd.
$(O
): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
212 insnsn.
$(O
): insnsn.c
213 labels.
$(O
): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h \
215 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h nasmlib.h
216 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h nasmlib.h
217 listing.
$(O
): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
219 macros.
$(O
): macros.c compiler.h
220 names.
$(O
): names.c compiler.h insnsn.c regs.c
221 nasm.
$(O
): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
222 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
223 regs.h stdscan.h tokens.h version.h
224 nasmlib.
$(O
): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
226 ndisasm.
$(O
): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
227 nasmlib.h regs.h sync.h tokens.h version.h
228 outform.
$(O
): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
230 output
/outaout.
$(O
): output
/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
231 outform.h regs.h stdscan.h version.h
232 output
/outas86.
$(O
): output
/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
233 outform.h regs.h version.h
234 output
/outbin.
$(O
): output
/outbin.c compiler.h eval.h insnsi.h labels.h \
235 nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
236 output
/outcoff.
$(O
): output
/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
237 outform.h regs.h version.h
238 output
/outdbg.
$(O
): output
/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
239 outform.h regs.h version.h
240 output
/outelf32.
$(O
): output
/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
241 outform.h regs.h stdscan.h version.h
242 output
/outelf64.
$(O
): output
/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
243 outform.h regs.h stdscan.h version.h
244 output
/outieee.
$(O
): output
/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
245 outform.h regs.h version.h
246 output
/outmacho.
$(O
): output
/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
247 outform.h regs.h version.h
248 output
/outobj.
$(O
): output
/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
249 outform.h regs.h stdscan.h version.h
250 output
/outrdf.
$(O
): output
/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
251 outform.h regs.h version.h
252 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
253 outform.h rdoff
/rdoff.h regs.h version.h
254 parser.
$(O
): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
255 parser.h regflags.c regs.h stdscan.h tokens.h version.h
256 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
257 preproc.
$(O
): preproc.c compiler.h hashtbl.h insnsi.h macros.c nasm.h \
258 nasmlib.h pptok.h preproc.h regs.h stdscan.h tokens.h version.h
259 regdis.
$(O
): regdis.c
260 regflags.
$(O
): regflags.c
261 regs.
$(O
): regs.c compiler.h
262 regvals.
$(O
): regvals.c
263 stdscan.
$(O
): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
264 stdscan.h tokens.h version.h
265 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
266 tokhash.
$(O
): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
267 nasmlib.h regs.h tokens.h version.h