3 # Makefile for building NASM using OpenWatcom 1.7
4 # building on a DOS/Win/OS2 platform host (backslashes
11 prefix = C
:\Program Files\NASM
12 exec_prefix = $(prefix)
13 bindir = $(prefix)\bin
14 mandir = $(prefix)\man
18 CFLAGS
= -6 -ox
-wx
-ze
-fpi
$(DEBUG
)
19 BUILD_CFLAGS
= $(CFLAGS
) $(TARGET_FLAGS
) # -I$(srcdir)/inttypes
20 INTERNAL_CFLAGS
= -I
$(srcdir) -I.
-DHAVE_SNPRINTF
-DHAVE_VSNPRINTF
21 ALL_CFLAGS
= $(BUILD_CFLAGS
) $(INTERNAL_CFLAGS
)
23 LDFLAGS
= $(ALL_CFLAGS
)
25 PERL
= perl
-I
$(srcdir)/perllib
33 # WMAKE errors out if a suffix is declared more than once, including
34 # its own built-in declarations. Thus, we need to explicitly clear the list
35 # first. Also, WMAKE only allows implicit rules that point "to the left"
38 .SUFFIXES
: .man
.1 .
$(O
) .i .c
40 # Needed to find C files anywhere but in the current directory
44 $(CC
) -c
$(ALL_CFLAGS
) -fo
=$^@
$[@
46 # Note: wcl386 is broken if forward slashes are used as path separators.
47 NASM
= nasm.
$(O
) nasmlib.
$(O
) wsaa.
$(O
) &
48 float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) &
49 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) &
50 outform.
$(O
) output\outbin.
$(O
) &
51 output\outaout.
$(O
) output\outcoff.
$(O
) &
52 output\outelf32.
$(O
) output\outelf64.
$(O
) &
53 output\outobj.
$(O
) output\outas86.
$(O
) output\outrdf2.
$(O
) &
54 output\outdbg.
$(O
) output\outieee.
$(O
) output\outmacho.
$(O
) &
55 preproc.
$(O
) quote.
$(O
) pptok.
$(O
) macros.
$(O
) &
56 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) tokhash.
$(O
) &
57 regvals.
$(O
) regflags.
$(O
)
59 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) &
60 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
63 @echo Please build
"dos", "win32" or
"os2"
66 $(MAKE
) /f
$(__MAKEFILES__
) all TARGET_FLAGS
="-bt=DOS -l=DOS4G"
69 $(MAKE
) /f
$(__MAKEFILES__
) all TARGET_FLAGS
="-bt=NT -l=NT"
72 $(MAKE
) /f
$(__MAKEFILES__
) all TARGET_FLAGS
="-bt=OS2 -l=OS2V2"
74 all: nasm
$(X
) ndisasm
$(X
) .SYMBOLIC
75 rem cd rdoff
&& $(MAKE
) all
78 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
80 ndisasm
$(X
): $(NDISASM
)
81 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
83 # These source files are automagically generated from a single
84 # instruction-table file by a Perl script. They're distributed,
85 # though, so it isn't necessary to have Perl just to recompile NASM
86 # from the distribution.
88 insnsb.c
: insns.dat insns.pl
89 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
90 insnsa.c
: insns.dat insns.pl
91 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
92 insnsd.c
: insns.dat insns.pl
93 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
94 insnsi.h
: insns.dat insns.pl
95 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
96 insnsn.c
: insns.dat insns.pl
97 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
99 # These files contains all the standard macros that are derived from
100 # the version number.
101 version.h
: version version.pl
102 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
104 version.mac
: version version.pl
105 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
107 # This source file is generated from the standard macros file
108 # `standard.mac' by another Perl script. Again, it's part of the
109 # standard distribution.
111 macros.c
: macros.pl standard.mac version.mac
112 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
114 # These source files are generated from regs.dat by yet another
116 regs.c
: regs.dat regs.pl
117 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
118 regflags.c
: regs.dat regs.pl
119 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
120 regdis.c
: regs.dat regs.pl
121 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
122 regdis.h
: regs.dat regs.pl
123 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
124 regvals.c
: regs.dat regs.pl
125 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
126 regs.h
: regs.dat regs.pl
127 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
129 # Assembler token hash
130 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
131 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat
&
132 $(srcdir)/tokens.dat
> tokhash.c
134 # Assembler token metadata
135 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
136 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat
&
137 $(srcdir)/tokens.dat
> tokens.h
139 # Preprocessor token hash
140 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
141 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
142 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
143 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
145 # This target generates all files that require perl.
146 # This allows easier generation of distribution (see dist target).
147 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c
&
148 regs.c regs.h regflags.c regdis.c regdis.h regvals.c
&
149 tokhash.c tokens.h pptok.h pptok.c
&
150 version.h version.mac
157 -del
/f output\
*.
$(O
)
162 rem cd rdoff
&& $(MAKE
) clean
164 distclean: clean .SYMBOLIC
167 -del
/f config.status
179 -del
/f
/s autom4te
*.cache
180 rem cd rdoff
&& $(MAKE
) distclean
182 cleaner
: clean .SYMBOLIC
186 rem cd doc
&& $(MAKE
) clean
188 spotless
: distclean cleaner .SYMBOLIC
197 # cd rdoff && $(MAKE)
200 # cd doc && $(MAKE) all
202 everything
: all doc rdf
204 #-- Magic hints to mkdep.pl --#
205 # @object-ending: ".$(O)"
206 # @path-separator: "\"
207 # @exclude: "config.h"
209 #-- Everything below is generated by mkdep.pl - do not edit --#
210 assemble.
$(O
): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h
&
211 nasmlib.h regs.h tables.h tokens.h version.h
212 crc64.
$(O
): crc64.c compiler.h
213 disasm.
$(O
): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h
&
214 regdis.h regs.h sync.h tables.h tokens.h version.h
215 eval.
$(O
): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h
&
216 nasmlib.h regs.h version.h
217 exprlib.
$(O
): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h
&
219 float.
$(O
): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h
&
221 hashtbl.
$(O
): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h
&
223 insnsa.
$(O
): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
225 insnsb.
$(O
): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
227 insnsd.
$(O
): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
229 insnsn.
$(O
): insnsn.c compiler.h insnsi.h tables.h
230 labels.
$(O
): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h
&
232 lib\snprintf.
$(O
): lib\snprintf.c compiler.h nasmlib.h
233 lib
\vsnprintf.
$(O
): lib
\vsnprintf.c compiler.h nasmlib.h
234 listing.
$(O
): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h
&
236 macros.
$(O
): macros.c compiler.h insnsi.h tables.h
237 nasm.
$(O
): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h
&
238 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h
&
239 regs.h stdscan.h tokens.h version.h
240 nasmlib.
$(O
): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
242 ndisasm.
$(O
): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h
&
243 nasmlib.h regs.h sync.h tokens.h version.h
244 outform.
$(O
): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h
&
246 output\outaout.
$(O
): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h
&
247 outform.h regs.h stdscan.h version.h
248 output\outas86.
$(O
): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h
&
249 outform.h regs.h version.h
250 output\outbin.
$(O
): output\outbin.c compiler.h eval.h insnsi.h labels.h
&
251 nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
252 output\outcoff.
$(O
): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h
&
253 outform.h regs.h version.h
254 output\outdbg.
$(O
): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h
&
255 outform.h regs.h version.h
256 output\outelf32.
$(O
): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h
&
257 outform.h regs.h stdscan.h version.h wsaa.h
258 output\outelf64.
$(O
): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h
&
259 outform.h regs.h stdscan.h version.h wsaa.h
260 output\outieee.
$(O
): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h
&
261 outform.h regs.h version.h
262 output\outmacho.
$(O
): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h
&
263 outform.h regs.h version.h
264 output\outobj.
$(O
): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h
&
265 outform.h regs.h stdscan.h version.h
266 output\outrdf.
$(O
): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h
&
267 outform.h regs.h version.h
268 output\outrdf2.
$(O
): output\outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h
&
269 outform.h rdoff
\rdoff.h regs.h version.h
270 parser.
$(O
): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h
&
271 parser.h regs.h stdscan.h tables.h tokens.h version.h
272 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
273 preproc.
$(O
): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h
&
274 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
275 quote.
$(O
): quote.c compiler.h nasmlib.h quote.h
276 regdis.
$(O
): regdis.c regdis.h regs.h
277 regflags.
$(O
): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h
&
279 regs.
$(O
): regs.c compiler.h insnsi.h tables.h
280 regvals.
$(O
): regvals.c compiler.h insnsi.h tables.h
281 stdscan.
$(O
): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h quote.h
&
282 regs.h stdscan.h tokens.h version.h
283 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
284 tokhash.
$(O
): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h
&
285 nasmlib.h regs.h tokens.h version.h