3 # Makefile for building NASM using OpenWatcom
4 # cross-compile on a DOS/Win32/OS2 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
) &
57 stdlib\strnlen.
$(O
) stdlib\strrchrnul.
$(O
) &
60 nasmlib\crc64.
$(O
) nasmlib\malloc.
$(O
) &
61 nasmlib\md5c.
$(O
) nasmlib\string.
$(O
) &
62 nasmlib
\file.
$(O
) nasmlib\mmap.
$(O
) nasmlib\ilog2.
$(O
) &
63 nasmlib
\realpath.
$(O
) nasmlib\path.
$(O
) &
64 nasmlib
\filename.
$(O
) nasmlib\srcfile.
$(O
) &
65 nasmlib\zerobuf.
$(O
) nasmlib
\readnum.
$(O
) nasmlib
\bsi.
$(O
) &
66 nasmlib
\rbtree.
$(O
) nasmlib\hashtbl.
$(O
) &
67 nasmlib
\raa.
$(O
) nasmlib\saa.
$(O
) &
68 nasmlib\strlist.
$(O
) &
69 nasmlib\perfhash.
$(O
) nasmlib
\badenum.
$(O
) &
73 x86\insnsa.
$(O
) x86\insnsb.
$(O
) x86\insnsd.
$(O
) x86\insnsn.
$(O
) &
74 x86
\regs.
$(O
) x86
\regvals.
$(O
) x86
\regflags.
$(O
) x86
\regdis.
$(O
) &
75 x86\disp8.
$(O
) x86\iflag.
$(O
) &
79 asm\directiv.
$(O
) asm\directbl.
$(O
) &
81 asm
\assemble.
$(O
) asm\labels.
$(O
) asm\parser.
$(O
) &
82 asm\preproc.
$(O
) asm\quote.
$(O
) asm\pptok.
$(O
) &
83 asm\listing.
$(O
) asm\eval.
$(O
) asm\exprlib.
$(O
) asm\exprdump.
$(O
) &
85 asm\strfunc.
$(O
) asm
\tokhash.
$(O
) &
87 asm\preproc-nop.
$(O
) &
92 output\outform.
$(O
) output\outlib.
$(O
) output\legacy.
$(O
) &
94 output
\nulldbg.
$(O
) output
\nullout.
$(O
) &
95 output\outbin.
$(O
) output\outaout.
$(O
) output\outcoff.
$(O
) &
97 output\outobj.
$(O
) output\outas86.
$(O
) output\outrdf2.
$(O
) &
98 output\outdbg.
$(O
) output\outieee.
$(O
) output\outmacho.
$(O
) &
99 output\codeview.
$(O
) &
101 disasm\disasm.
$(O
) disasm\sync.
$(O
)
103 SUBDIRS
= stdlib nasmlib output asm disasm x86 common macros
104 XSUBDIRS
= test doc nsis rdoff
105 DEPDIRS
= .
include config x86 rdoff
$(SUBDIRS
)
106 #-- End File Lists --#
109 @echo Please build
"dos", "win32", "os2" or
"linux386"
112 @set TARGET_CFLAGS
=-bt
=DOS
-I
"$(%WATCOM)\h"
113 @set TARGET_LFLAGS
=sys causeway
117 @set TARGET_CFLAGS
=-bt
=NT
-I
"$(%WATCOM)\h" -I
"$(%WATCOM)\h\nt"
118 @set TARGET_LFLAGS
=sys nt
122 @set TARGET_CFLAGS
=-bt
=OS2
-I
"$(%WATCOM)\h" -I
"$(%WATCOM)\h\os2"
123 @set TARGET_LFLAGS
=sys os2v2
127 @set TARGET_CFLAGS
=-bt
=LINUX
-I
"$(%WATCOM)\lh"
128 @set TARGET_LFLAGS
=sys linux
131 all: perlreq nasm
$(X
) ndisasm
$(X
) .SYMBOLIC
132 # cd rdoff && $(MAKE) all
136 nasm
$(X
): $(NASM
) $(NASMLIB
)
137 $(LD
) $(LDFLAGS
) name nasm
$(X
) libr
{$(NASMLIB
) $(LIBS
)} file
{$(NASM
)}
139 ndisasm
$(X
): $(NDISASM
) $(LIBOBJ
)
140 $(LD
) $(LDFLAGS
) name ndisasm
$(X
) libr
{$(NASMLIB
) $(LIBS
)} file
{$(NDISASM
)}
143 wlib
-q
-b
-n
$@
$(LIBOBJ
)
145 #-- Begin Generated File Rules --#
146 # Edit in Makefile.in, not here!
148 # These source files are automagically generated from data files using
149 # Perl scripts. They're distributed, though, so it isn't necessary to
150 # have Perl just to recompile NASM from the distribution.
152 # Perl-generated source files
153 PERLREQ
= x86\insnsb.c x86\insnsa.c x86\insnsd.c x86\insnsi.h x86\insnsn.c
&
154 x86
\regs.c x86
\regs.h x86
\regflags.c x86
\regdis.c x86
\regdis.h
&
155 x86
\regvals.c asm
\tokhash.c asm
\tokens.h asm\pptok.h asm\pptok.c
&
156 x86\iflag.c x86\iflaggen.h
&
158 asm\pptok.ph asm\directbl.c asm\directiv.h
&
159 version.h version.mac version.mak nsis
\version.nsh
161 INSDEP
= x86\insns.dat x86\insns.pl x86\insns-iflags.ph
163 x86\iflag.c
: $(INSDEP
)
164 $(RUNPERL
) $(srcdir)\x86\insns.pl
-fc &
165 $(srcdir)\x86\insns.dat x86\iflag.c
166 x86\iflaggen.h
: $(INSDEP
)
167 $(RUNPERL
) $(srcdir)\x86\insns.pl
-fh
&
168 $(srcdir)\x86\insns.dat x86\iflaggen.h
169 x86\insnsb.c
: $(INSDEP
)
170 $(RUNPERL
) $(srcdir)\x86\insns.pl
-b
&
171 $(srcdir)\x86\insns.dat x86\insnsb.c
172 x86\insnsa.c
: $(INSDEP
)
173 $(RUNPERL
) $(srcdir)\x86\insns.pl
-a
&
174 $(srcdir)\x86\insns.dat x86\insnsa.c
175 x86\insnsd.c
: $(INSDEP
)
176 $(RUNPERL
) $(srcdir)\x86\insns.pl
-d
&
177 $(srcdir)\x86\insns.dat x86\insnsd.c
178 x86\insnsi.h
: $(INSDEP
)
179 $(RUNPERL
) $(srcdir)\x86\insns.pl
-i
&
180 $(srcdir)\x86\insns.dat x86\insnsi.h
181 x86\insnsn.c
: $(INSDEP
)
182 $(RUNPERL
) $(srcdir)\x86\insns.pl
-n
&
183 $(srcdir)\x86\insns.dat x86\insnsn.c
185 # These files contains all the standard macros that are derived from
186 # the version number.
187 version.h
: version version.pl
188 $(RUNPERL
) $(srcdir)\version.pl h
< $(srcdir)\version
> version.h
189 version.mac
: version version.pl
190 $(RUNPERL
) $(srcdir)\version.pl mac
< $(srcdir)\version
> version.mac
191 version.sed
: version version.pl
192 $(RUNPERL
) $(srcdir)\version.pl sed
< $(srcdir)\version
> version.sed
193 version.mak
: version version.pl
194 $(RUNPERL
) $(srcdir)\version.pl make
< $(srcdir)\version
> version.mak
195 nsis
\version.nsh
: version version.pl
196 $(RUNPERL
) $(srcdir)\version.pl nsis
< $(srcdir)\version
> nsis
\version.nsh
198 # This source file is generated from the standard macros file
199 # `standard.mac' by another Perl script. Again, it's part of the
200 # standard distribution.
201 macros\macros.c
: macros\macros.pl asm\pptok.ph version.mac
&
202 $(srcdir)\macros\
*.mac
$(srcdir)\output\
*.mac
203 $(RUNPERL
) $(srcdir)\macros\macros.pl version.mac
&
204 $(srcdir)\macros\
*.mac
$(srcdir)\output\
*.mac
206 # These source files are generated from regs.dat by yet another
208 x86
\regs.c
: x86
\regs.dat x86
\regs.pl
209 $(RUNPERL
) $(srcdir)\x86\regs.pl c
&
210 $(srcdir)\x86\regs.dat
> x86
\regs.c
211 x86
\regflags.c
: x86
\regs.dat x86
\regs.pl
212 $(RUNPERL
) $(srcdir)\x86\regs.pl
fc &
213 $(srcdir)\x86\regs.dat
> x86
\regflags.c
214 x86
\regdis.c
: x86
\regs.dat x86
\regs.pl
215 $(RUNPERL
) $(srcdir)\x86\regs.pl dc
&
216 $(srcdir)\x86\regs.dat
> x86
\regdis.c
217 x86
\regdis.h
: x86
\regs.dat x86
\regs.pl
218 $(RUNPERL
) $(srcdir)\x86\regs.pl dh
&
219 $(srcdir)\x86\regs.dat
> x86
\regdis.h
220 x86
\regvals.c
: x86
\regs.dat x86
\regs.pl
221 $(RUNPERL
) $(srcdir)\x86\regs.pl vc
&
222 $(srcdir)\x86\regs.dat
> x86
\regvals.c
223 x86
\regs.h
: x86
\regs.dat x86
\regs.pl
224 $(RUNPERL
) $(srcdir)\x86\regs.pl h
&
225 $(srcdir)\x86\regs.dat
> x86
\regs.h
227 # Assembler token hash
228 asm
\tokhash.c
: x86\insns.dat x86
\regs.dat asm
\tokens.dat asm
\tokhash.pl
&
230 $(RUNPERL
) $(srcdir)\asm
\tokhash.pl c
&
231 $(srcdir)\x86\insns.dat
$(srcdir)\x86\regs.dat
&
232 $(srcdir)\asm
\tokens.dat
> asm
\tokhash.c
234 # Assembler token metadata
235 asm
\tokens.h
: x86\insns.dat x86
\regs.dat asm
\tokens.dat asm
\tokhash.pl
&
237 $(RUNPERL
) $(srcdir)\asm
\tokhash.pl h
&
238 $(srcdir)\x86\insns.dat
$(srcdir)\x86\regs.dat
&
239 $(srcdir)\asm
\tokens.dat
> asm
\tokens.h
241 # Preprocessor token hash
242 asm\pptok.h
: asm\pptok.dat asm\pptok.pl perllib\phash.ph
243 $(RUNPERL
) $(srcdir)\asm\pptok.pl h
&
244 $(srcdir)\asm\pptok.dat asm\pptok.h
245 asm\pptok.c
: asm\pptok.dat asm\pptok.pl perllib\phash.ph
246 $(RUNPERL
) $(srcdir)\asm\pptok.pl c
&
247 $(srcdir)\asm\pptok.dat asm\pptok.c
248 asm\pptok.ph
: asm\pptok.dat asm\pptok.pl perllib\phash.ph
249 $(RUNPERL
) $(srcdir)\asm\pptok.pl ph
&
250 $(srcdir)\asm\pptok.dat asm\pptok.ph
253 asm\directiv.h
: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
254 $(RUNPERL
) $(srcdir)\nasmlib\perfhash.pl h
&
255 $(srcdir)\asm\directiv.dat asm\directiv.h
256 asm\directbl.c
: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
257 $(RUNPERL
) $(srcdir)\nasmlib\perfhash.pl c
&
258 $(srcdir)\asm\directiv.dat asm\directbl.c
260 #-- End Generated File Rules --#
262 perlreq
: $(PERLREQ
) .SYMBOLIC
264 #-- Begin NSIS Rules --#
265 # Edit in Makefile.in, not here!
267 # NSIS is not built except by explicit request, as it only applies to
269 nsis
\arch.nsh
: nsis\getpearch.pl nasm
$(X
)
270 $(PERL
) $(srcdir)\nsis\getpearch.pl nasm
$(X
) > nsis
\arch.nsh
272 # Should only be done after "make everything".
273 # The use of redirection here keeps makensis from moving the cwd to the
275 nsis
: nsis
\nasm.nsi nsis
\arch.nsh nsis
\version.nsh
276 $(MAKENSIS
) -Dsrcdir
="$(srcdir)" -Dobjdir
="$(objdir)" - < nsis
\nasm.nsi
278 #-- End NSIS Rules --#
282 rm -f asm\
*.
$(O
) asm\
*.s asm\
*.i
283 rm -f x86\
*.
$(O
) x86\
*.s x86\
*.i
284 rm -f lib\
*.
$(O
) lib\
*.s lib\
*.i
285 rm -f macros\
*.
$(O
) macros\
*.s macros\
*.i
286 rm -f output\
*.
$(O
) output\
*.s output\
*.i
287 rm -f common\
*.
$(O
) common\
*.s common\
*.i
288 rm -f stdlib\
*.
$(O
) stdlib\
*.s stdlib\
*.i
289 rm -f nasmlib\
*.
$(O
) nasmlib\
*.s nasmlib\
*.i
290 rm -f disasm\
*.
$(O
) disasm\
*.s disasm\
*.i
291 rm -f config.h config.log config.status
292 rm -f nasm
$(X
) ndisasm
$(X
) $(NASMLIB
)
293 # cd rdoff && $(MAKE) clean
295 distclean: clean .SYMBOLIC
296 rm -f config.h config.log config.status
297 rm -f Makefile
*~
*.bak
*.lst
*.bin
298 rm -f output\
*~ output\
*.bak
299 rm -f
test\
*.lst
test\
*.bin
test\
*.
$(O
) test\
*.bin
300 # -del \s autom4te*.cache
301 # cd rdoff && $(MAKE) distclean
303 cleaner
: clean .SYMBOLIC
307 # cd doc && $(MAKE) clean
309 spotless
: distclean cleaner .SYMBOLIC
310 rm -f doc\Makefile doc\
*~ doc\
*.bak
316 # cd rdoff && $(MAKE)
319 # cd doc && $(MAKE) all
321 everything
: all doc rdf
324 # This build dependencies in *ALL* makefiles. Partially for that reason,
325 # it's expected to be invoked manually.
327 alldeps
: perlreq .SYMBOLIC
328 $(PERL
) syncfiles.pl Makefile.in Mkfiles\openwcom.mak
329 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles\openwcom.mak
-- . output lib
331 #-- Magic hints to mkdep.pl --#
332 # @object-ending: ".$(O)"
333 # @path-separator: "\"
334 # @exclude: "config/config.h"
336 #-- Everything below is generated by mkdep.pl - do not edit --#