test: add Makefile target for elfx32
[nasm.git] / Mkfiles / openwcom.mak
blob82ce05ac00ecfcec185fed86f0e0b41cc6ca8690
1 # -*- makefile -*-
3 # Makefile for building NASM using OpenWatcom
4 # cross-compile on a DOS/Win32/OS2 platform host
7 top_srcdir = .
8 srcdir = .
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
15 CC = *wcl386
16 DEBUG =
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)
21 LD = *wlink
22 LDEBUG =
23 LDFLAGS = op quiet $(%TARGET_LFLAGS) $(LDEBUG)
24 LIBS =
25 STRIP = wstrip
27 PERL = perl
28 PERLFLAGS = -I$(srcdir)\perllib -I$(srcdir)
29 RUNPERL = $(PERL) $(PERLFLAGS)
31 MAKENSIS = makensis
33 # Binary suffixes
34 O = obj
35 X = .exe
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"
40 # in this list!
41 .SUFFIXES:
42 .SUFFIXES: .man .1 .$(O) .i .c
44 # Needed to find C files anywhere but in the current directory
45 .c : $(VPATH)
47 .c.$(O):
48 @set INCLUDE=
49 $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
51 #-- Begin File Lists --#
52 # Edit in Makefile.in, not here!
53 NASM = asm\nasm.$(O)
54 NDISASM = disasm\ndisasm.$(O)
56 LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
57 stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) &
59 nasmlib\ver.$(O) &
60 nasmlib\alloc.$(O) nasmlib\asprintf.$(O) nasmlib\errfile.$(O) &
61 nasmlib\crc64.$(O) nasmlib\md5c.$(O) &
62 nasmlib\string.$(O) nasmlib\nctype.$(O) &
63 nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) &
64 nasmlib\realpath.$(O) nasmlib\path.$(O) &
65 nasmlib\filename.$(O) nasmlib\rlimit.$(O) &
66 nasmlib\zerobuf.$(O) nasmlib\readnum.$(O) nasmlib\bsi.$(O) &
67 nasmlib\rbtree.$(O) nasmlib\hashtbl.$(O) &
68 nasmlib\raa.$(O) nasmlib\saa.$(O) &
69 nasmlib\strlist.$(O) &
70 nasmlib\perfhash.$(O) nasmlib\badenum.$(O) &
72 common\common.$(O) &
74 x86\insnsa.$(O) x86\insnsb.$(O) x86\insnsd.$(O) x86\insnsn.$(O) &
75 x86\regs.$(O) x86\regvals.$(O) x86\regflags.$(O) x86\regdis.$(O) &
76 x86\disp8.$(O) x86\iflag.$(O) &
78 asm\error.$(O) asm\warnings.$(O) &
79 asm\floats.$(O) &
80 asm\directiv.$(O) asm\directbl.$(O) &
81 asm\pragma.$(O) &
82 asm\assemble.$(O) asm\labels.$(O) asm\parser.$(O) &
83 asm\preproc.$(O) asm\quote.$(O) asm\pptok.$(O) &
84 asm\listing.$(O) asm\eval.$(O) asm\exprlib.$(O) asm\exprdump.$(O) &
85 asm\stdscan.$(O) &
86 asm\strfunc.$(O) asm\tokhash.$(O) &
87 asm\segalloc.$(O) &
88 asm\preproc-nop.$(O) &
89 asm\rdstrnum.$(O) &
90 asm\srcfile.$(O) &
91 macros\macros.$(O) &
93 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) &
96 output\outelf.$(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 --#
108 what: .SYMBOLIC
109 @echo Please build "dos", "win32", "os2" or "linux386"
111 dos: .SYMBOLIC
112 @set TARGET_CFLAGS=-bt=DOS -I"$(%WATCOM)\h"
113 @set TARGET_LFLAGS=sys causeway
114 @%make all
116 win32: .SYMBOLIC
117 @set TARGET_CFLAGS=-bt=NT -I"$(%WATCOM)\h" -I"$(%WATCOM)\h\nt"
118 @set TARGET_LFLAGS=sys nt
119 @%make all
121 os2: .SYMBOLIC
122 @set TARGET_CFLAGS=-bt=OS2 -I"$(%WATCOM)\h" -I"$(%WATCOM)\h\os2"
123 @set TARGET_LFLAGS=sys os2v2
124 @%make all
126 linux386: .SYMBOLIC
127 @set TARGET_CFLAGS=-bt=LINUX -I"$(%WATCOM)\lh"
128 @set TARGET_LFLAGS=sys linux
129 @%make all
131 all: perlreq nasm$(X) ndisasm$(X) .SYMBOLIC
132 # cd rdoff && $(MAKE) all
134 NASMLIB = nasm.lib
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)}
142 nasm.lib: $(LIBOBJ)
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 &
157 macros\macros.c &
158 asm\pptok.ph asm\directbl.c asm\directiv.h &
159 asm\warnings.c include\warnings.h &
160 version.h version.mac version.mak nsis\version.nsh
162 INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph
164 x86\iflag.c: $(INSDEP)
165 $(RUNPERL) $(srcdir)\x86\insns.pl -fc &
166 $(srcdir)\x86\insns.dat x86\iflag.c
167 x86\iflaggen.h: $(INSDEP)
168 $(RUNPERL) $(srcdir)\x86\insns.pl -fh &
169 $(srcdir)\x86\insns.dat x86\iflaggen.h
170 x86\insnsb.c: $(INSDEP)
171 $(RUNPERL) $(srcdir)\x86\insns.pl -b &
172 $(srcdir)\x86\insns.dat x86\insnsb.c
173 x86\insnsa.c: $(INSDEP)
174 $(RUNPERL) $(srcdir)\x86\insns.pl -a &
175 $(srcdir)\x86\insns.dat x86\insnsa.c
176 x86\insnsd.c: $(INSDEP)
177 $(RUNPERL) $(srcdir)\x86\insns.pl -d &
178 $(srcdir)\x86\insns.dat x86\insnsd.c
179 x86\insnsi.h: $(INSDEP)
180 $(RUNPERL) $(srcdir)\x86\insns.pl -i &
181 $(srcdir)\x86\insns.dat x86\insnsi.h
182 x86\insnsn.c: $(INSDEP)
183 $(RUNPERL) $(srcdir)\x86\insns.pl -n &
184 $(srcdir)\x86\insns.dat x86\insnsn.c
186 # These files contains all the standard macros that are derived from
187 # the version number.
188 version.h: version version.pl
189 $(RUNPERL) $(srcdir)\version.pl h < $(srcdir)\version > version.h
190 version.mac: version version.pl
191 $(RUNPERL) $(srcdir)\version.pl mac < $(srcdir)\version > version.mac
192 version.sed: version version.pl
193 $(RUNPERL) $(srcdir)\version.pl sed < $(srcdir)\version > version.sed
194 version.mak: version version.pl
195 $(RUNPERL) $(srcdir)\version.pl make < $(srcdir)\version > version.mak
196 nsis\version.nsh: version version.pl
197 $(RUNPERL) $(srcdir)\version.pl nsis < $(srcdir)\version > nsis\version.nsh
199 # This source file is generated from the standard macros file
200 # `standard.mac' by another Perl script. Again, it's part of the
201 # standard distribution.
202 macros\macros.c: macros\macros.pl asm\pptok.ph version.mac &
203 $(srcdir)\macros\*.mac $(srcdir)\output\*.mac
204 $(RUNPERL) $(srcdir)\macros\macros.pl version.mac &
205 $(srcdir)\macros\*.mac $(srcdir)\output\*.mac
207 # These source files are generated from regs.dat by yet another
208 # perl script.
209 x86\regs.c: x86\regs.dat x86\regs.pl
210 $(RUNPERL) $(srcdir)\x86\regs.pl c &
211 $(srcdir)\x86\regs.dat > x86\regs.c
212 x86\regflags.c: x86\regs.dat x86\regs.pl
213 $(RUNPERL) $(srcdir)\x86\regs.pl fc &
214 $(srcdir)\x86\regs.dat > x86\regflags.c
215 x86\regdis.c: x86\regs.dat x86\regs.pl
216 $(RUNPERL) $(srcdir)\x86\regs.pl dc &
217 $(srcdir)\x86\regs.dat > x86\regdis.c
218 x86\regdis.h: x86\regs.dat x86\regs.pl
219 $(RUNPERL) $(srcdir)\x86\regs.pl dh &
220 $(srcdir)\x86\regs.dat > x86\regdis.h
221 x86\regvals.c: x86\regs.dat x86\regs.pl
222 $(RUNPERL) $(srcdir)\x86\regs.pl vc &
223 $(srcdir)\x86\regs.dat > x86\regvals.c
224 x86\regs.h: x86\regs.dat x86\regs.pl
225 $(RUNPERL) $(srcdir)\x86\regs.pl h &
226 $(srcdir)\x86\regs.dat > x86\regs.h
228 # Extract warnings from source code. Since this depends on
229 # ALL the source files, this is only done on demand.
230 WARNFILES = asm\warnings.c include\warnings.h doc\warnings.src
232 warnings:
233 $(RM_F) $(WARNFILES)
234 $(MAKE) $(WARNFILES)
236 asm\warnings.c: asm\warnings.pl
237 $(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings.c $(srcdir)
239 include\warnings.h: asm\warnings.pl
240 $(RUNPERL) $(srcdir)\asm\warnings.pl h include\warnings.h $(srcdir)
242 doc\warnings.src: asm\warnings.pl
243 $(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src $(srcdir)
245 # Assembler token hash
246 asm\tokhash.c: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl &
247 perllib\phash.ph
248 $(RUNPERL) $(srcdir)\asm\tokhash.pl c &
249 $(srcdir)\x86\insns.dat $(srcdir)\x86\regs.dat &
250 $(srcdir)\asm\tokens.dat > asm\tokhash.c
252 # Assembler token metadata
253 asm\tokens.h: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl &
254 perllib\phash.ph
255 $(RUNPERL) $(srcdir)\asm\tokhash.pl h &
256 $(srcdir)\x86\insns.dat $(srcdir)\x86\regs.dat &
257 $(srcdir)\asm\tokens.dat > asm\tokens.h
259 # Preprocessor token hash
260 asm\pptok.h: asm\pptok.dat asm\pptok.pl perllib\phash.ph
261 $(RUNPERL) $(srcdir)\asm\pptok.pl h &
262 $(srcdir)\asm\pptok.dat asm\pptok.h
263 asm\pptok.c: asm\pptok.dat asm\pptok.pl perllib\phash.ph
264 $(RUNPERL) $(srcdir)\asm\pptok.pl c &
265 $(srcdir)\asm\pptok.dat asm\pptok.c
266 asm\pptok.ph: asm\pptok.dat asm\pptok.pl perllib\phash.ph
267 $(RUNPERL) $(srcdir)\asm\pptok.pl ph &
268 $(srcdir)\asm\pptok.dat asm\pptok.ph
270 # Directives hash
271 asm\directiv.h: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
272 $(RUNPERL) $(srcdir)\nasmlib\perfhash.pl h &
273 $(srcdir)\asm\directiv.dat asm\directiv.h
274 asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
275 $(RUNPERL) $(srcdir)\nasmlib\perfhash.pl c &
276 $(srcdir)\asm\directiv.dat asm\directbl.c
278 #-- End Generated File Rules --#
280 perlreq: $(PERLREQ) .SYMBOLIC
282 #-- Begin NSIS Rules --#
283 # Edit in Makefile.in, not here!
285 nsis\arch.nsh: nsis\getpearch.pl nasm$(X)
286 $(PERL) $(srcdir)\nsis\getpearch.pl nasm$(X) > nsis\arch.nsh
288 # Should only be done after "make everything".
289 # The use of redirection here keeps makensis from moving the cwd to the
290 # source directory.
291 nsis: nsis\nasm.nsi nsis\arch.nsh nsis\version.nsh
292 $(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < nsis\nasm.nsi
294 #-- End NSIS Rules --#
296 clean: .SYMBOLIC
297 rm -f *.$(O) *.s *.i
298 rm -f asm\*.$(O) asm\*.s asm\*.i
299 rm -f x86\*.$(O) x86\*.s x86\*.i
300 rm -f lib\*.$(O) lib\*.s lib\*.i
301 rm -f macros\*.$(O) macros\*.s macros\*.i
302 rm -f output\*.$(O) output\*.s output\*.i
303 rm -f common\*.$(O) common\*.s common\*.i
304 rm -f stdlib\*.$(O) stdlib\*.s stdlib\*.i
305 rm -f nasmlib\*.$(O) nasmlib\*.s nasmlib\*.i
306 rm -f disasm\*.$(O) disasm\*.s disasm\*.i
307 rm -f config.h config.log config.status
308 rm -f nasm$(X) ndisasm$(X) $(NASMLIB)
309 # cd rdoff && $(MAKE) clean
311 distclean: clean .SYMBOLIC
312 rm -f config.h config.log config.status
313 rm -f Makefile *~ *.bak *.lst *.bin
314 rm -f output\*~ output\*.bak
315 rm -f test\*.lst test\*.bin test\*.$(O) test\*.bin
316 # -del \s autom4te*.cache
317 # cd rdoff && $(MAKE) distclean
319 cleaner: clean .SYMBOLIC
320 rm -f $(PERLREQ)
321 rm -f *.man
322 rm -f nasm.spec
323 # cd doc && $(MAKE) clean
325 spotless: distclean cleaner .SYMBOLIC
326 rm -f doc\Makefile doc\*~ doc\*.bak
328 strip: .SYMBOLIC
329 $(STRIP) *.exe
331 rdf:
332 # cd rdoff && $(MAKE)
334 doc:
335 # cd doc && $(MAKE) all
337 everything: all doc rdf
340 # This build dependencies in *ALL* makefiles. Partially for that reason,
341 # it's expected to be invoked manually.
343 alldeps: perlreq .SYMBOLIC
344 $(PERL) syncfiles.pl Makefile.in Mkfiles\openwcom.mak
345 $(PERL) mkdep.pl -M Makefile.in Mkfiles\openwcom.mak -- . output lib
347 #-- Magic hints to mkdep.pl --#
348 # @object-ending: ".$(O)"
349 # @path-separator: "\"
350 # @exclude: "config/config.h"
351 # @continuation: "&"
352 #-- Everything below is generated by mkdep.pl - do not edit --#