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
) float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) &
48 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) &
49 outform.
$(O
) output\outbin.
$(O
) &
50 output\outaout.
$(O
) output\outcoff.
$(O
) &
51 output\outelf32.
$(O
) output\outelf64.
$(O
) &
52 output\outobj.
$(O
) output\outas86.
$(O
) output\outrdf2.
$(O
) &
53 output\outdbg.
$(O
) output\outieee.
$(O
) output\outmacho.
$(O
) &
54 preproc.
$(O
) pptok.
$(O
) macros.
$(O
) &
55 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) tokhash.
$(O
) &
56 regvals.
$(O
) regflags.
$(O
)
58 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) &
59 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
62 @echo Please build
"dos", "win32" or
"os2"
65 $(MAKE
) /f
$(__MAKEFILES__
) all TARGET_FLAGS
="-bt=DOS -l=DOS4G"
68 $(MAKE
) /f
$(__MAKEFILES__
) all TARGET_FLAGS
="-bt=NT -l=NT"
71 $(MAKE
) /f
$(__MAKEFILES__
) all TARGET_FLAGS
="-bt=OS2 -l=OS2V2"
73 all: nasm
$(X
) ndisasm
$(X
) .SYMBOLIC
74 rem cd rdoff
&& $(MAKE
) all
77 $(LD
) $(LDFLAGS
) -fe
=nasm
$(X
) $(NASM
) $(LIBS
)
79 ndisasm
$(X
): $(NDISASM
)
80 $(LD
) $(LDFLAGS
) -fe
=ndisasm
$(X
) $(NDISASM
) $(LIBS
)
82 # These source files are automagically generated from a single
83 # instruction-table file by a Perl script. They're distributed,
84 # though, so it isn't necessary to have Perl just to recompile NASM
85 # from the distribution.
87 insnsb.c
: insns.dat insns.pl
88 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
89 insnsa.c
: insns.dat insns.pl
90 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
91 insnsd.c
: insns.dat insns.pl
92 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
93 insnsi.h
: insns.dat insns.pl
94 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
95 insnsn.c
: insns.dat insns.pl
96 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
98 # These files contains all the standard macros that are derived from
100 version.h
: version version.pl
101 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
103 version.mac
: version version.pl
104 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
106 # This source file is generated from the standard macros file
107 # `standard.mac' by another Perl script. Again, it's part of the
108 # standard distribution.
110 macros.c
: macros.pl standard.mac version.mac
111 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
113 # These source files are generated from regs.dat by yet another
115 regs.c
: regs.dat regs.pl
116 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
117 regflags.c
: regs.dat regs.pl
118 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
119 regdis.c
: regs.dat regs.pl
120 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
121 regdis.h
: regs.dat regs.pl
122 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
123 regvals.c
: regs.dat regs.pl
124 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
125 regs.h
: regs.dat regs.pl
126 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
128 # Assembler token hash
129 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
130 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat
&
131 $(srcdir)/tokens.dat
> tokhash.c
133 # Assembler token metadata
134 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
135 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat
&
136 $(srcdir)/tokens.dat
> tokens.h
138 # Preprocessor token hash
139 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
140 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
141 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
142 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
144 # This target generates all files that require perl.
145 # This allows easier generation of distribution (see dist target).
146 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c
&
147 regs.c regs.h regflags.c regdis.c regdis.h regvals.c
&
148 tokhash.c tokens.h pptok.h pptok.c
&
149 version.h version.mac
156 -del
/f output\
*.
$(O
)
161 rem cd rdoff
&& $(MAKE
) clean
163 distclean: clean .SYMBOLIC
166 -del
/f config.status
178 -del
/f
/s autom4te
*.cache
179 rem cd rdoff
&& $(MAKE
) distclean
181 cleaner
: clean .SYMBOLIC
185 rem cd doc
&& $(MAKE
) clean
187 spotless
: distclean cleaner .SYMBOLIC
196 # cd rdoff && $(MAKE)
199 # cd doc && $(MAKE) all
201 everything
: all doc rdf
203 #-- Magic hints to mkdep.pl --#
204 # @object-ending: ".$(O)"
205 # @path-separator: "\"
206 # @exclude: "config.h"
208 #-- Everything below is generated by mkdep.pl - do not edit --#
209 assemble.
$(O
): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h
&
210 nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h version.h
211 crc64.
$(O
): crc64.c compiler.h
212 disasm.
$(O
): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h
&
213 regdis.h regs.h sync.h tables.h tokens.h version.h
214 eval.
$(O
): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h
&
215 nasmlib.h regs.h version.h
216 exprlib.
$(O
): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h
&
218 float.
$(O
): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h
&
220 hashtbl.
$(O
): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h
&
222 insnsa.
$(O
): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
224 insnsb.
$(O
): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
226 insnsd.
$(O
): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
228 insnsn.
$(O
): insnsn.c compiler.h insnsi.h tables.h
229 labels.
$(O
): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h
&
231 lib\snprintf.
$(O
): lib\snprintf.c compiler.h nasmlib.h
232 lib
\vsnprintf.
$(O
): lib
\vsnprintf.c compiler.h nasmlib.h
233 listing.
$(O
): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h
&
235 macros.
$(O
): macros.c compiler.h insnsi.h tables.h
236 nasm.
$(O
): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h
&
237 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h
&
238 regs.h stdscan.h tokens.h version.h
239 nasmlib.
$(O
): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
241 ndisasm.
$(O
): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h
&
242 nasmlib.h regs.h sync.h tokens.h version.h
243 outform.
$(O
): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h
&
245 output\outaout.
$(O
): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h
&
246 outform.h regs.h stdscan.h version.h
247 output\outas86.
$(O
): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h
&
248 outform.h regs.h version.h
249 output\outbin.
$(O
): output\outbin.c compiler.h eval.h insnsi.h labels.h
&
250 nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
251 output\outcoff.
$(O
): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h
&
252 outform.h regs.h version.h
253 output\outdbg.
$(O
): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h
&
254 outform.h regs.h version.h
255 output\outelf32.
$(O
): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h
&
256 outform.h regs.h stdscan.h version.h wsaa.h
257 output\outelf64.
$(O
): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h
&
258 outform.h regs.h stdscan.h version.h wsaa.h
259 output\outieee.
$(O
): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h
&
260 outform.h regs.h version.h
261 output\outmacho.
$(O
): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h
&
262 outform.h regs.h version.h
263 output\outobj.
$(O
): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h
&
264 outform.h regs.h stdscan.h version.h
265 output\outrdf.
$(O
): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h
&
266 outform.h regs.h version.h
267 output\outrdf2.
$(O
): output\outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h
&
268 outform.h rdoff
\rdoff.h regs.h version.h
269 parser.
$(O
): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h
&
270 parser.h regs.h stdscan.h tables.h tokens.h version.h
271 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
272 preproc.
$(O
): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h
&
273 pptok.h preproc.h regs.h stdscan.h tables.h tokens.h version.h
274 regdis.
$(O
): regdis.c regs.h
275 regflags.
$(O
): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h
&
277 regs.
$(O
): regs.c compiler.h insnsi.h tables.h
278 regvals.
$(O
): regvals.c compiler.h insnsi.h tables.h
279 stdscan.
$(O
): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h
&
280 stdscan.h tokens.h version.h
281 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
282 tokhash.
$(O
): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h
&
283 nasmlib.h regs.h tokens.h version.h