Run "make alldeps".
[platform/upstream/nasm.git] / Mkfiles / openwcom.mak
1 # -*- makefile -*-
2 #
3 # Makefile for building NASM using OpenWatcom 1.7
4 # building on a DOS/Win/OS2 platform host (backslashes
5 # used in pathnames)
6 #
7
8 top_srcdir      = .
9 srcdir          = .
10 VPATH           = .\output
11 prefix          = C:\Program Files\NASM
12 exec_prefix     = $(prefix)
13 bindir          = $(prefix)\bin
14 mandir          = $(prefix)\man
15
16 CC              = wcl386
17 CFLAGS          = -3 -bcl=$(TARGET) -ox -wx -ze -fpi
18 BUILD_CFLAGS    = $(CFLAGS) # -I$(srcdir)/inttypes
19 INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
20 ALL_CFLAGS      = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
21 LD              = $(CC)
22 LDFLAGS         = $(ALL_CFLAGS)
23 LIBS            = 
24 PERL            = perl -I$(srcdir)/perllib
25
26 STRIP           = wstrip
27
28 # Binary suffixes
29 O               = obj
30 X               = .exe
31
32 # WMAKE errors out if a suffix is declared more than once, including
33 # its own built-in declarations.  Thus, we need to explicitly clear the list
34 # first.  Also, WMAKE only allows implicit rules that point "to the left"
35 # in this list!
36 .SUFFIXES:
37 .SUFFIXES: .man .1 .$(O) .i .c
38
39 # Needed to find C files anywhere but in the current directory
40 .c : $(VPATH)
41
42 .c.$(O):
43         $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
44
45 # Note: wcl386 is broken if forward slashes are used as path separators.
46 NASM =  nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) assemble.$(O) &
47         labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) &
48         outform.$(O) output\outbin.$(O) &
49         output\outaout.$(O) output\outcoff.$(O) &
50         output\outelf32.$(O) output\outelf64.$(O) &
51         output\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) &
52         output\outdbg.$(O) output\outieee.$(O) output\outmacho.$(O) &
53         preproc.$(O) pptok.$(O) &
54         listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) tokhash.$(O)
55
56 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) insnsd.$(O)
57
58 what:   .SYMBOLIC
59         @echo Please build "dos", "win32" or "os2"
60
61 dos:    .SYMBOLIC
62         $(MAKE) /f $(__MAKEFILES__) all TARGET=DOS4G
63
64 win32:  .SYMBOLIC
65         $(MAKE) /f $(__MAKEFILES__) all TARGET=NT
66
67 os2:    .SYMBOLIC
68         $(MAKE) /f $(__MAKEFILES__) all TARGET=OS2V2
69
70 all: nasm$(X) ndisasm$(X) .SYMBOLIC
71         rem cd rdoff && $(MAKE) all
72
73 nasm$(X): $(NASM)
74         $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
75
76 ndisasm$(X): $(NDISASM)
77         $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
78
79 # These source files are automagically generated from a single
80 # instruction-table file by a Perl script. They're distributed,
81 # though, so it isn't necessary to have Perl just to recompile NASM
82 # from the distribution.
83
84 insnsa.c: insns.dat insns.pl
85         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
86 insnsd.c: insns.dat insns.pl
87         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
88 insnsi.h: insns.dat insns.pl
89         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
90 insnsn.c: insns.dat insns.pl
91         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
92
93 # These files contains all the standard macros that are derived from
94 # the version number.
95 version.h: version version.pl
96         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
97
98 version.mac: version version.pl
99         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
100
101 # This source file is generated from the standard macros file
102 # `standard.mac' by another Perl script. Again, it's part of the
103 # standard distribution.
104
105 macros.c: macros.pl standard.mac version.mac
106         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
107
108 # These source files are generated from regs.dat by yet another
109 # perl script.
110 regs.c: regs.dat regs.pl
111         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
112 regflags.c: regs.dat regs.pl
113         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
114 regdis.c: regs.dat regs.pl
115         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
116 regvals.c: regs.dat regs.pl
117         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
118 regs.h: regs.dat regs.pl
119         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
120
121 # Assembler token hash
122 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
123         $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat &
124                 $(srcdir)/tokens.dat > tokhash.c
125
126 # Assembler token metadata
127 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
128         $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat &
129                 $(srcdir)/tokens.dat > tokens.h
130
131 # Preprocessor token hash
132 pptok.h: pptok.dat pptok.pl perllib/phash.ph
133         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
134 pptok.c: pptok.dat pptok.pl perllib/phash.ph
135         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
136
137 # This target generates all files that require perl.
138 # This allows easier generation of distribution (see dist target).
139 PERLREQ = macros.c insnsa.c insnsd.c insnsi.h insnsn.c &
140           regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h &
141           version.h version.mac pptok.h pptok.c
142 perlreq: $(PERLREQ)
143
144 clean: .SYMBOLIC
145         -del /f *.$(O)
146         -del /f *.s
147         -del /f *.i
148         -del /f output\*.$(O)
149         -del /f output\*.s
150         -del /f output\*.i
151         -del /f nasm$(X)
152         -del /f ndisasm$(X)
153         rem cd rdoff && $(MAKE) clean
154
155 distclean: clean .SYMBOLIC
156         -del /f config.h
157         -del /f config.log
158         -del /f config.status
159         -del /f Makefile
160         -del /f *~
161         -del /f *.bak
162         -del /f *.lst
163         -del /f *.bin
164         -del /f output\*~
165         -del /f output\*.bak
166         -del /f test\*.lst
167         -del /f test\*.bin
168         -del /f test\*.$(O)
169         -del /f test\*.bin
170         -del /f/s autom4te*.cache
171         rem cd rdoff && $(MAKE) distclean
172
173 cleaner: clean .SYMBOLIC
174         -del /f $(PERLREQ)
175         -del /f *.man
176         -del /f nasm.spec
177         rem cd doc && $(MAKE) clean
178
179 spotless: distclean cleaner .SYMBOLIC
180         -del /f doc\Makefile
181         -del doc\*~
182         -del doc\*.bak
183
184 strip: .SYMBOLIC
185         $(STRIP) *.exe
186
187 rdf:
188         # cd rdoff && $(MAKE)
189
190 doc:
191         # cd doc && $(MAKE) all
192
193 everything: all doc rdf
194
195 #-- Magic hints to mkdep.pl --#
196 # @object-ending: ".$(O)"
197 # @path-separator: "\"
198 # @exclude: "config.h"
199 # @continuation: "&"
200 #-- Everything below is generated by mkdep.pl - do not edit --#
201 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h &
202  nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c tokens.h version.h
203 crc64.$(O): crc64.c
204 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h insnsn.c names.c &
205  nasm.h nasmlib.h regdis.c regs.c regs.h sync.h tokens.h version.h
206 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h &
207  nasmlib.h regs.h version.h
208 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h &
209  version.h
210 float.$(O): float.c compiler.h insnsi.h nasm.h nasmlib.h regs.h version.h
211 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
212  regs.h version.h
213 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
214  tokens.h version.h
215 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
216  tokens.h version.h
217 insnsn.$(O): insnsn.c
218 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h &
219  version.h
220 lib\snprintf.$(O): lib\snprintf.c compiler.h nasmlib.h
221 lib\vsnprintf.$(O): lib\vsnprintf.c compiler.h nasmlib.h
222 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h &
223  regs.h version.h
224 macros.$(O): macros.c
225 names.$(O): names.c insnsn.c regs.c
226 nasm.$(O): nasm.c assemble.h compiler.h eval.h insns.h insnsi.h labels.h &
227  listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h regs.h &
228  stdscan.h tokens.h version.h
229 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
230  tokens.h version.h
231 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h &
232  nasmlib.h regs.h sync.h tokens.h version.h
233 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h &
234  regs.h version.h
235 output\outaout.$(O): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h &
236  outform.h regs.h stdscan.h version.h
237 output\outas86.$(O): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h &
238  outform.h regs.h version.h
239 output\outbin.$(O): output\outbin.c compiler.h eval.h insnsi.h labels.h &
240  nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
241 output\outcoff.$(O): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h &
242  outform.h regs.h version.h
243 output\outdbg.$(O): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h &
244  outform.h regs.h version.h
245 output\outelf32.$(O): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h &
246  outform.h regs.h stdscan.h version.h
247 output\outelf64.$(O): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h &
248  outform.h regs.h stdscan.h version.h
249 output\outieee.$(O): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h &
250  outform.h regs.h version.h
251 output\outmacho.$(O): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h &
252  outform.h regs.h version.h
253 output\outobj.$(O): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h &
254  outform.h regs.h stdscan.h version.h
255 output\outrdf.$(O): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h &
256  outform.h regs.h version.h
257 output\outrdf2.$(O): output\outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h &
258  outform.h rdoff\rdoff.h regs.h version.h
259 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h &
260  parser.h regflags.c regs.h stdscan.h tokens.h version.h
261 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
262 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h macros.c nasm.h &
263  nasmlib.h pptok.h preproc.h regs.h version.h
264 regdis.$(O): regdis.c
265 regflags.$(O): regflags.c
266 regs.$(O): regs.c
267 regvals.$(O): regvals.c
268 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
269  stdscan.h tokens.h version.h
270 sync.$(O): sync.c compiler.h nasmlib.h sync.h
271 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h &
272  nasmlib.h regs.h tokens.h version.h