Generate a byte array instead of using strings for the byte codes
[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 NASM =  nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) assemble.$(O) &
48         labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) &
49         outform.$(O) output\outbin.$(O) &
50         output\outaout.$(O) output\outcoff.$(O) &
51         output\outelf32.$(O) output\outelf64.$(O) &
52         output\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) &
53         output\outdbg.$(O) output\outieee.$(O) output\outmacho.$(O) &
54         preproc.$(O) pptok.$(O) &
55         listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) tokhash.$(O)
56
57 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) insnsd.$(O)
58
59 what:   .SYMBOLIC
60         @echo Please build "dos", "win32" or "os2"
61
62 dos:    .SYMBOLIC
63         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=DOS -l=DOS4G"
64
65 win32:  .SYMBOLIC
66         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=NT  -l=NT"
67
68 os2:    .SYMBOLIC
69         $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=OS2 -l=OS2V2"
70
71 all: nasm$(X) ndisasm$(X) .SYMBOLIC
72         rem cd rdoff && $(MAKE) all
73
74 nasm$(X): $(NASM)
75         $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
76
77 ndisasm$(X): $(NDISASM)
78         $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
79
80 # These source files are automagically generated from a single
81 # instruction-table file by a Perl script. They're distributed,
82 # though, so it isn't necessary to have Perl just to recompile NASM
83 # from the distribution.
84
85 insnsb.c: insns.dat insns.pl
86         $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
87 insnsa.c: insns.dat insns.pl
88         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
89 insnsd.c: insns.dat insns.pl
90         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
91 insnsi.h: insns.dat insns.pl
92         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
93 insnsn.c: insns.dat insns.pl
94         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
95
96 # These files contains all the standard macros that are derived from
97 # the version number.
98 version.h: version version.pl
99         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
100
101 version.mac: version version.pl
102         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
103
104 # This source file is generated from the standard macros file
105 # `standard.mac' by another Perl script. Again, it's part of the
106 # standard distribution.
107
108 macros.c: macros.pl standard.mac version.mac
109         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
110
111 # These source files are generated from regs.dat by yet another
112 # perl script.
113 regs.c: regs.dat regs.pl
114         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
115 regflags.c: regs.dat regs.pl
116         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
117 regdis.c: regs.dat regs.pl
118         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
119 regvals.c: regs.dat regs.pl
120         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
121 regs.h: regs.dat regs.pl
122         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
123
124 # Assembler token hash
125 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
126         $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat &
127                 $(srcdir)/tokens.dat > tokhash.c
128
129 # Assembler token metadata
130 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
131         $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat &
132                 $(srcdir)/tokens.dat > tokens.h
133
134 # Preprocessor token hash
135 pptok.h: pptok.dat pptok.pl perllib/phash.ph
136         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
137 pptok.c: pptok.dat pptok.pl perllib/phash.ph
138         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
139
140 # This target generates all files that require perl.
141 # This allows easier generation of distribution (see dist target).
142 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c &
143           regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h &
144           version.h version.mac pptok.h pptok.c
145 perlreq: $(PERLREQ)
146
147 clean: .SYMBOLIC
148         -del /f *.$(O)
149         -del /f *.s
150         -del /f *.i
151         -del /f output\*.$(O)
152         -del /f output\*.s
153         -del /f output\*.i
154         -del /f nasm$(X)
155         -del /f ndisasm$(X)
156         rem cd rdoff && $(MAKE) clean
157
158 distclean: clean .SYMBOLIC
159         -del /f config.h
160         -del /f config.log
161         -del /f config.status
162         -del /f Makefile
163         -del /f *~
164         -del /f *.bak
165         -del /f *.lst
166         -del /f *.bin
167         -del /f output\*~
168         -del /f output\*.bak
169         -del /f test\*.lst
170         -del /f test\*.bin
171         -del /f test\*.$(O)
172         -del /f test\*.bin
173         -del /f/s autom4te*.cache
174         rem cd rdoff && $(MAKE) distclean
175
176 cleaner: clean .SYMBOLIC
177         -del /f $(PERLREQ)
178         -del /f *.man
179         -del /f nasm.spec
180         rem cd doc && $(MAKE) clean
181
182 spotless: distclean cleaner .SYMBOLIC
183         -del /f doc\Makefile
184         -del doc\*~
185         -del doc\*.bak
186
187 strip: .SYMBOLIC
188         $(STRIP) *.exe
189
190 rdf:
191         # cd rdoff && $(MAKE)
192
193 doc:
194         # cd doc && $(MAKE) all
195
196 everything: all doc rdf
197
198 #-- Magic hints to mkdep.pl --#
199 # @object-ending: ".$(O)"
200 # @path-separator: "\"
201 # @exclude: "config.h"
202 # @continuation: "&"
203 #-- Everything below is generated by mkdep.pl - do not edit --#
204 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h &
205  nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c tokens.h version.h
206 crc64.$(O): crc64.c compiler.h
207 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h insnsn.c names.c &
208  nasm.h nasmlib.h regdis.c regs.c regs.h sync.h tokens.h version.h
209 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h &
210  nasmlib.h regs.h version.h
211 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h &
212  version.h
213 float.$(O): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h &
214  version.h
215 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
216  regs.h version.h
217 insnsa.$(O): insnsa.c compiler.h insns.h insnsb.c insnsi.h nasm.h nasmlib.h &
218  regs.h tokens.h version.h
219 insnsb.$(O): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
220  tokens.h version.h
221 insnsd.$(O): insnsd.c compiler.h insns.h insnsb.c insnsi.h nasm.h nasmlib.h &
222  regs.h tokens.h version.h
223 insnsn.$(O): insnsn.c
224 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h &
225  version.h
226 lib\snprintf.$(O): lib\snprintf.c compiler.h nasmlib.h
227 lib\vsnprintf.$(O): lib\vsnprintf.c compiler.h nasmlib.h
228 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h &
229  regs.h version.h
230 macros.$(O): macros.c compiler.h
231 names.$(O): names.c compiler.h insnsn.c regs.c
232 nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h &
233  labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h &
234  regs.h stdscan.h tokens.h version.h
235 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
236  tokens.h version.h
237 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h &
238  nasmlib.h regs.h sync.h tokens.h version.h
239 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h &
240  regs.h version.h
241 output\outaout.$(O): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h &
242  outform.h regs.h stdscan.h version.h
243 output\outas86.$(O): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h &
244  outform.h regs.h version.h
245 output\outbin.$(O): output\outbin.c compiler.h eval.h insnsi.h labels.h &
246  nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
247 output\outcoff.$(O): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h &
248  outform.h regs.h version.h
249 output\outdbg.$(O): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h &
250  outform.h regs.h version.h
251 output\outelf32.$(O): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h &
252  outform.h regs.h stdscan.h version.h wsaa.h
253 output\outelf64.$(O): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h &
254  outform.h regs.h stdscan.h version.h wsaa.h
255 output\outieee.$(O): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h &
256  outform.h regs.h version.h
257 output\outmacho.$(O): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h &
258  outform.h regs.h version.h
259 output\outobj.$(O): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h &
260  outform.h regs.h stdscan.h version.h
261 output\outrdf.$(O): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h &
262  outform.h regs.h version.h
263 output\outrdf2.$(O): output\outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h &
264  outform.h rdoff\rdoff.h regs.h version.h
265 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h &
266  parser.h regflags.c regs.h stdscan.h tokens.h version.h
267 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
268 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h macros.c nasm.h &
269  nasmlib.h pptok.h preproc.h regs.h stdscan.h tokens.h version.h
270 regdis.$(O): regdis.c
271 regflags.$(O): regflags.c
272 regs.$(O): regs.c compiler.h
273 regvals.$(O): regvals.c
274 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
275  stdscan.h tokens.h version.h
276 sync.$(O): sync.c compiler.h nasmlib.h sync.h
277 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h &
278  nasmlib.h regs.h tokens.h version.h