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 LIB =c:\\tc\\lib\\ #location standard libaries
33 OBJD=obj\\ #directory to put OBJ files in
36 CCFLAGS = /c /O /A /ml /n$(OBJD) #compiler flags for NASM
41 #/n$(OBJD)= put the OBJ files in the diectory given.
43 DCCFLAGS = /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
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
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)
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 ################################################################
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
120 $(OBJD)float.$(OBJ): float.c nasm.h
123 $(OBJD)labels.$(OBJ): labels.c nasm.h nasmlib.h
126 $(OBJD)nasm.$(OBJ): nasm.c nasm.h nasmlib.h parser.h assemble.h labels.h
130 $(OBJD)nasmlib.$(OBJ): nasmlib.c nasm.h nasmlib.h
133 $(OBJD)parser.$(OBJ): parser.c nasm.h nasmlib.h parser.h float.h names.c
136 $(OBJD)insnsa.$(OBJ): insnsa.c nasm.h insns.h
139 ################################################################
140 # Dependencies for all of NDISASM's obj files
142 $(OBJD)disasm.$(OBJ): disasm.c nasm.h disasm.h sync.h insns.h names.c
145 $(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h sync.h disasm.h
148 $(OBJD)sync.$(OBJ): sync.c sync.h
151 $(OBJD)insnsd.$(OBJ): insnsd.c nasm.h insns.h
154 # This is a kludge from the word go, as we can't use the nasmlib.obj compiled
155 # for NASM, as it's the wrong model size, so we have to compile it again,
158 # So as not to overwrite the nasmlib.obj for NASM (if I did, that
159 # could cause all kinds of problems) it compiles it into nasmlibd.obj.
161 # the -o... switch tells it the name to compile the obj file to, right here
162 # $(OBJD)nasmlibd.obj
164 $(OBJD)nasmlibd.$(OBJ): nasmlib.c nasm.h nasmlib.h
165 $(CC) $(DCCFLAGS) -o$(OBJD)nasmlibd.obj nasmlib.c
167 ################################################################
168 # Dependencies for all of the output format's OBJ files
170 $(OBJD)outas86.$(OBJ): outas86.c nasm.h nasmlib.h
173 $(OBJD)outaout.$(OBJ): outaout.c nasm.h nasmlib.h
176 $(OBJD)outbin.$(OBJ): outbin.c nasm.h nasmlib.h
179 $(OBJD)outcoff.$(OBJ): outcoff.c nasm.h nasmlib.h
182 $(OBJD)outdbg.$(OBJ): outdbg.c nasm.h nasmlib.h
185 $(OBJD)outelf.$(OBJ): outelf.c nasm.h nasmlib.h
188 $(OBJD)outobj.$(OBJ): outobj.c nasm.h nasmlib.h
191 $(OBJD)outrdf.$(OBJ): outrdf.c nasm.h nasmlib.h
194 $(OBJD)outform.$(OBJ): outform.c outform.h nasm.h
197 ################################################################
198 # A quick way to delete the OBJ files as well as the binaries.
205 # Makefile created by Fox Cutter <lmb@comtch.iea.com> --01/21/97