Mark Perl scripts executable
[nasm/autotest.git] / Mkfiles / owlinux.mak
blobfbd36e3be3cac67364c1ac5135e956b8b8e80b7f
1 # -*- makefile -*-
3 # Makefile for cross-compiling NASM from Linux
4 # to DOS, Win32 or OS/2 using OpenWatcom.
6 # Please see http://bugzilla.openwatcom.org/show_bug.cgi?id=751
7 # for some caveats in using OpenWatcom as a cross-compiler
8 # from Linux, in particular:
10 # > Second and more importantly, the makefile needs to ensure that the
11 # > proper headers are included. This is normally not a problem when
12 # > building on DOS, Windows, or OS/2, as they share the same C
13 # > library headers. But when cross-compiling from (or to) Linux, it
14 # > is crucial.
15 # >
16 # > This may be accomplished by setting the INCLUDE env var in the
17 # > makefile, or setting OS2_INCLUDE, DOS_INCLUDE, NT_INCLUDE env vars
18 # > *and* making sure that the proper -bt switch is used, or passing a
19 # > switch like -I"$(%WATCOM)/h". The last variant is probably the
20 # > easiest to implement and least likely to break.
23 top_srcdir = .
24 srcdir = .
25 prefix = C:/Program Files/NASM
26 exec_prefix = $(prefix)
27 bindir = $(prefix)/bin
28 mandir = $(prefix)/man
30 CC = wcl386
31 DEBUG =
32 CFLAGS = -6 -ox -wx -ze -fpi $(DEBUG)
33 BUILD_CFLAGS = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes
34 INTERNAL_CFLAGS = -I$(srcdir) -I. \
35 -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
36 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
37 LD = $(CC)
38 LDFLAGS = $(ALL_CFLAGS)
39 LIBS =
40 PERL = perl -I$(srcdir)/perllib
42 STRIP = wstrip
44 # Binary suffixes
45 O = obj
46 X = .exe
48 # WMAKE errors out if a suffix is declared more than once, including
49 # its own built-in declarations. Thus, we need to explicitly clear the list
50 # first. Also, WMAKE only allows implicit rules that point "to the left"
51 # in this list!
52 .SUFFIXES:
53 .SUFFIXES: .man .1 .$(O) .i .c
55 .c.$(O):
56 $(CC) -c $(ALL_CFLAGS) -fo=$@ $<
58 #--- Begin File Lists ---#
59 # Edit in Makefile.in, not here!
60 NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) \
61 float.$(O) insnsa.$(O) insnsb.$(O) \
62 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
63 outform.$(O) output/outbin.$(O) \
64 output/outaout.$(O) output/outcoff.$(O) \
65 output/outelf32.$(O) output/outelf64.$(O) \
66 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
67 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
68 preproc.$(O) quote.$(O) pptok.$(O) macros.$(O) \
69 listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) strfunc.$(O) \
70 tokhash.$(O) regvals.$(O) regflags.$(O)
72 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) \
73 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
74 #--- End File Lists ---#
76 what:
77 @echo 'Please build "dos", "win32" or "os2"'
79 dos:
80 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G'
82 win32:
83 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT'
85 os2:
86 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2'
88 all: nasm$(X) ndisasm$(X)
90 nasm$(X): $(NASM)
91 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
93 ndisasm$(X): $(NDISASM)
94 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
96 # These source files are automagically generated from a single
97 # instruction-table file by a Perl script. They're distributed,
98 # though, so it isn't necessary to have Perl just to recompile NASM
99 # from the distribution.
101 insnsb.c: insns.dat insns.pl
102 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
103 insnsa.c: insns.dat insns.pl
104 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
105 insnsd.c: insns.dat insns.pl
106 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
107 insnsi.h: insns.dat insns.pl
108 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
109 insnsn.c: insns.dat insns.pl
110 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
112 # These files contains all the standard macros that are derived from
113 # the version number.
114 version.h: version version.pl
115 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
117 version.mac: version version.pl
118 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
120 # This source file is generated from the standard macros file
121 # `standard.mac' by another Perl script. Again, it's part of the
122 # standard distribution.
124 macros.c: macros.pl standard.mac version.mac
125 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
127 # These source files are generated from regs.dat by yet another
128 # perl script.
129 regs.c: regs.dat regs.pl
130 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
131 regflags.c: regs.dat regs.pl
132 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
133 regdis.c: regs.dat regs.pl
134 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
135 regdis.h: regs.dat regs.pl
136 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
137 regvals.c: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
139 regs.h: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
142 # Assembler token hash
143 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
144 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
145 $(srcdir)/tokens.dat > tokhash.c
147 # Assembler token metadata
148 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
149 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
150 $(srcdir)/tokens.dat > tokens.h
152 # Preprocessor token hash
153 pptok.h: pptok.dat pptok.pl perllib/phash.ph
154 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
155 pptok.c: pptok.dat pptok.pl perllib/phash.ph
156 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
158 # This target generates all files that require perl.
159 # This allows easier generation of distribution (see dist target).
160 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
161 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
162 tokhash.c tokens.h pptok.h pptok.c \
163 version.h version.mac
164 perlreq: $(PERLREQ)
166 clean:
167 -rm -f *.$(O)
168 -rm -f *.s
169 -rm -f *.i
170 -rm -f output/*.$(O)
171 -rm -f output/*.s
172 -rm -f output/*.i
173 -rm -f nasm$(X)
174 -rm -f ndisasm$(X)
175 # cd rdoff && $(MAKE) clean
177 distclean: clean .SYMBOLIC
178 -rm -f config.h
179 -rm -f config.log
180 -rm -f config.status
181 -rm -f Makefile
182 -rm -f *~
183 -rm -f *.bak
184 -rm -f *.lst
185 -rm -f *.bin
186 -rm -f output/*~
187 -rm -f output/*.bak
188 -rm -f test/*.lst
189 -rm -f test/*.bin
190 -rm -f test/*.$(O)
191 -rm -f test/*.bin
192 -rm -f/s autom4te*.cache
193 # cd rdoff && $(MAKE) distclean
195 cleaner: clean .SYMBOLIC
196 -rm -f $(PERLREQ)
197 -rm -f *.man
198 -rm -f nasm.spec
199 # cd doc && $(MAKE) clean
201 spotless: distclean cleaner .SYMBOLIC
202 -rm -f doc/Makefile
203 -rm -f doc/*~
204 -rm -f doc/*.bak
206 strip:
207 $(STRIP) *.exe
209 rdf:
210 # cd rdoff && $(MAKE)
212 doc:
213 # cd doc && $(MAKE) all
215 everything: all doc rdf
217 #-- Magic hints to mkdep.pl --#
218 # @object-ending: ".$(O)"
219 # @path-separator: "/"
220 # @exclude: "config.h"
221 # @continuation: "\"
222 #-- Everything below is generated by mkdep.pl - do not edit --#
223 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
224 nasmlib.h regs.h tables.h tokens.h version.h
225 crc64.$(O): crc64.c compiler.h nasmlib.h
226 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h \
227 regdis.h regs.h sync.h tables.h tokens.h version.h
228 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
229 nasmlib.h regs.h version.h
230 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
231 version.h
232 float.$(O): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h \
233 version.h
234 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
235 regs.h version.h
236 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
237 tokens.h version.h
238 insnsb.$(O): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
239 tokens.h version.h
240 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
241 tokens.h version.h
242 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
243 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h \
244 version.h
245 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
246 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
247 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
248 regs.h version.h
249 macros.$(O): macros.c compiler.h insnsi.h tables.h
250 nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
251 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
252 raa.h regs.h saa.h stdscan.h tokens.h version.h
253 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
254 tokens.h version.h
255 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
256 nasmlib.h regs.h sync.h tokens.h version.h
257 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
258 regs.h version.h
259 output/outaout.$(O): output/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
260 outform.h raa.h regs.h saa.h stdscan.h version.h
261 output/outas86.$(O): output/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
262 outform.h raa.h regs.h saa.h version.h
263 output/outbin.$(O): output/outbin.c compiler.h eval.h insnsi.h labels.h \
264 nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
265 output/outcoff.$(O): output/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
266 outform.h raa.h regs.h saa.h version.h
267 output/outdbg.$(O): output/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
268 outform.h regs.h version.h
269 output/outelf32.$(O): output/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
270 outform.h raa.h regs.h saa.h stdscan.h version.h
271 output/outelf64.$(O): output/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
272 outform.h raa.h regs.h saa.h stdscan.h version.h
273 output/outieee.$(O): output/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
274 outform.h regs.h version.h
275 output/outmacho.$(O): output/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
276 outform.h raa.h regs.h saa.h version.h
277 output/outobj.$(O): output/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
278 outform.h regs.h stdscan.h version.h
279 output/outrdf.$(O): output/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
280 outform.h regs.h version.h
281 output/outrdf2.$(O): output/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
282 outform.h rdoff/rdoff.h regs.h saa.h version.h
283 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
284 parser.h regs.h stdscan.h tables.h tokens.h version.h
285 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
286 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
287 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
288 quote.$(O): quote.c compiler.h nasmlib.h quote.h
289 raa.$(O): raa.c compiler.h nasmlib.h raa.h
290 regdis.$(O): regdis.c regdis.h regs.h
291 regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
292 tables.h version.h
293 regs.$(O): regs.c compiler.h insnsi.h tables.h
294 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
295 saa.$(O): saa.c compiler.h nasmlib.h saa.h
296 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h quote.h \
297 regs.h stdscan.h tokens.h version.h
298 strfunc.$(O): strfunc.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
299 version.h
300 sync.$(O): sync.c compiler.h nasmlib.h sync.h
301 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
302 nasmlib.h regs.h tokens.h version.h