NASM 0.98.30
[platform/upstream/nasm.git] / Mkfiles / Makefile.bc2
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 is made for compile NASM and NDISASM on a 16 bit dos
9 # compiler like Microsoft C, or Borland C. This should work on all
10 # verioson of Turbo C++ and Borland C++ from version 3.0 and upwords.
11 # I'm not fully sure how it will handel on Microsoft C, but all the
12 # switches are documented, and it shouldn't be a problem to change it
13 # over.
14 #
15 # It does show a few of my preferances, like putting the OBJ files
16 # in a seperate directory, but if you just set OBJD to '.', it will
17 # drop them all in the current directory (though you still need to
18 # make the directory it's self).
19 #
20 # Most everything is remarked, and explaned in full, it should be
21 # easy to convert it to another compiler. I tried to make the devision
22 # of information logical, and easy to follow.
23 #
24 # BEFORE YOU USE THIS MAKE FILE!!!
25 #
26 # Make sure the line below is set to the propper location of your standard
27 # Libaries, if not you'll get some errors. Make sure to keep the trailing
28 # backslash, as it's needed, and remeber to use \\ not \ as that will cause
29 # some errors.
30 #
31 # Also inportant, if you get a DGROUP error when you compile NASM, remove
32 # or comment out the 'NASMSize=l' line, and uncoment (remove the #) from the
33 # NASMSize=h line. Then run 'make Clean' to delete the object files. Then run
34 # make again to re-build NASM as huge.
35 #
36 # History:
37 # 06/13/97: * Added the EXED varable for the location to put the EXE files.
38 #           * Because different versions of Borland and Turbo C have
39 #             different GROUPings for the DGROUP, some version, when you
40 #             compile NASM, you will get a DGROUP overflow error, making it
41 #             so NASM has to be compiled as huge. As this isn't a constant
42 #             through systems (and apperently some version of Borland,
43 #             compileing as huge causes some errors) the NASMSize verable
44 #             has been added to spicify what size of code you want to
45 #             compile as and defaults to large.
46 # 06/16/97: * Added 'merge dupicate strings' to the options for compiles.
47
48 NASMSize=l              #Compile Nasm as Large
49 #NASMSize=h              #Compile Nasm as Huge
50
51 LIB =c:\\tc\\lib\\      #location standard libaries
52
53 OBJD=obj\\              #directory to put OBJ files in
54 EXED=.\                 #directory to put the EXE files.
55 CC = tcc                #compiler
56 LINK = tlink            #linker
57 CCFLAGS = /d /c /O /A /m$(NASMSize) /n$(OBJD) #compiler flags for NASM
58   #/d=merge dupicate strings
59   #/c=compile only
60   #/O=Optimise jumps
61   #/A=ANSI standard C
62   #/m$(NASMSize>=the model to use
63   #/n$(OBJD)= put the OBJ files in the diectory given.
64
65 DCCFLAGS = /d /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
66   #/d=merge dupicate strings
67   #/c=compile only
68   #/O=Optimise jumps
69   #/A=ANSI standard C
70   #/mh=Model huge
71   #/n$(OBJD)= put the OBJ files in the diectory given.
72   #NOTE: Huge model is used, and the array in insnsd.c is large enough to
73   #over size the d-group in large mode.
74
75 LINKFLAGS = /c /x       #linker flags
76   #/c=case segnificance on symboles
77   #/x=No map file at all
78
79 LIBRARIES =             #any libaries to add, out side of the standard libary
80 EXE = .exe              #executable file extention (keep the . as the start)
81 OBJ = obj               #OBJ file extention
82
83 NASM_ASM=$(CC) $(CCFLAGS) $&.c         #Command line for NASM
84 DASM_ASM=$(CC) $(DCCFLAGS) $&.c        #command line for NDISASM
85
86 # NOTE: $& is used to create the file name, as it only gives the name it's
87 # self, where as using $* would have give the full path of the file it
88 # want's done. This becomes a problem if the OBJ files are in a seperate
89 # directory, becuse it will then try to find the source file in the OBJ
90 # dir.
91
92 ################################################################
93 #The OBJ files that NASM is dependent on
94
95 NASMOBJS = $(OBJD)nasm.$(OBJ)   $(OBJD)nasmlib.$(OBJ)  $(OBJD)float.$(OBJ)  \
96            $(OBJD)insnsa.$(OBJ) $(OBJD)assemble.$(OBJ) $(OBJD)labels.$(OBJ) \
97            $(OBJD)parser.$(OBJ) $(OBJD)outform.$(OBJ)  $(OBJD)preproc.$(OBJ) \
98            $(OBJD)listing.$(OBJ) $(OBJD)eval.$(OBJ)
99
100 ################################################################
101 #The OBJ files that NDISASM is dependent on
102
103 NDISASMOBJS = $(OBJD)ndisasm.$(OBJ)  $(OBJD)disasm.$(OBJ) $(OBJD)sync.$(OBJ) \
104               $(OBJD)nasmlibd.$(OBJ) $(OBJD)insnsd.$(OBJ)
105
106 ################################################################
107 #The OBJ file for the output formats.
108
109 OUTOBJ= $(OBJD)outbin.$(OBJ) $(OBJD)outaout.$(OBJ) $(OBJD)outcoff.$(OBJ) \
110         $(OBJD)outelf.$(OBJ) $(OBJD)outobj.$(OBJ)  $(OBJD)outas86.$(OBJ) \
111         $(OBJD)outrdf.$(OBJ) $(OBJD)outdbg.$(OBJ)  $(OBJD)outrdf2.$(OBJ) \
112         $(OBJD)outieee.$(OBJ)
113
114
115 ################################################################
116 # Build everything
117
118 all : nasm$(EXE) ndisasm$(EXE)
119
120 ################################################################
121 #NASM, NDISASM compile, I hope it's self explanitorie
122
123 nasm$(EXE): $(NASMOBJS) $(OUTOBJ)
124           $(LINK) $(LINKFLAGS) @&&^                     #command for the linker
125           $(LIB)c0$(NASMSize).obj $(NASMOBJS) $(OUTOBJ) #OBJ file list
126           $(EXED)nasm$(EXE)                             #EXE file name
127 # No need of a map file
128           $(LIB)c$(NASMSize).lib $(LIBRARIES)           #Libaries needed
129 ^
130
131 ndisasm$(EXE): $(NDISASMOBJS)
132         $(LINK) $(LINKFLAGS) @&&^              #command for the linker
133         $(LIB)c0h.obj $(NDISASMOBJS)           #OBJ file list
134         $(EXED)ndisasm$(EXE)                   #EXE file name
135 # No need of a map file
136         $(LIB)ch.lib $(LIBRARIES)              #Libaries needed
137 ^
138
139 ################################################################
140 # Dependencies for all of NASM's obj files
141
142 $(OBJD)assemble.$(OBJ): assemble.c nasm.h insnsi.h assemble.h insns.h
143         $(NASM_ASM)
144
145 $(OBJD)float.$(OBJ): float.c nasm.h insnsi.h
146         $(NASM_ASM)
147
148 $(OBJD)labels.$(OBJ): labels.c nasm.h insnsi.h nasmlib.h
149         $(NASM_ASM)
150
151 $(OBJD)listing.$(OBJ): listing.c nasm.h insnsi.h nasmlib.h listing.h
152         $(NASM_ASM)
153
154 $(OBJD)eval.$(OBJ): eval.c nasm.h insnsi.h nasmlib.h eval.h
155         $(NASM_ASM)
156
157 $(OBJD)nasm.$(OBJ): nasm.c nasm.h insnsi.h nasmlib.h parser.h assemble.h labels.h \
158                 listing.h outform.h
159         $(NASM_ASM)
160
161 $(OBJD)nasmlib.$(OBJ): nasmlib.c nasm.h insnsi.h nasmlib.h names.c insnsn.c
162         $(NASM_ASM)
163
164 $(OBJD)parser.$(OBJ): parser.c nasm.h insnsi.h nasmlib.h parser.h float.h names.c insnsn.c
165         $(NASM_ASM)
166
167 $(OBJD)preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h insnsi.h nasmlib.h
168         $(NASM_ASM)
169
170 $(OBJD)insnsa.$(OBJ): insnsa.c nasm.h insnsi.h insns.h
171         $(NASM_ASM)
172
173 ################################################################
174 # Dependencies for all of NDISASM's obj files
175
176 $(OBJD)disasm.$(OBJ): disasm.c nasm.h insnsi.h disasm.h sync.h insns.h names.c insnsn.c
177         $(DASM_ASM)
178
179 $(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h insnsi.h sync.h disasm.h
180         $(DASM_ASM)
181
182 $(OBJD)sync.$(OBJ): sync.c sync.h
183         $(DASM_ASM)
184
185 $(OBJD)insnsd.$(OBJ): insnsd.c nasm.h insnsi.h insns.h
186         $(DASM_ASM)
187
188 # This is a kludge from the word go, as we can't use the nasmlib.obj compiled
189 # for NASM, as it's could be the wrong model size, so we have to compile it
190 # again as huge to make sure.
191 #
192 # So as not to overwrite the nasmlib.obj for NASM (if it did, that
193 # could cause all kinds of problems) it compiles it into nasmlibd.obj.
194 #
195 # the -o... switch tells it the name to compile the obj file to, right here
196 # $(OBJD)nasmlibd.obj
197
198 $(OBJD)nasmlibd.$(OBJ): nasmlib.c nasm.h insnsi.h nasmlib.h
199         $(CC) $(DCCFLAGS) -o$(OBJD)nasmlibd.obj nasmlib.c
200
201 ################################################################
202 # Dependencies for all of the output format's OBJ files
203
204 $(OBJD)outas86.$(OBJ): output/outas86.c nasm.h insnsi.h nasmlib.h
205         $(NASM_ASM)
206
207 $(OBJD)outaout.$(OBJ): output/outaout.c nasm.h insnsi.h nasmlib.h
208         $(NASM_ASM)
209
210 $(OBJD)outbin.$(OBJ): output/outbin.c nasm.h insnsi.h nasmlib.h
211         $(NASM_ASM)
212
213 $(OBJD)outcoff.$(OBJ): output/outcoff.c nasm.h insnsi.h nasmlib.h
214         $(NASM_ASM)
215
216 $(OBJD)outdbg.$(OBJ): output/outdbg.c nasm.h insnsi.h nasmlib.h
217         $(NASM_ASM)
218
219 $(OBJD)outelf.$(OBJ): output/outelf.c nasm.h insnsi.h nasmlib.h
220         $(NASM_ASM)
221
222 $(OBJD)outobj.$(OBJ): output/outobj.c nasm.h insnsi.h nasmlib.h
223         $(NASM_ASM)
224
225 $(OBJD)outrdf2.$(OBJ): output/outrdf2.c nasm.h insnsi.h nasmlib.h
226         $(NASM_ASM)
227
228 $(OBJD)outieee.$(OBJ): output/outieee.c nasm.h insnsi.h nasmlib.h
229         $(NASM_ASM)
230
231 $(OBJD)outform.$(OBJ): outform.c outform.h nasm.h insnsi.h
232         $(NASM_ASM)
233
234 ################################################################
235 # A quick way to delete the OBJ files as well as the binaries.
236
237 clean :
238         del $(OBJD)*.obj
239         del nasm$(EXE)
240         del ndisasm$(EXE)
241
242 # Makefile created by Fox Cutter <lmb@comtch.iea.com> --01/27/97