Makefile: clean up the lib directory on make clean
[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 DEBUG           =
18 CFLAGS          = -6 -ox -wx -ze -fpi $(DEBUG)
19 BUILD_CFLAGS    = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes
20 INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
21 ALL_CFLAGS      = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
22 LD              = $(CC)
23 LDFLAGS         = $(ALL_CFLAGS)
24 LIBS            =
25 PERL            = perl -I$(srcdir)/perllib
26
27 STRIP           = wstrip
28
29 # Binary suffixes
30 O               = obj
31 X               = .exe
32
33 # WMAKE errors out if a suffix is declared more than once, including
34 # its own built-in declarations.  Thus, we need to explicitly clear the list
35 # first.  Also, WMAKE only allows implicit rules that point "to the left"
36 # in this list!
37 .SUFFIXES:
38 .SUFFIXES: .man .1 .$(O) .i .c
39
40 # Needed to find C files anywhere but in the current directory
41 .c : $(VPATH)
42
43 .c.$(O):
44         $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
45
46 # Note: wcl386 is broken if forward slashes are used as path separators.
47 #-- Begin File Lists --#
48 # Edit in Makefile.in, not here!
49 NASM =  nasm.$(O) nasmlib.$(O) ver.$(O) &
50         raa.$(O) saa.$(O) rbtree.$(O) &
51         float.$(O) insnsa.$(O) insnsb.$(O) &
52         directives.$(O) &
53         assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) &
54         output\outform.$(O) output\outlib.$(O) output\nulldbg.$(O) &
55         output\nullout.$(O) &
56         output\outbin.$(O) output\outaout.$(O) output\outcoff.$(O) &
57         output\outelf.$(O) output\outelf32.$(O) output\outelf64.$(O) &
58         output\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) &
59         output\outdbg.$(O) output\outieee.$(O) output\outmacho32.$(O) &
60         output\outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) &
61         macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) &
62         strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) &
63         lib\strlcpy.$(O)
64
65 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) &
66         insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
67 #-- End File Lists --#
68
69 what:   .SYMBOLIC
70         @echo Please build "dos", "win32" or "os2"
71
72 dos:    .SYMBOLIC
73         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=DOS -l=DOS4G"
74
75 win32:  .SYMBOLIC
76         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=NT  -l=NT"
77
78 os2:    .SYMBOLIC
79         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=OS2 -l=OS2V2"
80
81 all: nasm$(X) ndisasm$(X) .SYMBOLIC
82         rem cd rdoff && $(MAKE) all
83
84 nasm$(X): $(NASM)
85         $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
86
87 ndisasm$(X): $(NDISASM)
88         $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
89
90 # These source files are automagically generated from a single
91 # instruction-table file by a Perl script. They're distributed,
92 # though, so it isn't necessary to have Perl just to recompile NASM
93 # from the distribution.
94
95 insnsb.c: insns.dat insns.pl
96         $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
97 insnsa.c: insns.dat insns.pl
98         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
99 insnsd.c: insns.dat insns.pl
100         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
101 insnsi.h: insns.dat insns.pl
102         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
103 insnsn.c: insns.dat insns.pl
104         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
105
106 # These files contains all the standard macros that are derived from
107 # the version number.
108 version.h: version version.pl
109         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
110
111 version.mac: version version.pl
112         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
113
114 # This source file is generated from the standard macros file
115 # `standard.mac' by another Perl script. Again, it's part of the
116 # standard distribution.
117
118 macros.c: macros.pl standard.mac version.mac
119         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
120
121 # These source files are generated from regs.dat by yet another
122 # perl script.
123 regs.c: regs.dat regs.pl
124         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
125 regflags.c: regs.dat regs.pl
126         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
127 regdis.c: regs.dat regs.pl
128         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
129 regdis.h: regs.dat regs.pl
130         $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
131 regvals.c: regs.dat regs.pl
132         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
133 regs.h: regs.dat regs.pl
134         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
135
136 # Assembler token hash
137 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
138         $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat &
139                 $(srcdir)/tokens.dat > tokhash.c
140
141 # Assembler token metadata
142 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
143         $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat &
144                 $(srcdir)/tokens.dat > tokens.h
145
146 # Preprocessor token hash
147 pptok.h: pptok.dat pptok.pl perllib/phash.ph
148         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
149 pptok.c: pptok.dat pptok.pl perllib/phash.ph
150         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
151
152 # This target generates all files that require perl.
153 # This allows easier generation of distribution (see dist target).
154 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c &
155           regs.c regs.h regflags.c regdis.c regdis.h regvals.c &
156           tokhash.c tokens.h pptok.h pptok.c &
157           version.h version.mac
158 perlreq: $(PERLREQ)
159
160 clean: .SYMBOLIC
161         -del /f *.$(O)
162         -del /f *.s
163         -del /f *.i
164         -del /f lib\*.$(O)
165         -del /f lib\*.s
166         -del /f lib\*.i
167         -del /f output\*.$(O)
168         -del /f output\*.s
169         -del /f output\*.i
170         -del /f nasm$(X)
171         -del /f ndisasm$(X)
172         rem cd rdoff && $(MAKE) clean
173
174 distclean: clean .SYMBOLIC
175         -del /f config.h
176         -del /f config.log
177         -del /f config.status
178         -del /f Makefile
179         -del /f *~
180         -del /f *.bak
181         -del /f *.lst
182         -del /f *.bin
183         -del /f output\*~
184         -del /f output\*.bak
185         -del /f test\*.lst
186         -del /f test\*.bin
187         -del /f test\*.$(O)
188         -del /f test\*.bin
189         -del /f/s autom4te*.cache
190         rem cd rdoff && $(MAKE) distclean
191
192 cleaner: clean .SYMBOLIC
193         -del /f $(PERLREQ)
194         -del /f *.man
195         -del /f nasm.spec
196         rem cd doc && $(MAKE) clean
197
198 spotless: distclean cleaner .SYMBOLIC
199         -del /f doc\Makefile
200         -del doc\*~
201         -del doc\*.bak
202
203 strip: .SYMBOLIC
204         $(STRIP) *.exe
205
206 rdf:
207         # cd rdoff && $(MAKE)
208
209 doc:
210         # cd doc && $(MAKE) all
211
212 everything: all doc rdf
213
214 #-- Magic hints to mkdep.pl --#
215 # @object-ending: ".$(O)"
216 # @path-separator: "\"
217 # @exclude: "config.h"
218 # @continuation: "&"
219 #-- Everything below is generated by mkdep.pl - do not edit --#
220 assemble.$(O): assemble.c assemble.h compiler.h directives.h insns.h &
221  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h &
222  tokens.h
223 crc64.$(O): crc64.c compiler.h nasmlib.h
224 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h &
225  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
226 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h &
227  nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h sync.h &
228  tables.h tokens.h
229 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h &
230  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
231 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
232  opflags.h pptok.h preproc.h regs.h
233 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h &
234  nasmlib.h opflags.h pptok.h preproc.h regs.h
235 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
236  nasmlib.h opflags.h pptok.h preproc.h regs.h
237 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h &
238  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
239 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h &
240  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
241 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h &
242  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
243 insnsn.$(O): insnsn.c compiler.h insnsi.h opflags.h tables.h
244 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
245  nasmlib.h opflags.h pptok.h preproc.h regs.h
246 lib\snprintf.$(O): lib\snprintf.c compiler.h nasmlib.h
247 lib\strlcpy.$(O): lib\strlcpy.c compiler.h
248 lib\vsnprintf.$(O): lib\vsnprintf.c compiler.h nasmlib.h
249 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h &
250  nasmlib.h opflags.h pptok.h preproc.h regs.h
251 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h &
252  nasmlib.h opflags.h output\outform.h pptok.h preproc.h regs.h tables.h
253 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h &
254  insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h output\outform.h &
255  parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
256 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h &
257  nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
258 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h &
259  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h tokens.h
260 output\nulldbg.$(O): output\nulldbg.c compiler.h directives.h insnsi.h &
261  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
262 output\nullout.$(O): output\nullout.c compiler.h directives.h insnsi.h &
263  nasm.h nasmlib.h opflags.h output\outlib.h pptok.h preproc.h regs.h
264 output\outaout.$(O): output\outaout.c compiler.h directives.h eval.h &
265  insnsi.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
266  pptok.h preproc.h raa.h regs.h saa.h stdscan.h
267 output\outas86.$(O): output\outas86.c compiler.h directives.h insnsi.h &
268  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
269  preproc.h raa.h regs.h saa.h
270 output\outbin.$(O): output\outbin.c compiler.h directives.h eval.h insnsi.h &
271  labels.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
272  pptok.h preproc.h regs.h saa.h stdscan.h
273 output\outcoff.$(O): output\outcoff.c output\pecoff.h compiler.h directives.h eval.h &
274  insnsi.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
275  pptok.h preproc.h raa.h regs.h saa.h
276 output\outdbg.$(O): output\outdbg.c compiler.h directives.h insnsi.h nasm.h &
277  nasmlib.h opflags.h output\outform.h pptok.h preproc.h regs.h
278 output\outelf.$(O): output\outelf.c compiler.h directives.h insnsi.h nasm.h &
279  nasmlib.h opflags.h output\dwarf.h output\elf.h output\outelf.h &
280  output\outform.h pptok.h preproc.h regs.h
281 output\outelf32.$(O): output\outelf32.c compiler.h directives.h eval.h &
282  insnsi.h nasm.h nasmlib.h opflags.h output\dwarf.h output\elf.h &
283  output\outelf.h output\outform.h output\outlib.h output\stabs.h pptok.h &
284  preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
285 output\outelf64.$(O): output\outelf64.c compiler.h directives.h eval.h &
286  insnsi.h nasm.h nasmlib.h opflags.h output\dwarf.h output\elf.h &
287  output\outelf.h output\outform.h output\outlib.h output\stabs.h pptok.h &
288  preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
289 output\outform.$(O): output\outform.c compiler.h directives.h insnsi.h &
290  nasm.h nasmlib.h opflags.h output\outform.h pptok.h preproc.h regs.h
291 output\outieee.$(O): output\outieee.c compiler.h directives.h insnsi.h &
292  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
293  preproc.h regs.h
294 output\outlib.$(O): output\outlib.c compiler.h directives.h insnsi.h nasm.h &
295  nasmlib.h opflags.h output\outlib.h pptok.h preproc.h regs.h
296 output\outmacho32.$(O): output\outmacho32.c compiler.h directives.h eval.h &
297  insnsi.h nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h &
298  pptok.h preproc.h raa.h regs.h saa.h
299 output\outmacho64.$(O): output\outmacho64.c compiler.h directives.h insnsi.h &
300  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
301  preproc.h raa.h regs.h saa.h
302 output\outobj.$(O): output\outobj.c compiler.h directives.h eval.h insnsi.h &
303  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
304  preproc.h regs.h stdscan.h
305 output\outrdf2.$(O): output\outrdf2.c compiler.h directives.h insnsi.h &
306  nasm.h nasmlib.h opflags.h output\outform.h output\outlib.h pptok.h &
307  preproc.h rdoff\rdoff.h regs.h saa.h
308 parser.$(O): parser.c compiler.h directives.h eval.h float.h insns.h &
309  insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h &
310  stdscan.h tables.h tokens.h
311 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
312 preproc.$(O): preproc.c compiler.h directives.h eval.h hashtbl.h insnsi.h &
313  nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h &
314  tables.h tokens.h
315 quote.$(O): quote.c compiler.h nasmlib.h quote.h
316 raa.$(O): raa.c compiler.h nasmlib.h raa.h
317 rbtree.$(O): rbtree.c compiler.h rbtree.h
318 regdis.$(O): regdis.c regdis.h regs.h
319 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
320  opflags.h pptok.h preproc.h regs.h tables.h
321 regs.$(O): regs.c compiler.h insnsi.h opflags.h tables.h
322 regvals.$(O): regvals.c compiler.h insnsi.h opflags.h tables.h
323 saa.$(O): saa.c compiler.h nasmlib.h saa.h
324 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h &
325  nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
326 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h &
327  opflags.h pptok.h preproc.h regs.h
328 sync.$(O): sync.c compiler.h nasmlib.h sync.h
329 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h &
330  nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
331 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h opflags.h &
332  pptok.h preproc.h regs.h version.h