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 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".
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.
17 # BEFORE YOU USE THIS MAKE FILE!!!
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
24 # This Makefile was updated with NASM 0.98.31, and could compile that
25 # version correctly using Borland C++ 3.1 under DOS.
31 OPTFLAGS = -d -O1 -Ogmp -k-
32 # -d = merge duplicate strings
33 # -O1 = optimize for size
34 # -Og = enable global common subexpression elimination
35 # -Om = enable loop invariant removal
36 # -Op = enable constant propagation
37 # ** WARNING: DO NOT ENABLE -Ov (strength reduction) ON BORLAND C++ 3.1 **
38 # ** NASM IS KNOWN TO MISCOMPILE WITH -Ov **
39 # -k- = omit stack frames where practical
41 OUTFORMS = -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
44 CFLAGS = $(OPTFLAGS) -mh -f- $(OUTFORMS)
46 # -f- = no floating point
48 LINKFLAGS = -d -mh -M -f-
49 # -d = merge duplicate strings
50 # -M = generate map file (to find address space bottlenecks)
52 LIBS = #any libaries to add, out side of the standard libary
53 EXE = .exe #executable file extention (keep the . as the start)
54 OBJ = obj #OBJ file extention
55 LIB = lib #LIB file extension
58 $(CC) $(CFLAGS) -c -o$@ $<
60 ################################################################
61 # The OBJ files that NASM is dependent on
63 NASMOBJS = nasm.$(OBJ) nasmlib.$(OBJ) float.$(OBJ) \
64 assemble.$(OBJ) labels.$(OBJ) \
65 parser.$(OBJ) outform.$(OBJ) preproc.$(OBJ) \
66 listing.$(OBJ) eval.$(OBJ) insnsa.$(OBJ)
68 ################################################################
69 # The OBJ files that NDISASM is dependent on
71 NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) \
72 nasmlib.$(OBJ) insnsd.$(OBJ)
74 ################################################################
75 # The OBJ file for the output formats
77 OUTOBJ= output\\outbin.$(OBJ) output\\outaout.$(OBJ) output\\outcoff.$(OBJ) \
78 output\\outelf32.$(OBJ) output\\outelf64.$(OBJ) \
79 output\\outobj.$(OBJ) output\\outas86.$(OBJ) \
80 output\\outdbg.$(OBJ) output\\outrdf2.$(OBJ) output\\outieee.$(OBJ)
82 ################################################################
85 all : nasm$(EXE) ndisasm$(EXE)
87 ################################################################
88 # Rules to put the CFLAGS in a file
90 echo $(CFLAGS) > CFLAGS
93 ################################################################
94 # NASM, NDISASM link. The &&!...! construct in Borland Make
95 # creates a temporary file and inserts its name on the command
96 # line. It works around the DOS 127-character command line
99 nasm$(EXE): $(NASMOBJS) output\\out.$(LIB)
100 $(CC) $(LINKFLAGS) -onasm$(EXE) @&&!
105 ndisasm$(EXE): $(NDISASMOBJS)
106 $(CC) $(LINKFLAGS) -ondisasm$(EXE) @&&!
110 ################################################################
111 # Build the output formats as a library
112 # The & ... $? construct tells Borland Make to repeat for all
113 # out of date dependencies
114 output\\out.$(LIB): $(OUTOBJ)
115 -del output\\out.$(LIB)
116 for %a in (output\\*.$(OBJ)) do tlib /C output\\out.$(LIB) +%a
118 ################################################################
119 # A quick way to delete the OBJ files as well as the binaries.
123 -del output\\*.$(OBJ)
124 -del output\\out.$(LIB)
132 #-- Magic hints to mkdep.pl --#
133 # @object-ending: ".$(OBJ)"
134 # @path-separator: "\\"
135 #-- Everything below is generated by mkdep.pl - do not edit --#
136 assemble.$(OBJ): assemble.c preproc.h insns.h regs.h regflags.c config.h \
137 version.h nasmlib.h nasm.h regvals.c insnsi.h assemble.h
138 disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
139 version.h nasm.h insnsn.c names.c insnsi.h disasm.h
140 eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
142 float.$(OBJ): float.c regs.h config.h version.h nasm.h
143 insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
144 insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
145 insnsn.$(OBJ): insnsn.c
146 labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h
147 listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
149 macros.$(OBJ): macros.c
150 names.$(OBJ): names.c regs.c insnsn.c
151 nasm.$(OBJ): nasm.c labels.h preproc.h insns.h parser.h eval.h regs.h \
152 outform.h config.h version.h nasmlib.h nasm.h stdscan.h assemble.h insnsi.h \
154 nasmlib.$(OBJ): nasmlib.c insns.h regs.h config.h regs.c version.h nasmlib.h \
155 nasm.h insnsn.c names.c insnsi.h
156 ndisasm.$(OBJ): ndisasm.c insns.h sync.h regs.h config.h version.h nasmlib.h \
157 nasm.h insnsi.h disasm.h
158 outform.$(OBJ): outform.c regs.h config.h outform.h version.h nasm.h
159 output\\outaout.$(OBJ): output\\outaout.c regs.h outform.h config.h \
160 version.h nasmlib.h nasm.h stdscan.h
161 output\\outas86.$(OBJ): output\\outas86.c regs.h outform.h config.h \
162 version.h nasmlib.h nasm.h
163 output\\outbin.$(OBJ): output\\outbin.c labels.h eval.h regs.h outform.h \
164 config.h version.h nasmlib.h nasm.h stdscan.h
165 output\\outcoff.$(OBJ): output\\outcoff.c regs.h outform.h config.h \
166 version.h nasmlib.h nasm.h
167 output\\outdbg.$(OBJ): output\\outdbg.c regs.h outform.h config.h version.h \
169 output\\outelf32.$(OBJ): output\\outelf32.c regs.h outform.h config.h \
170 version.h nasmlib.h nasm.h stdscan.h
171 output\\outelf64.$(OBJ): output\\outelf64.c regs.h outform.h config.h \
172 version.h nasmlib.h nasm.h stdscan.h
173 output\\outieee.$(OBJ): output\\outieee.c regs.h outform.h config.h \
174 version.h nasmlib.h nasm.h
175 output\\outmacho.$(OBJ): output\\outmacho.c compiler.h regs.h outform.h \
176 config.h version.h nasmlib.h nasm.h
177 output\\outobj.$(OBJ): output\\outobj.c regs.h outform.h config.h version.h \
178 nasmlib.h nasm.h stdscan.h
179 output\\outrdf.$(OBJ): output\\outrdf.c regs.h outform.h config.h version.h \
181 output\\outrdf2.$(OBJ): output\\outrdf2.c rdoff\\rdoff.h regs.h outform.h \
182 config.h version.h nasmlib.h nasm.h
183 parser.$(OBJ): parser.c insns.h parser.h float.h regs.h regflags.c config.h \
184 version.h nasmlib.h nasm.h stdscan.h insnsi.h
185 preproc.$(OBJ): preproc.c macros.c regs.h config.h version.h nasmlib.h \
187 regdis.$(OBJ): regdis.c
188 regflags.$(OBJ): regflags.c
190 regvals.$(OBJ): regvals.c
191 stdscan.$(OBJ): stdscan.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
193 sync.$(OBJ): sync.c sync.h
194 tokhash.$(OBJ): tokhash.c insns.h regs.h config.h version.h nasm.h insnsi.h