Elf: Allow symbols binding to undefined section
[nasm.git] / Mkfiles / owlinux.mak
blob1e089588c420ed4871437483003422fc4e44ae18
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) ver.$(O) \
61 raa.$(O) saa.$(O) rbtree.$(O) \
62 float.$(O) insnsa.$(O) insnsb.$(O) \
63 directives.$(O) \
64 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
65 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
66 output/nullout.$(O) \
67 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
68 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
69 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
70 output/outdbg.$(O) output/outieee.$(O) output/outmacho32.$(O) \
71 output/outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
72 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
73 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
74 lib/strlcpy.$(O)
76 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
77 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
78 #-- End File Lists --#
80 what:
81 @echo 'Please build "dos", "win32" or "os2"'
83 dos:
84 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=DOS -l=DOS4G'
86 win32:
87 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=NT -l=NT'
89 os2:
90 $(MAKE) -f $(MAKEFILE_LIST) all TARGET_FLAGS='-bt=OS2 -l=OS2V2'
92 all: nasm$(X) ndisasm$(X)
94 nasm$(X): $(NASM)
95 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
97 ndisasm$(X): $(NDISASM)
98 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
100 # These source files are automagically generated from a single
101 # instruction-table file by a Perl script. They're distributed,
102 # though, so it isn't necessary to have Perl just to recompile NASM
103 # from the distribution.
105 insnsb.c: insns.dat insns.pl
106 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
107 insnsa.c: insns.dat insns.pl
108 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
109 insnsd.c: insns.dat insns.pl
110 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
111 insnsi.h: insns.dat insns.pl
112 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
113 insnsn.c: insns.dat insns.pl
114 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
116 # These files contains all the standard macros that are derived from
117 # the version number.
118 version.h: version version.pl
119 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
121 version.mac: version version.pl
122 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
124 # This source file is generated from the standard macros file
125 # `standard.mac' by another Perl script. Again, it's part of the
126 # standard distribution.
128 macros.c: macros.pl standard.mac version.mac
129 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
131 # These source files are generated from regs.dat by yet another
132 # perl script.
133 regs.c: regs.dat regs.pl
134 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
135 regflags.c: regs.dat regs.pl
136 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
137 regdis.c: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
139 regdis.h: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
141 regvals.c: regs.dat regs.pl
142 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
143 regs.h: regs.dat regs.pl
144 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
146 # Assembler token hash
147 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
148 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
149 $(srcdir)/tokens.dat > tokhash.c
151 # Assembler token metadata
152 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
153 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
154 $(srcdir)/tokens.dat > tokens.h
156 # Preprocessor token hash
157 pptok.h: pptok.dat pptok.pl perllib/phash.ph
158 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
159 pptok.c: pptok.dat pptok.pl perllib/phash.ph
160 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
162 # This target generates all files that require perl.
163 # This allows easier generation of distribution (see dist target).
164 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
165 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
166 tokhash.c tokens.h pptok.h pptok.c \
167 version.h version.mac
168 perlreq: $(PERLREQ)
170 clean:
171 -rm -f *.$(O)
172 -rm -f *.s
173 -rm -f *.i
174 -rm -f output/*.$(O)
175 -rm -f output/*.s
176 -rm -f output/*.i
177 -rm -f nasm$(X)
178 -rm -f ndisasm$(X)
179 # cd rdoff && $(MAKE) clean
181 distclean: clean .SYMBOLIC
182 -rm -f config.h
183 -rm -f config.log
184 -rm -f config.status
185 -rm -f Makefile
186 -rm -f *~
187 -rm -f *.bak
188 -rm -f *.lst
189 -rm -f *.bin
190 -rm -f output/*~
191 -rm -f output/*.bak
192 -rm -f test/*.lst
193 -rm -f test/*.bin
194 -rm -f test/*.$(O)
195 -rm -f test/*.bin
196 -rm -f/s autom4te*.cache
197 # cd rdoff && $(MAKE) distclean
199 cleaner: clean .SYMBOLIC
200 -rm -f $(PERLREQ)
201 -rm -f *.man
202 -rm -f nasm.spec
203 # cd doc && $(MAKE) clean
205 spotless: distclean cleaner .SYMBOLIC
206 -rm -f doc/Makefile
207 -rm -f doc/*~
208 -rm -f doc/*.bak
210 strip:
211 $(STRIP) *.exe
213 rdf:
214 # cd rdoff && $(MAKE)
216 doc:
217 # cd doc && $(MAKE) all
219 everything: all doc rdf
221 #-- Magic hints to mkdep.pl --#
222 # @object-ending: ".$(O)"
223 # @path-separator: "/"
224 # @exclude: "config.h"
225 # @continuation: "\"
226 #-- Everything below is generated by mkdep.pl - do not edit --#
227 assemble.$(O): assemble.c assemble.h compiler.h directives.h insns.h \
228 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
229 tokens.h
230 crc64.$(O): crc64.c compiler.h nasmlib.h
231 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h \
232 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
233 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
234 nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h sync.h \
235 tables.h tokens.h
236 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h \
237 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
238 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
239 opflags.h pptok.h preproc.h regs.h
240 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h \
241 nasmlib.h opflags.h pptok.h preproc.h regs.h
242 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
243 nasmlib.h opflags.h pptok.h preproc.h regs.h
244 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h \
245 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
246 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h \
247 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
248 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h \
249 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
250 insnsn.$(O): insnsn.c compiler.h insnsi.h opflags.h tables.h
251 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
252 nasmlib.h opflags.h pptok.h preproc.h regs.h
253 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
254 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
255 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
256 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h \
257 nasmlib.h opflags.h pptok.h preproc.h regs.h
258 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
259 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
260 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h \
261 insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h output/outform.h \
262 parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
263 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h \
264 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
265 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
266 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h tokens.h
267 output/nulldbg.$(O): output/nulldbg.c compiler.h directives.h insnsi.h \
268 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
269 output/nullout.$(O): output/nullout.c compiler.h directives.h insnsi.h \
270 nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
271 output/outaout.$(O): output/outaout.c compiler.h directives.h eval.h \
272 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
273 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
274 output/outas86.$(O): output/outas86.c compiler.h directives.h insnsi.h \
275 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
276 preproc.h raa.h regs.h saa.h
277 output/outbin.$(O): output/outbin.c compiler.h directives.h eval.h insnsi.h \
278 labels.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
279 pptok.h preproc.h regs.h saa.h stdscan.h
280 output/outcoff.$(O): output/outcoff.c compiler.h directives.h eval.h \
281 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
282 pptok.h preproc.h raa.h regs.h saa.h
283 output/outdbg.$(O): output/outdbg.c compiler.h directives.h insnsi.h nasm.h \
284 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
285 output/outelf.$(O): output/outelf.c compiler.h directives.h insnsi.h nasm.h \
286 nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
287 output/outform.h pptok.h preproc.h regs.h
288 output/outelf32.$(O): output/outelf32.c compiler.h directives.h eval.h \
289 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
290 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
291 rbtree.h regs.h saa.h stdscan.h
292 output/outelf64.$(O): output/outelf64.c compiler.h directives.h eval.h \
293 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
294 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
295 rbtree.h regs.h saa.h stdscan.h
296 output/outform.$(O): output/outform.c compiler.h directives.h insnsi.h \
297 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
298 output/outieee.$(O): output/outieee.c compiler.h directives.h insnsi.h \
299 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
300 preproc.h regs.h
301 output/outlib.$(O): output/outlib.c compiler.h directives.h insnsi.h nasm.h \
302 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
303 output/outmacho32.$(O): output/outmacho32.c compiler.h directives.h eval.h \
304 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
305 pptok.h preproc.h raa.h regs.h saa.h
306 output/outmacho64.$(O): output/outmacho64.c compiler.h directives.h insnsi.h \
307 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
308 preproc.h raa.h regs.h saa.h
309 output/outobj.$(O): output/outobj.c compiler.h directives.h eval.h insnsi.h \
310 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
311 preproc.h regs.h stdscan.h
312 output/outrdf2.$(O): output/outrdf2.c compiler.h directives.h insnsi.h \
313 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
314 preproc.h rdoff/rdoff.h regs.h saa.h
315 parser.$(O): parser.c compiler.h directives.h eval.h float.h insns.h \
316 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
317 stdscan.h tables.h tokens.h
318 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
319 preproc.$(O): preproc.c compiler.h directives.h eval.h hashtbl.h insnsi.h \
320 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
321 tables.h tokens.h
322 quote.$(O): quote.c compiler.h nasmlib.h quote.h
323 raa.$(O): raa.c compiler.h nasmlib.h raa.h
324 rbtree.$(O): rbtree.c compiler.h rbtree.h
325 regdis.$(O): regdis.c regdis.h regs.h
326 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
327 opflags.h pptok.h preproc.h regs.h tables.h
328 regs.$(O): regs.c compiler.h insnsi.h opflags.h tables.h
329 regvals.$(O): regvals.c compiler.h insnsi.h opflags.h tables.h
330 saa.$(O): saa.c compiler.h nasmlib.h saa.h
331 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h \
332 nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
333 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
334 opflags.h pptok.h preproc.h regs.h
335 sync.$(O): sync.c compiler.h nasmlib.h sync.h
336 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h \
337 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
338 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h opflags.h \
339 pptok.h preproc.h regs.h version.h