3 # Makefile for building NASM using OpenWatcom
4 # cross-compile on a DOS/Win32/OS2/Linux platform host
9 VPATH
= $(srcdir)/asm
;$(srcdir)/x86
;asm
;x86
;$(srcdir)/macros
;macros
;$(srcdir)/output
;$(srcdir)/lib
;$(srcdir)/common
;$(srcdir)/stdlib
;$(srcdir)/nasmlib
;$(srcdir)/disasm
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.
-I
$(srcdir)/include -I
$(srcdir)/x86
-Ix86
-I
$(srcdir)/asm
-Iasm
-I
$(srcdir)/disasm
-I
$(srcdir)/output
20 ALL_CFLAGS
= $(BUILD_CFLAGS
) $(INTERNAL_CFLAGS
)
23 LDFLAGS
= op quiet
$(%TARGET_LFLAGS
) $(LDEBUG
)
28 PERLFLAGS
= -I
$(srcdir)/perllib
-I
$(srcdir)
29 RUNPERL
= $(PERL
) $(PERLFLAGS
)
37 # WMAKE errors out if a suffix is declared more than once, including
38 # its own built-in declarations. Thus, we need to explicitly clear the list
39 # first. Also, WMAKE only allows implicit rules that point "to the left"
42 .SUFFIXES
: .man
.1 .
$(O
) .i .c
44 # Needed to find C files anywhere but in the current directory
49 $(CC
) -c
$(ALL_CFLAGS
) -fo
=$^@
$[@
51 #-- Begin File Lists --#
52 # Edit in Makefile.in, not here!
54 NDISASM
= disasm
/ndisasm.
$(O
)
56 LIBOBJ
= stdlib
/snprintf.
$(O
) stdlib
/vsnprintf.
$(O
) stdlib
/strlcpy.
$(O
) &
59 nasmlib
/crc64.
$(O
) nasmlib
/malloc.
$(O
) &
60 nasmlib
/md5c.
$(O
) nasmlib
/string.
$(O
) &
61 nasmlib
/file.
$(O
) nasmlib
/mmap.
$(O
) nasmlib
/ilog2.
$(O
) &
62 nasmlib
/realpath.
$(O
) nasmlib
/path.
$(O
) &
63 nasmlib
/filename.
$(O
) nasmlib
/srcfile.
$(O
) &
64 nasmlib
/zerobuf.
$(O
) nasmlib
/readnum.
$(O
) nasmlib
/bsi.
$(O
) &
65 nasmlib
/rbtree.
$(O
) nasmlib
/hashtbl.
$(O
) &
66 nasmlib
/raa.
$(O
) nasmlib
/saa.
$(O
) &
67 nasmlib
/strlist.
$(O
) &
68 nasmlib
/perfhash.
$(O
) nasmlib
/badenum.
$(O
) &
70 x86
/insnsa.
$(O
) x86
/insnsb.
$(O
) x86
/insnsd.
$(O
) x86
/insnsn.
$(O
) &
71 x86
/regs.
$(O
) x86
/regvals.
$(O
) x86
/regflags.
$(O
) x86
/regdis.
$(O
) &
72 x86
/disp8.
$(O
) x86
/iflag.
$(O
) &
76 asm
/directiv.
$(O
) asm
/directbl.
$(O
) &
78 asm
/assemble.
$(O
) asm
/labels.
$(O
) asm
/parser.
$(O
) &
79 asm
/preproc.
$(O
) asm
/quote.
$(O
) asm
/pptok.
$(O
) &
80 asm
/listing.
$(O
) asm
/eval.
$(O
) asm
/exprlib.
$(O
) asm
/exprdump.
$(O
) &
82 asm
/strfunc.
$(O
) asm
/tokhash.
$(O
) &
84 asm
/preproc-nop.
$(O
) &
89 output
/outform.
$(O
) output
/outlib.
$(O
) output
/legacy.
$(O
) &
91 output
/nulldbg.
$(O
) output
/nullout.
$(O
) &
92 output
/outbin.
$(O
) output
/outaout.
$(O
) output
/outcoff.
$(O
) &
94 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) &
95 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) &
96 output
/codeview.
$(O
) &
98 disasm
/disasm.
$(O
) disasm
/sync.
$(O
)
100 SUBDIRS
= stdlib nasmlib output asm disasm x86 common macros
101 XSUBDIRS
= test doc nsis rdoff
102 DEPDIRS
= .
include config x86 rdoff
$(SUBDIRS
)
103 #-- End File Lists --#
106 @echo Please build
"dos", "win32", "os2" or
"linux386"
109 @set TARGET_CFLAGS
=-bt
=DOS
-I
"$(%WATCOM)/h"
110 @set TARGET_LFLAGS
=sys causeway
114 @set TARGET_CFLAGS
=-bt
=NT
-I
"$(%WATCOM)/h" -I
"$(%WATCOM)/h/nt"
115 @set TARGET_LFLAGS
=sys nt
119 @set TARGET_CFLAGS
=-bt
=OS2
-I
"$(%WATCOM)/h" -I
"$(%WATCOM)/h/os2"
120 @set TARGET_LFLAGS
=sys os2v2
124 @set TARGET_CFLAGS
=-bt
=LINUX
-I
"$(%WATCOM)/lh"
125 @set TARGET_LFLAGS
=sys linux
128 all: perlreq nasm
$(X
) ndisasm
$(X
) .SYMBOLIC
129 # cd rdoff && $(MAKE) all
133 nasm
$(X
): $(NASM
) $(NASMLIB
)
134 $(LD
) $(LDFLAGS
) name nasm
$(X
) libr
{$(NASMLIB
) $(LIBS
)} file
{$(NASM
)}
136 ndisasm
$(X
): $(NDISASM
) $(LIBOBJ
)
137 $(LD
) $(LDFLAGS
) name ndisasm
$(X
) libr
{$(NASMLIB
) $(LIBS
)} file
{$(NDISASM
)}
140 wlib
-q
-b
-n
$@
$(LIBOBJ
)
142 #-- Begin Generated File Rules --#
143 # Edit in Makefile.in, not here!
145 # These source files are automagically generated from data files using
146 # Perl scripts. They're distributed, though, so it isn't necessary to
147 # have Perl just to recompile NASM from the distribution.
149 # Perl-generated source files
150 PERLREQ
= x86
/insnsb.c x86
/insnsa.c x86
/insnsd.c x86
/insnsi.h x86
/insnsn.c
&
151 x86
/regs.c x86
/regs.h x86
/regflags.c x86
/regdis.c x86
/regdis.h
&
152 x86
/regvals.c asm
/tokhash.c asm
/tokens.h asm
/pptok.h asm
/pptok.c
&
153 x86
/iflag.c x86
/iflaggen.h
&
155 asm
/pptok.ph asm
/directbl.c asm
/directiv.h
&
156 version.h version.mac version.mak nsis
/version.nsh
158 INSDEP
= x86
/insns.dat x86
/insns.pl x86
/insns-iflags.ph
160 x86
/iflag.c
: $(INSDEP
)
161 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-fc &
162 $(srcdir)/x86
/insns.dat x86
/iflag.c
163 x86
/iflaggen.h
: $(INSDEP
)
164 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-fh
&
165 $(srcdir)/x86
/insns.dat x86
/iflaggen.h
166 x86
/insnsb.c
: $(INSDEP
)
167 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-b
&
168 $(srcdir)/x86
/insns.dat x86
/insnsb.c
169 x86
/insnsa.c
: $(INSDEP
)
170 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-a
&
171 $(srcdir)/x86
/insns.dat x86
/insnsa.c
172 x86
/insnsd.c
: $(INSDEP
)
173 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-d
&
174 $(srcdir)/x86
/insns.dat x86
/insnsd.c
175 x86
/insnsi.h
: $(INSDEP
)
176 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-i
&
177 $(srcdir)/x86
/insns.dat x86
/insnsi.h
178 x86
/insnsn.c
: $(INSDEP
)
179 $(RUNPERL
) $(srcdir)/x86
/insns.pl
-n
&
180 $(srcdir)/x86
/insns.dat x86
/insnsn.c
182 # These files contains all the standard macros that are derived from
183 # the version number.
184 version.h
: version version.pl
185 $(RUNPERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
186 version.mac
: version version.pl
187 $(RUNPERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
188 version.sed
: version version.pl
189 $(RUNPERL
) $(srcdir)/version.pl sed
< $(srcdir)/version
> version.sed
190 version.mak
: version version.pl
191 $(RUNPERL
) $(srcdir)/version.pl make
< $(srcdir)/version
> version.mak
192 nsis
/version.nsh
: version version.pl
193 $(RUNPERL
) $(srcdir)/version.pl nsis
< $(srcdir)/version
> nsis
/version.nsh
195 # This source file is generated from the standard macros file
196 # `standard.mac' by another Perl script. Again, it's part of the
197 # standard distribution.
198 macros
/macros.c
: macros
/macros.pl asm
/pptok.ph version.mac
&
199 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
200 $(RUNPERL
) $(srcdir)/macros
/macros.pl version.mac
&
201 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
203 # These source files are generated from regs.dat by yet another
205 x86
/regs.c
: x86
/regs.dat x86
/regs.pl
206 $(RUNPERL
) $(srcdir)/x86
/regs.pl c
&
207 $(srcdir)/x86
/regs.dat
> x86
/regs.c
208 x86
/regflags.c
: x86
/regs.dat x86
/regs.pl
209 $(RUNPERL
) $(srcdir)/x86
/regs.pl
fc &
210 $(srcdir)/x86
/regs.dat
> x86
/regflags.c
211 x86
/regdis.c
: x86
/regs.dat x86
/regs.pl
212 $(RUNPERL
) $(srcdir)/x86
/regs.pl dc
&
213 $(srcdir)/x86
/regs.dat
> x86
/regdis.c
214 x86
/regdis.h
: x86
/regs.dat x86
/regs.pl
215 $(RUNPERL
) $(srcdir)/x86
/regs.pl dh
&
216 $(srcdir)/x86
/regs.dat
> x86
/regdis.h
217 x86
/regvals.c
: x86
/regs.dat x86
/regs.pl
218 $(RUNPERL
) $(srcdir)/x86
/regs.pl vc
&
219 $(srcdir)/x86
/regs.dat
> x86
/regvals.c
220 x86
/regs.h
: x86
/regs.dat x86
/regs.pl
221 $(RUNPERL
) $(srcdir)/x86
/regs.pl h
&
222 $(srcdir)/x86
/regs.dat
> x86
/regs.h
224 # Assembler token hash
225 asm
/tokhash.c
: x86
/insns.dat x86
/regs.dat asm
/tokens.dat asm
/tokhash.pl
&
227 $(RUNPERL
) $(srcdir)/asm
/tokhash.pl c
&
228 $(srcdir)/x86
/insns.dat
$(srcdir)/x86
/regs.dat
&
229 $(srcdir)/asm
/tokens.dat
> asm
/tokhash.c
231 # Assembler token metadata
232 asm
/tokens.h
: x86
/insns.dat x86
/regs.dat asm
/tokens.dat asm
/tokhash.pl
&
234 $(RUNPERL
) $(srcdir)/asm
/tokhash.pl h
&
235 $(srcdir)/x86
/insns.dat
$(srcdir)/x86
/regs.dat
&
236 $(srcdir)/asm
/tokens.dat
> asm
/tokens.h
238 # Preprocessor token hash
239 asm
/pptok.h
: asm
/pptok.dat asm
/pptok.pl perllib
/phash.ph
240 $(RUNPERL
) $(srcdir)/asm
/pptok.pl h
&
241 $(srcdir)/asm
/pptok.dat asm
/pptok.h
242 asm
/pptok.c
: asm
/pptok.dat asm
/pptok.pl perllib
/phash.ph
243 $(RUNPERL
) $(srcdir)/asm
/pptok.pl c
&
244 $(srcdir)/asm
/pptok.dat asm
/pptok.c
245 asm
/pptok.ph
: asm
/pptok.dat asm
/pptok.pl perllib
/phash.ph
246 $(RUNPERL
) $(srcdir)/asm
/pptok.pl ph
&
247 $(srcdir)/asm
/pptok.dat asm
/pptok.ph
250 asm
/directiv.h
: asm
/directiv.dat nasmlib
/perfhash.pl perllib
/phash.ph
251 $(RUNPERL
) $(srcdir)/nasmlib
/perfhash.pl h
&
252 $(srcdir)/asm
/directiv.dat asm
/directiv.h
253 asm
/directbl.c
: asm
/directiv.dat nasmlib
/perfhash.pl perllib
/phash.ph
254 $(RUNPERL
) $(srcdir)/nasmlib
/perfhash.pl c
&
255 $(srcdir)/asm
/directiv.dat asm
/directbl.c
257 #-- End Generated File Rules --#
259 perlreq
: $(PERLREQ
) .SYMBOLIC
261 #-- Begin NSIS Rules --#
262 # Edit in Makefile.in, not here!
264 # NSIS is not built except by explicit request, as it only applies to
266 nsis
/arch.nsh
: nsis
/getpearch.pl nasm
$(X
)
267 $(PERL
) $(srcdir)/nsis
/getpearch.pl nasm
$(X
) > nsis
/arch.nsh
269 # Should only be done after "make everything".
270 # The use of redirection here keeps makensis from moving the cwd to the
272 nsis
: nsis
/nasm.nsi nsis
/arch.nsh nsis
/version.nsh
273 $(MAKENSIS
) -Dsrcdir
="$(srcdir)" -Dobjdir
="$(objdir)" - < nsis
/nasm.nsi
275 #-- End NSIS Rules --#
279 rm -f asm
/*.
$(O
) asm
/*.s asm
/*.i
280 rm -f x86
/*.
$(O
) x86
/*.s x86
/*.i
281 rm -f lib
/*.
$(O
) lib
/*.s lib
/*.i
282 rm -f macros
/*.
$(O
) macros
/*.s macros
/*.i
283 rm -f output
/*.
$(O
) output
/*.s output
/*.i
284 rm -f common
/*.
$(O
) common
/*.s common
/*.i
285 rm -f stdlib
/*.
$(O
) stdlib
/*.s stdlib
/*.i
286 rm -f nasmlib
/*.
$(O
) nasmlib
/*.s nasmlib
/*.i
287 rm -f disasm
/*.
$(O
) disasm
/*.s disasm
/*.i
288 rm -f config.h config.log config.status
289 rm -f nasm
$(X
) ndisasm
$(X
) $(NASMLIB
)
290 # cd rdoff && $(MAKE) clean
292 distclean: clean .SYMBOLIC
293 rm -f config.h config.log config.status
294 rm -f Makefile
*~
*.bak
*.lst
*.bin
295 rm -f output
/*~ output
/*.bak
296 rm -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
297 # -del /s autom4te*.cache
298 # cd rdoff && $(MAKE) distclean
300 cleaner
: clean .SYMBOLIC
304 # cd doc && $(MAKE) clean
306 spotless
: distclean cleaner .SYMBOLIC
307 rm -f doc
/Makefile doc
/*~ doc
/*.bak
313 # cd rdoff && $(MAKE)
316 # cd doc && $(MAKE) all
318 everything
: all doc rdf
321 # This build dependencies in *ALL* makefiles. Partially for that reason,
322 # it's expected to be invoked manually.
324 alldeps
: perlreq .SYMBOLIC
325 $(PERL
) syncfiles.pl Makefile.in Mkfiles
/openwcom.mak
326 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/openwcom.mak
-- . output lib
328 #-- Magic hints to mkdep.pl --#
329 # @object-ending: ".$(O)"
330 # @path-separator: "/"
331 # @exclude: "config/config.h"
333 #-- Everything below is generated by mkdep.pl - do not edit --#