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 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
20 LDFLAGS = $(ALL_CFLAGS)
22 PERL = perl -I$(srcdir)/perllib
30 # WMAKE errors out if a suffix is declared more than once, including
31 # its own built-in declarations. Thus, we need to explicitly clear the list
32 # first. Also, WMAKE only allows implicit rules that point "to the left"
35 .SUFFIXES: .man .1 .$(O) .i .c
38 $(CC) -c $(ALL_CFLAGS) -fo=$@ $<
40 NASM = nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) assemble.$(O) \
41 labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
42 outform.$(O) output/outbin.$(O) \
43 output/outaout.$(O) output/outcoff.$(O) \
44 output/outelf32.$(O) output/outelf64.$(O) \
45 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
46 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
47 preproc.$(O) pptok.$(O) \
48 listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) tokhash.$(O)
50 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) insnsd.$(O)
53 @echo 'Please build "dos", "win32" or "os2"'
56 $(MAKE) -f $(MAKEFILE_LIST) all TARGET=DOS4G
59 $(MAKE) -f $(MAKEFILE_LIST) all TARGET=NT
62 $(MAKE) -f $(MAKEFILE_LIST) all TARGET=OS2V2
64 all: nasm$(X) ndisasm$(X)
67 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
69 ndisasm$(X): $(NDISASM)
70 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
72 # These source files are automagically generated from a single
73 # instruction-table file by a Perl script. They're distributed,
74 # though, so it isn't necessary to have Perl just to recompile NASM
75 # from the distribution.
77 insnsa.c: insns.dat insns.pl
78 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
79 insnsd.c: insns.dat insns.pl
80 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
81 insnsi.h: insns.dat insns.pl
82 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
83 insnsn.c: insns.dat insns.pl
84 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
86 # These files contains all the standard macros that are derived from
88 version.h: version version.pl
89 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
91 version.mac: version version.pl
92 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
94 # This source file is generated from the standard macros file
95 # `standard.mac' by another Perl script. Again, it's part of the
96 # standard distribution.
98 macros.c: macros.pl standard.mac version.mac
99 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
101 # These source files are generated from regs.dat by yet another
103 regs.c: regs.dat regs.pl
104 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
105 regflags.c: regs.dat regs.pl
106 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
107 regdis.c: regs.dat regs.pl
108 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
109 regvals.c: regs.dat regs.pl
110 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
111 regs.h: regs.dat regs.pl
112 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
114 # Assembler token hash
115 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
116 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
117 $(srcdir)/tokens.dat > tokhash.c
119 # Assembler token metadata
120 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
121 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
122 $(srcdir)/tokens.dat > tokens.h
124 # Preprocessor token hash
125 pptok.h: pptok.dat pptok.pl perllib/phash.ph
126 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
127 pptok.c: pptok.dat pptok.pl perllib/phash.ph
128 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
130 # This target generates all files that require perl.
131 # This allows easier generation of distribution (see dist target).
132 PERLREQ = macros.c insnsa.c insnsd.c insnsi.h insnsn.c \
133 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
134 version.h version.mac pptok.h pptok.c
146 cd rdoff && $(MAKE) clean
148 distclean: clean .SYMBOLIC
163 -rm -f/s autom4te*.cache
164 cd rdoff && $(MAKE) distclean
166 cleaner: clean .SYMBOLIC
170 cd doc && $(MAKE) clean
172 spotless: distclean cleaner .SYMBOLIC
181 # cd rdoff && $(MAKE)
184 # cd doc && $(MAKE) all
186 everything: all doc rdf
188 #-- Magic hints to mkdep.pl --#
189 # @object-ending: ".$(O)"
190 # @path-separator: "/"
191 # @exclude: "config.h"
193 #-- Everything below is generated by mkdep.pl - do not edit --#
194 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
195 nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c tokens.h version.h
197 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h insnsn.c names.c \
198 nasm.h nasmlib.h regdis.c regs.c regs.h sync.h tokens.h version.h
199 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
200 nasmlib.h regs.h version.h
201 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
203 float.$(O): float.c compiler.h insnsi.h nasm.h nasmlib.h regs.h version.h
204 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
206 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
208 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
210 insnsn.$(O): insnsn.c
211 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h \
213 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
215 macros.$(O): macros.c
216 names.$(O): names.c insnsn.c regs.c
217 nasm.$(O): nasm.c assemble.h compiler.h eval.h insns.h insnsi.h labels.h \
218 listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h regs.h \
219 stdscan.h tokens.h version.h
220 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
222 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
223 nasmlib.h regs.h sync.h tokens.h version.h
224 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
226 output/outaout.$(O): output/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
227 outform.h regs.h stdscan.h version.h
228 output/outas86.$(O): output/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
229 outform.h regs.h version.h
230 output/outbin.$(O): output/outbin.c compiler.h eval.h insnsi.h labels.h \
231 nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
232 output/outcoff.$(O): output/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
233 outform.h regs.h version.h
234 output/outdbg.$(O): output/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
235 outform.h regs.h version.h
236 output/outelf32.$(O): output/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
237 outform.h regs.h stdscan.h version.h
238 output/outelf64.$(O): output/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
239 outform.h regs.h stdscan.h version.h
240 output/outieee.$(O): output/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
241 outform.h regs.h version.h
242 output/outmacho.$(O): output/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
243 outform.h regs.h version.h
244 output/outobj.$(O): output/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
245 outform.h regs.h stdscan.h version.h
246 output/outrdf.$(O): output/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
247 outform.h regs.h version.h
248 output/outrdf2.$(O): output/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
249 outform.h rdoff/rdoff.h regs.h version.h
250 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
251 parser.h regflags.c regs.h stdscan.h tokens.h version.h
252 pptok.$(O): pptok.c compiler.h nasmlib.h pptok.h preproc.h
253 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h macros.c nasm.h \
254 nasmlib.h pptok.h preproc.h regs.h version.h
255 regdis.$(O): regdis.c
256 regflags.$(O): regflags.c
258 regvals.$(O): regvals.c
259 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
260 stdscan.h tokens.h version.h
261 sync.$(O): sync.c compiler.h nasmlib.h sync.h
262 tokhash.$(O): tokhash.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \