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
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
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.
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.
48 NASMSize=l #Compile Nasm as Large
49 #NASMSize=h #Compile Nasm as Huge
51 LIB =c:\\tc\\lib\\ #location standard libaries
53 OBJD=obj\\ #directory to put OBJ files in
54 EXED=.\ #directory to put the EXE files.
57 CCFLAGS = /d /c /O /A /m$(NASMSize) /n$(OBJD) #compiler flags for NASM
58 #/d=merge dupicate strings
62 #/m$(NASMSize>=the model to use
63 #/n$(OBJD)= put the OBJ files in the diectory given.
65 DCCFLAGS = /d /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
66 #/d=merge dupicate strings
71 #/n$(OBJD)= put the OBJ files in the diectory given.
72 #NOTE: Huge modle is used, and the array in insnsd.c is large enough to
73 #over size the d-group in large mode.
75 LINKFLAGS = /c /x #linker flags
76 #/c=case segnificance on symboles
77 #/x=No map file at all
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
83 NASM_ASM=$(CC) $(CCFLAGS) $&.c #Command line for NASM
84 DASM_ASM=$(CC) $(DCCFLAGS) $&.c #command line for NDISASM
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
92 ################################################################
93 #The OBJ files that NASM is dependent on
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) \
100 ################################################################
101 #The OBJ files that NDISASM is dependent on
103 NDISASMOBJS = $(OBJD)ndisasm.$(OBJ) $(OBJD)disasm.$(OBJ) $(OBJD)sync.$(OBJ) \
104 $(OBJD)nasmlibd.$(OBJ) $(OBJD)insnsd.$(OBJ)
106 ################################################################
107 #The OBJ file for the output formats.
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)
114 ################################################################
117 all : nasm$(EXE) ndisasm$(EXE)
119 ################################################################
120 #NASM, NDISASM compile, I hope it's self explanitorie
122 nasm$(EXE): $(NASMOBJS) $(OUTOBJ)
123 $(LINK) $(LINKFLAGS) @&&^ #command for the linker
124 $(LIB)c0$(NASMSize).obj $(NASMOBJS) $(OUTOBJ) #OBJ file list
125 $(EXED)nasm$(EXE) #EXE file name
126 # No need of a map file
127 $(LIB)c$(NASMSize).lib $(LIBRARIES) #Libaries needed
130 ndisasm$(EXE): $(NDISASMOBJS)
131 $(LINK) $(LINKFLAGS) @&&^ #command for the linker
132 $(LIB)c0h.obj $(NDISASMOBJS) #OBJ file list
133 $(EXED)ndisasm$(EXE) #EXE file name
134 # No need of a map file
135 $(LIB)ch.lib $(LIBRARIES) #Libaries needed
138 ################################################################
139 # Dependencies for all of NASM's obj files
141 $(OBJD)assemble.$(OBJ): assemble.c nasm.h assemble.h insns.h
144 $(OBJD)float.$(OBJ): float.c nasm.h
147 $(OBJD)labels.$(OBJ): labels.c nasm.h nasmlib.h
150 $(OBJD)listing.$(OBJ): listing.c nasm.h nasmlib.h listing.h
153 $(OBJD)nasm.$(OBJ): nasm.c nasm.h nasmlib.h parser.h assemble.h labels.h \
157 $(OBJD)nasmlib.$(OBJ): nasmlib.c nasm.h nasmlib.h
160 $(OBJD)parser.$(OBJ): parser.c nasm.h nasmlib.h parser.h float.h names.c
163 $(OBJD)preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h nasmlib.h
166 $(OBJD)insnsa.$(OBJ): insnsa.c nasm.h insns.h
169 ################################################################
170 # Dependencies for all of NDISASM's obj files
172 $(OBJD)disasm.$(OBJ): disasm.c nasm.h disasm.h sync.h insns.h names.c
175 $(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h sync.h disasm.h
178 $(OBJD)sync.$(OBJ): sync.c sync.h
181 $(OBJD)insnsd.$(OBJ): insnsd.c nasm.h insns.h
184 # This is a kludge from the word go, as we can't use the nasmlib.obj compiled
185 # for NASM, as it's could be the wrong model size, so we have to compile it
186 # again as huge to make sure.
188 # So as not to overwrite the nasmlib.obj for NASM (if it did, that
189 # could cause all kinds of problems) it compiles it into nasmlibd.obj.
191 # the -o... switch tells it the name to compile the obj file to, right here
192 # $(OBJD)nasmlibd.obj
194 $(OBJD)nasmlibd.$(OBJ): nasmlib.c nasm.h nasmlib.h
195 $(CC) $(DCCFLAGS) -o$(OBJD)nasmlibd.obj nasmlib.c
197 ################################################################
198 # Dependencies for all of the output format's OBJ files
200 $(OBJD)outas86.$(OBJ): outas86.c nasm.h nasmlib.h
203 $(OBJD)outaout.$(OBJ): outaout.c nasm.h nasmlib.h
206 $(OBJD)outbin.$(OBJ): outbin.c nasm.h nasmlib.h
209 $(OBJD)outcoff.$(OBJ): outcoff.c nasm.h nasmlib.h
212 $(OBJD)outdbg.$(OBJ): outdbg.c nasm.h nasmlib.h
215 $(OBJD)outelf.$(OBJ): outelf.c nasm.h nasmlib.h
218 $(OBJD)outobj.$(OBJ): outobj.c nasm.h nasmlib.h
221 $(OBJD)outrdf.$(OBJ): outrdf.c nasm.h nasmlib.h
224 $(OBJD)outform.$(OBJ): outform.c outform.h nasm.h
227 ################################################################
228 # A quick way to delete the OBJ files as well as the binaries.
235 # Makefile created by Fox Cutter <lmb@comtch.iea.com> --01/27/97