*** empty log message ***
[platform/upstream/nasm.git] / Mkfiles / Makefile.bc3
1 # Makefile for the Netwide Assembler under 16-bit DOS (aimed at Borland C)
2 #
3 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4 # Julian Hall. All rights reserved. The software is
5 # redistributable under the licence given in the file "Licence"
6 # distributed in the NASM archive.
7 #
8 # This Makefile compiles NASM and NDISASM for 16 bit DOS using Borland
9 # C++; tested with version 3.1.  It probably should work for any
10 # version of Turbo C++ or Borland C++ from version 3.0 upwards.
11 # For Turbo C++, replace "bcc" with "tcc", and replace "-O1" with "-O".
12 #
13 # Most everything is remarked, and explaned in full, it should be
14 # easy to convert it to another compiler. I tried to make the devision
15 # of information logical, and easy to follow.
16 #
17 # BEFORE YOU USE THIS MAKE FILE!!!
18 #
19 # Make sure the line below is set to the propper location of your standard
20 # Libaries, if not you'll get some errors. Make sure to keep the trailing
21 # backslash, as it's needed, and remeber to use \\ not \ as that will cause
22 # some errors.
23 #
24 # This Makefile was updated with NASM 0.98.31, and could compile that
25 # version correctly using Borland C++ 3.1 under DOS.
26 #
27
28 CC = bcc                #compiler
29 #compiler flags
30 CCFLAGS = -d -c -O1 -mh -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
31   # -d  = merge dupicate strings
32   # -c  = compile only
33   # -O1 = optimise for size
34   # -mh = model huge
35   # -n  = put the OBJ files in the diectory given.
36
37 LINKFLAGS = -d -mh
38
39 LIBS =                  #any libaries to add, out side of the standard libary
40 EXE = .exe              #executable file extention (keep the . as the start)
41 OBJ = obj               #OBJ file extention
42 LIB = lib               #LIB file extension
43
44 # Compilation command line
45 NASM_ASM=$(CC) $(CCFLAGS) -o$*.$(OBJ) $*.c
46
47 ################################################################
48 #The OBJ files that NASM is dependent on
49
50 NASMOBJS = nasm.$(OBJ)   nasmlib.$(OBJ)  float.$(OBJ)  \
51            insnsa.$(OBJ) assemble.$(OBJ) labels.$(OBJ) \
52            parser.$(OBJ) outform.$(OBJ)  preproc.$(OBJ) \
53            listing.$(OBJ) eval.$(OBJ)
54
55 ################################################################
56 #The OBJ files that NDISASM is dependent on
57
58 NDISASMOBJS = ndisasm.$(OBJ)  disasm.$(OBJ) sync.$(OBJ) \
59               nasmlib.$(OBJ) insnsd.$(OBJ)
60
61 ################################################################
62 # The OBJ file for the output formats we want to compile in.
63 # It doesn't make sense for 16-bit MS-DOS to include all formats.
64
65 OUTOBJ= output\\outbin.$(OBJ) output\\outaout.$(OBJ) output\\outcoff.$(OBJ) \
66         output\\outelf.$(OBJ) output\\outobj.$(OBJ)  output\\outas86.$(OBJ) \
67         output\\outrdf.$(OBJ) output\\outdbg.$(OBJ)  output\\outrdf2.$(OBJ) \
68         output\\outieee.$(OBJ)
69
70
71 ################################################################
72 # Build everything
73
74 all : nasm$(EXE) ndisasm$(EXE)
75
76 ################################################################
77 # NASM, NDISASM link.  The &&!...! construct in Borland Make
78 # creates a temporary file and inserts its name on the command
79 # line.  It works around the DOS 127-character command line
80 # limit.
81
82 nasm$(EXE): $(NASMOBJS) output\\out.lib
83         $(CC) $(LINKFLAGS) -onasm$(EXE) @&&!
84 $(NASMOBJS)
85 output\\out.lib
86 !
87
88 ndisasm$(EXE): $(NDISASMOBJS)
89         $(CC) $(LINKFLAGS) -ondisasm$(EXE) @&&!
90 $(NDISASMOBJS)
91 !
92
93 ################################################################
94 # Dependencies for all of NASM's obj files
95
96 assemble.$(OBJ): assemble.c nasm.h version.h insnsi.h assemble.h insns.h
97         $(NASM_ASM)
98
99 float.$(OBJ): float.c nasm.h version.h insnsi.h
100         $(NASM_ASM)
101
102 labels.$(OBJ): labels.c nasm.h version.h insnsi.h nasmlib.h
103         $(NASM_ASM)
104
105 listing.$(OBJ): listing.c nasm.h version.h insnsi.h nasmlib.h listing.h
106         $(NASM_ASM)
107
108 eval.$(OBJ): eval.c nasm.h version.h insnsi.h nasmlib.h eval.h
109         $(NASM_ASM)
110
111 nasm.$(OBJ): nasm.c nasm.h version.h insnsi.h nasmlib.h parser.h assemble.h labels.h \
112                 listing.h outform.h
113         $(NASM_ASM)
114
115 nasmlib.$(OBJ): nasmlib.c nasm.h version.h insnsi.h nasmlib.h names.c insnsn.c
116         $(NASM_ASM)
117
118 parser.$(OBJ): parser.c nasm.h version.h insnsi.h nasmlib.h parser.h float.h names.c insnsn.c
119         $(NASM_ASM)
120
121 preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h version.h insnsi.h nasmlib.h
122         $(NASM_ASM)
123
124 insnsa.$(OBJ): insnsa.c nasm.h version.h insnsi.h insns.h
125         $(NASM_ASM)
126
127 ################################################################
128 # Dependencies for all of NDISASM's obj files
129
130 disasm.$(OBJ): disasm.c nasm.h version.h insnsi.h disasm.h sync.h insns.h names.c insnsn.c
131         $(NASM_ASM)
132
133 ndisasm.$(OBJ): ndisasm.c nasm.h version.h insnsi.h sync.h disasm.h
134         $(NASM_ASM)
135
136 sync.$(OBJ): sync.c sync.h
137         $(NASM_ASM)
138
139 insnsd.$(OBJ): insnsd.c nasm.h version.h insnsi.h insns.h
140         $(NASM_ASM)
141
142 ################################################################
143 # Build the output formats as a library
144 # The & ... $? construct tells Borland Make to repeat for all
145 # out of date dependencies
146 output\\out.$(LIB): $(OUTOBJ)
147         -del output\\out.$(LIB)
148         for %a in (output\\*.obj) do tlib /C output\\out.$(LIB) +%a
149
150 ################################################################
151 # Dependencies for all of the output format's OBJ files
152
153 output\\outas86.$(OBJ): output\\outas86.c nasm.h version.h insnsi.h nasmlib.h
154         $(NASM_ASM)
155
156 output\\outaout.$(OBJ): output\\outaout.c nasm.h version.h insnsi.h nasmlib.h
157         $(NASM_ASM)
158
159 output\\outbin.$(OBJ): output\\outbin.c nasm.h version.h insnsi.h nasmlib.h
160         $(NASM_ASM)
161
162 output\\outcoff.$(OBJ): output\\outcoff.c nasm.h version.h insnsi.h nasmlib.h
163         $(NASM_ASM)
164
165 output\\outdbg.$(OBJ): output\\outdbg.c nasm.h version.h insnsi.h nasmlib.h
166         $(NASM_ASM)
167
168 output\\outelf.$(OBJ): output\\outelf.c nasm.h version.h insnsi.h nasmlib.h
169         $(NASM_ASM)
170
171 output\\outobj.$(OBJ): output\\outobj.c nasm.h version.h insnsi.h nasmlib.h
172         $(NASM_ASM)
173
174 output\\outrdf.$(OBJ): output\\outrdf.c nasm.h version.h insnsi.h nasmlib.h
175         $(NASM_ASM)
176
177 output\\outrdf2.$(OBJ): output\\outrdf2.c nasm.h version.h insnsi.h nasmlib.h
178         $(NASM_ASM)
179
180 output\\outieee.$(OBJ): output\\outieee.c nasm.h version.h insnsi.h nasmlib.h
181         $(NASM_ASM)
182
183 outform.$(OBJ): outform.c outform.h nasm.h version.h insnsi.h
184         $(NASM_ASM)
185
186 ################################################################
187 # A quick way to delete the OBJ files as well as the binaries.
188
189 clean :
190         -del *.$(OBJ)
191         -del output\\*.$(OBJ)
192         -del output\\out.$(LIB)
193         -del nasm$(EXE)
194         -del ndisasm$(EXE)