3 # Makefile for building NASM using OpenWatcom
4 # cross-compile on a DOS/Win32/OS2/Linux platform host
9 VPATH
= .
;$(srcdir)/output
;$(srcdir)/lib
10 prefix = C
:\Program Files\NASM
11 exec_prefix = $(prefix)
12 bindir = $(prefix)\bin
13 mandir = $(prefix)\man
17 CFLAGS
= -zq
-6 -ox
-wx
-ze
-fpi
$(DEBUG
)
18 BUILD_CFLAGS
= $(CFLAGS
) $(%TARGET_CFLAGS
)
19 INTERNAL_CFLAGS
= -I
$(srcdir) -I.
-DHAVE_CONFIG_H
20 ALL_CFLAGS
= $(BUILD_CFLAGS
) $(INTERNAL_CFLAGS
)
23 LDFLAGS
= op quiet
$(%TARGET_LFLAGS
) $(LDEBUG
)
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
45 $(CC
) -c
$(ALL_CFLAGS
) -fo
=$^@
$[@
47 #-- Begin File Lists --#
48 # Edit in Makefile.in, not here!
49 NASM
= nasm.
$(O
) nasmlib.
$(O
) ver.
$(O
) &
50 raa.
$(O
) saa.
$(O
) rbtree.
$(O
) &
51 float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) &
53 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) &
54 output
/outform.
$(O
) output
/outlib.
$(O
) output
/nulldbg.
$(O
) &
56 output
/outbin.
$(O
) output
/outaout.
$(O
) output
/outcoff.
$(O
) &
57 output
/outelf.
$(O
) output
/outelf32.
$(O
) output
/outelf64.
$(O
) &
58 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) &
59 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmac32.
$(O
) &
60 output
/outmac64.
$(O
) preproc.
$(O
) quote.
$(O
) pptok.
$(O
) &
61 macros.
$(O
) listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) &
62 strfunc.
$(O
) tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
) &
66 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) &
67 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
68 #-- End File Lists --#
71 @echo Please build
"dos", "win32", "os2" or
"linux386"
74 @set TARGET_CFLAGS
=-bt
=DOS
-I
"$(%WATCOM)/h"
75 @set TARGET_LFLAGS
=sys causeway
79 @set TARGET_CFLAGS
=-bt
=NT
-I
"$(%WATCOM)/h" -I
"$(%WATCOM)/h/nt"
80 @set TARGET_LFLAGS
=sys nt
84 @set TARGET_CFLAGS
=-bt
=NT
-I
"$(%WATCOM)/h" -I
"$(%WATCOM)/h/os2"
85 @set TARGET_LFLAGS
=sys os2v2
89 @set TARGET_CFLAGS
=-bt
=LINUX
-I
"$(%WATCOM)/lh"
90 @set TARGET_LFLAGS
=sys linux
93 all: config.h perlreq nasm
$(X
) ndisasm
$(X
) .SYMBOLIC
94 # cd rdoff && $(MAKE) all
97 $(LD
) $(LDFLAGS
) name nasm
$(X
) file
{$(NASM
)} $(LIBS
)
99 ndisasm
$(X
): $(NDISASM
)
100 $(LD
) $(LDFLAGS
) name ndisasm
$(X
) file
{$(NDISASM
)} $(LIBS
)
102 # These source files are automagically generated from a single
103 # instruction-table file by a Perl script. They're distributed,
104 # though, so it isn't necessary to have Perl just to recompile NASM
105 # from the distribution.
107 insnsb.c
: insns.dat insns.pl
108 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
109 insnsa.c
: insns.dat insns.pl
110 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
111 insnsd.c
: insns.dat insns.pl
112 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
113 insnsi.h
: insns.dat insns.pl
114 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
115 insnsn.c
: insns.dat insns.pl
116 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
118 # These files contains all the standard macros that are derived from
119 # the version number.
120 version.h
: version version.pl
121 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
123 version.mac
: version version.pl
124 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
126 # This source file is generated from the standard macros file
127 # `standard.mac' by another Perl script. Again, it's part of the
128 # standard distribution.
130 macros.c
: macros.pl standard.mac version.mac macros
/*.mac output
/*.mac
133 # These source files are generated from regs.dat by yet another
135 regs.c
: regs.dat regs.pl
136 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
137 regflags.c
: regs.dat regs.pl
138 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
139 regdis.c
: regs.dat regs.pl
140 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
141 regdis.h
: regs.dat regs.pl
142 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
143 regvals.c
: regs.dat regs.pl
144 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
145 regs.h
: regs.dat regs.pl
146 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
148 # Assembler token hash
149 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
150 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat
&
151 $(srcdir)/tokens.dat
> tokhash.c
153 # Assembler token metadata
154 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
155 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat
&
156 $(srcdir)/tokens.dat
> tokens.h
158 # Preprocessor token hash
159 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
160 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
161 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
162 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
163 pptok.ph
: pptok.dat pptok.pl perllib
/phash.ph
164 $(PERL
) $(srcdir)/pptok.pl ph
$(srcdir)/pptok.dat pptok.ph
167 directiv.h
: directiv.dat directiv.pl perllib
/phash.ph
168 $(PERL
) $(srcdir)/directiv.pl h
$(srcdir)/directiv.dat directiv.h
169 directiv.c
: directiv.dat directiv.pl perllib
/phash.ph
170 $(PERL
) $(srcdir)/directiv.pl c
$(srcdir)/directiv.dat directiv.c
172 # This target generates all files that require perl.
173 # This allows easier generation of distribution (see dist target).
174 PERLREQ
= pptok.ph macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c
&
175 regs.c regs.h regflags.c regdis.c regdis.h regvals.c
&
176 tokhash.c tokens.h pptok.h pptok.c
&
177 directiv.c directiv.h
&
178 version.h version.mac
179 perlreq
: $(PERLREQ
) .SYMBOLIC
183 rm -f lib
/*.
$(O
) lib
/*.s lib
/*.i
184 rm -f output
/*.
$(O
) output
/*.s output
/*.i
185 rm -f config.h config.log config.status
186 rm -f nasm
$(X
) ndisasm
$(X
)
187 # cd rdoff && $(MAKE) clean
189 distclean: clean .SYMBOLIC
190 rm -f config.h config.log config.status
191 rm -f Makefile
*~
*.bak
*.lst
*.bin
192 rm -f output
/*~ output
/*.bak
193 rm -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
194 # -del /s autom4te*.cache
195 # cd rdoff && $(MAKE) distclean
197 cleaner
: clean .SYMBOLIC
201 # cd doc && $(MAKE) clean
203 spotless
: distclean cleaner .SYMBOLIC
204 rm -f doc
/Makefile doc
/*~ doc
/*.bak
210 # cd rdoff && $(MAKE)
213 # cd doc && $(MAKE) all
215 everything
: all doc rdf
217 config.h
: Mkfiles
/openwcom.mak
220 @
%append
$@
$#define HAVE_DECL_STRCASECMP 1
221 @
%append
$@
$#define HAVE_DECL_STRICMP 1
222 @
%append
$@
$#define HAVE_DECL_STRLCPY 1
223 @
%append
$@
$#define HAVE_DECL_STRNCASECMP 1
224 @
%append
$@
$#define HAVE_DECL_STRNICMP 1
225 @
%append
$@
$#define HAVE_INTTYPES_H 1
226 @
%append
$@
$#define HAVE_LIMITS_H 1
227 @
%append
$@
$#define HAVE_MEMORY_H 1
228 @
%append
$@
$#define HAVE_SNPRINTF 1
229 @
%append
$@
$#define HAVE_STDBOOL_H 1
230 @
%append
$@
$#define HAVE_STDINT_H 1
231 @
%append
$@
$#define HAVE_STDLIB_H 1
232 @
%append
$@
$#define HAVE_STRCASECMP 1
233 @
%append
$@
$#define HAVE_STRCSPN 1
234 @
%append
$@
$#define HAVE_STRICMP 1
235 @
%append
$@
$#define HAVE_STRINGS_H 1
236 @
%append
$@
$#define HAVE_STRING_H 1
237 @
%append
$@
$#define HAVE_STRLCPY 1
238 @
%append
$@
$#define HAVE_STRNCASECMP 1
239 @
%append
$@
$#define HAVE_STRNICMP 1
240 @
%append
$@
$#define HAVE_STRSPN 1
241 @
%append
$@
$#define HAVE_SYS_STAT_H 1
242 @
%append
$@
$#define HAVE_SYS_TYPES_H 1
243 @
%append
$@
$#define HAVE_UNISTD_H 1
244 @
%append
$@
$#define HAVE_VSNPRINTF 1
245 @
%append
$@
$#define STDC_HEADERS 1
248 # This build dependencies in *ALL* makefiles. Partially for that reason,
249 # it's expected to be invoked manually.
251 alldeps
: perlreq .SYMBOLIC
252 $(PERL
) syncfiles.pl Makefile.in Mkfiles
/openwcom.mak
253 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/openwcom.mak
-- . output lib
255 #-- Magic hints to mkdep.pl --#
256 # @object-ending: ".$(O)"
257 # @path-separator: "/"
260 #-- Everything below is generated by mkdep.pl - do not edit --#
261 assemble.
$(O
): assemble.c assemble.h compiler.h config.h directiv.h insns.h
&
262 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
&
264 crc64.
$(O
): crc64.c compiler.h config.h nasmlib.h
265 directiv.
$(O
): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h
&
266 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
267 disasm.
$(O
): disasm.c compiler.h config.h directiv.h disasm.h insns.h
&
268 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h
&
269 sync.h tables.h tokens.h
270 eval.
$(O
): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h
&
271 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
272 exprlib.
$(O
): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h
&
273 nasmlib.h opflags.h pptok.h preproc.h regs.h
274 float.
$(O
): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h
&
275 nasmlib.h opflags.h pptok.h preproc.h regs.h
276 hashtbl.
$(O
): hashtbl.c compiler.h config.h directiv.h hashtbl.h insnsi.h
&
277 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
278 ilog2.
$(O
): ilog2.c compiler.h config.h nasmlib.h
279 insnsa.
$(O
): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h
&
280 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
281 insnsb.
$(O
): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h
&
282 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
283 insnsd.
$(O
): insnsd.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h
&
284 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
285 insnsn.
$(O
): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
286 labels.
$(O
): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h
&
287 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
288 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
289 lib
/strlcpy.
$(O
): lib
/strlcpy.c compiler.h config.h
290 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
291 listing.
$(O
): listing.c compiler.h config.h directiv.h insnsi.h listing.h
&
292 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
293 macros.
$(O
): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h
&
294 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
&
296 nasm.
$(O
): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h
&
297 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h
&
298 output
/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h
&
300 nasmlib.
$(O
): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h
&
301 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
302 ndisasm.
$(O
): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h
&
303 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h
&
305 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h config.h directiv.h
&
306 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
307 output
/nullout.
$(O
): output
/nullout.c compiler.h config.h directiv.h
&
308 insnsi.h nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h
&
310 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h directiv.h eval.h
&
311 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
312 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
313 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h directiv.h
&
314 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
315 pptok.h preproc.h raa.h regs.h saa.h
316 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h directiv.h eval.h
&
317 insnsi.h labels.h nasm.h nasmlib.h opflags.h output
/outform.h
&
318 output
/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
319 output
/outcoff.
$(O
): output
/outcoff.c compiler.h config.h directiv.h eval.h
&
320 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
321 output
/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
322 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h directiv.h insnsi.h
&
323 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
324 output
/outelf.
$(O
): output
/outelf.c compiler.h config.h directiv.h insnsi.h
&
325 nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h output
/outelf.h
&
326 output
/outform.h pptok.h preproc.h regs.h
327 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h directiv.h
&
328 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h
&
329 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h
&
330 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
331 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h directiv.h
&
332 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h
&
333 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h
&
334 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
335 output
/outform.
$(O
): output
/outform.c compiler.h config.h directiv.h
&
336 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h
&
338 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h directiv.h
&
339 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
340 pptok.h preproc.h regs.h
341 output
/outlib.
$(O
): output
/outlib.c compiler.h config.h directiv.h insnsi.h
&
342 nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
343 output
/outmac32.
$(O
): output
/outmac32.c compiler.h config.h directiv.h
&
344 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
345 pptok.h preproc.h raa.h regs.h saa.h
346 output
/outmac64.
$(O
): output
/outmac64.c compiler.h config.h directiv.h
&
347 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
348 pptok.h preproc.h raa.h regs.h saa.h
349 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h directiv.h eval.h
&
350 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
351 pptok.h preproc.h regs.h stdscan.h
352 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h directiv.h
&
353 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h
&
354 pptok.h preproc.h rdoff
/rdoff.h regs.h saa.h
355 parser.
$(O
): parser.c compiler.h config.h directiv.h eval.h float.h insns.h
&
356 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h
&
357 stdscan.h tables.h tokens.h
358 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h
&
360 preproc.
$(O
): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h
&
361 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h
&
362 stdscan.h tables.h tokens.h
363 quote.
$(O
): quote.c compiler.h config.h nasmlib.h quote.h
364 raa.
$(O
): raa.c compiler.h config.h nasmlib.h raa.h
365 rbtree.
$(O
): rbtree.c compiler.h config.h rbtree.h
366 regdis.
$(O
): regdis.c regdis.h regs.h
367 regflags.
$(O
): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h
&
368 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
369 regs.
$(O
): regs.c compiler.h config.h insnsi.h opflags.h tables.h
370 regvals.
$(O
): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
371 saa.
$(O
): saa.c compiler.h config.h nasmlib.h saa.h
372 stdscan.
$(O
): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h
&
373 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h
&
375 strfunc.
$(O
): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h
&
376 nasmlib.h opflags.h pptok.h preproc.h regs.h
377 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
378 tokhash.
$(O
): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h
&
379 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
380 ver.
$(O
): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h
&
381 opflags.h pptok.h preproc.h regs.h version.h