NASM 0.94
[nasm.git] / Makefile.bc2
blobd2e9b52d615c84592e1485129f339c5b16bc2d67
1 # Makefile for the Netwide Assembler under 16-bit DOS (aimed at Borland C)
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.
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.
15 # It does show a few of my preferances, like putting the OBJ files
16 # in a seperat 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).
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.
24 # BEFORE YOU USE THIS MAKE FILE!!!
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.
31 LIB =c:\\tc\\lib\\      #location standard libaries
33 OBJD=obj\\              #directory to put OBJ files in
34 CC = tcc                #compiler
35 LINK = tlink            #linker
36 CCFLAGS = /c /O /A /ml /n$(OBJD) #compiler flags for NASM
37   #/c=compile only
38   #/O=Optimise jumps
39   #/A=ANSI standard C
40   #/ml=Model Large
41   #/n$(OBJD)= put the OBJ files in the diectory given.
43 DCCFLAGS = /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
44   #/c=compile only
45   #/O=Optimise jumps
46   #/A=ANSI standard C
47   #/mh=Model huge
48   #/n$(OBJD)= put the OBJ files in the diectory given.
49   #NOTE: Huge modle is used, and the array in insnsd.c is large enough to
50   #over size the d-group in large mode.
52 LINKFLAGS = /c /x       #linker flags
53   #/c=case segnificance on symboles
54   #/x=No map file at all
56 LIBRARIES =             #any libaries to add, out side of the standard libary
57 EXE = .exe              #executable file extention (keep the . as the start)
58 OBJ = obj               #OBJ file extention
60 NASM_ASM=$(CC) $(CCFLAGS) $&.c         #Command line for NASM
61 DASM_ASM=$(CC) $(DCCFLAGS) $&.c        #command line for NDISASM
63 # NOTE: $& is used to create the file name, as it only gives the name it's
64 # self, where as using $* would have give the full path of the file it
65 # want's done. This becomes a problem if the OBJ files are in a seperate
66 # directory, becuse it will then try to find the source file in the OBJ
67 # dir.
69 ################################################################
70 #The OBJ files that NASM is dependent on
72 NASMOBJS = $(OBJD)nasm.$(OBJ)   $(OBJD)nasmlib.$(OBJ)  $(OBJD)float.$(OBJ)  \
73            $(OBJD)insnsa.$(OBJ) $(OBJD)assemble.$(OBJ) $(OBJD)labels.$(OBJ) \
74            $(OBJD)parser.$(OBJ) $(OBJD)outform.$(OBJ)  $(OBJD)preproc.$(OBJ)
76 ################################################################
77 #The OBJ files that NDISASM is dependent on
79 NDISASMOBJS = $(OBJD)ndisasm.$(OBJ)  $(OBJD)disasm.$(OBJ) $(OBJD)sync.$(OBJ) \
80               $(OBJD)nasmlibd.$(OBJ) $(OBJD)insnsd.$(OBJ)
82 ################################################################
83 #The OBJ file for the output formats.
85 OUTOBJ= $(OBJD)outbin.$(OBJ) $(OBJD)outaout.$(OBJ) $(OBJD)outcoff.$(OBJ) \
86         $(OBJD)outelf.$(OBJ) $(OBJD)outobj.$(OBJ)  $(OBJD)outas86.$(OBJ) \
87         $(OBJD)outrdf.$(OBJ) $(OBJD)outdbg.$(OBJ)
90 ################################################################
91 # Build everything
93 all : nasm$(EXE) ndisasm$(EXE)
95 ################################################################
96 #NASM, NDISASM compile, I hope it's self explanitorie
98 nasm$(EXE): $(NASMOBJS) $(OUTOBJ)
99           $(LINK) $(LINKFLAGS) @&&^            #command for the linker
100           $(LIB)c0l.obj $(NASMOBJS) $(OUTOBJ)  #OBJ file list,
101           nasm$(EXE)                           #EXE file name
102 # No need of a map file
103           $(LIB)cl.lib $(LIBRARIES)            #Libaries needed
106 ndisasm$(EXE): $(NDISASMOBJS)
107         $(LINK) $(LINKFLAGS) @&&^              #command for the linker
108         $(LIB)c0h.obj $(NDISASMOBJS)           #OBJ file list
109         ndisasm$(EXE)                          #EXE file name
110 # No need of a map file
111         $(LIB)ch.lib $(LIBRARIES)              #Libaries needed
114 ################################################################
115 # Dependencies for all of NASM's obj files
117 $(OBJD)assemble.$(OBJ): assemble.c nasm.h assemble.h insns.h
118         $(NASM_ASM)
120 $(OBJD)float.$(OBJ): float.c nasm.h
121         $(NASM_ASM)
123 $(OBJD)labels.$(OBJ): labels.c nasm.h nasmlib.h
124         $(NASM_ASM)
126 $(OBJD)nasm.$(OBJ): nasm.c nasm.h nasmlib.h parser.h assemble.h labels.h
127 outform.h
128         $(NASM_ASM)
130 $(OBJD)nasmlib.$(OBJ): nasmlib.c nasm.h nasmlib.h
131         $(NASM_ASM)
133 $(OBJD)parser.$(OBJ): parser.c nasm.h nasmlib.h parser.h float.h names.c
134         $(NASM_ASM)
136 $(OBJD)preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h nasmlib.h
137         $(NASM_ASM)
139 $(OBJD)insnsa.$(OBJ): insnsa.c nasm.h insns.h
140         $(NASM_ASM)
142 ################################################################
143 # Dependencies for all of NDISASM's obj files
145 $(OBJD)disasm.$(OBJ): disasm.c nasm.h disasm.h sync.h insns.h names.c
146         $(DASM_ASM)
148 $(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h sync.h disasm.h
149         $(DASM_ASM)
151 $(OBJD)sync.$(OBJ): sync.c sync.h
152         $(DASM_ASM)
154 $(OBJD)insnsd.$(OBJ): insnsd.c nasm.h insns.h
155         $(DASM_ASM)
157 # This is a kludge from the word go, as we can't use the nasmlib.obj compiled
158 # for NASM, as it's the wrong model size, so we have to compile it again,
159 # but in huge.
161 # So as not to overwrite the nasmlib.obj for NASM (if I did, that
162 # could cause all kinds of problems) it compiles it into nasmlibd.obj.
164 # the -o... switch tells it the name to compile the obj file to, right here
165 # $(OBJD)nasmlibd.obj
167 $(OBJD)nasmlibd.$(OBJ): nasmlib.c nasm.h nasmlib.h
168         $(CC) $(DCCFLAGS) -o$(OBJD)nasmlibd.obj nasmlib.c
170 ################################################################
171 # Dependencies for all of the output format's OBJ files
173 $(OBJD)outas86.$(OBJ): outas86.c nasm.h nasmlib.h
174         $(NASM_ASM)
176 $(OBJD)outaout.$(OBJ): outaout.c nasm.h nasmlib.h
177         $(NASM_ASM)
179 $(OBJD)outbin.$(OBJ): outbin.c nasm.h nasmlib.h
180         $(NASM_ASM)
182 $(OBJD)outcoff.$(OBJ): outcoff.c nasm.h nasmlib.h
183         $(NASM_ASM)
185 $(OBJD)outdbg.$(OBJ): outdbg.c nasm.h nasmlib.h
186         $(NASM_ASM)
188 $(OBJD)outelf.$(OBJ): outelf.c nasm.h nasmlib.h
189         $(NASM_ASM)
191 $(OBJD)outobj.$(OBJ): outobj.c nasm.h nasmlib.h
192         $(NASM_ASM)
194 $(OBJD)outrdf.$(OBJ): outrdf.c nasm.h nasmlib.h
195         $(NASM_ASM)
197 $(OBJD)outform.$(OBJ): outform.c outform.h nasm.h
198         $(NASM_ASM)
200 ################################################################
201 # A quick way to delete the OBJ files as well as the binaries.
203 clean :
204         del $(OBJD)*.obj
205         del nasm$(EXE)
206         del ndisasm$(EXE)
208 # Makefile created by Fox Cutter <lmb@comtch.iea.com> --01/21/97