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\\outelf.$(OBJ) output\\outobj.$(OBJ) output\\outas86.$(OBJ) \
79 output\\outdbg.$(OBJ) output\\outrdf2.$(OBJ) output\\outieee.$(OBJ)
81 ################################################################
84 all : nasm$(EXE) ndisasm$(EXE)
86 ################################################################
87 # Rules to put the CFLAGS in a file
89 echo $(CFLAGS) > CFLAGS
92 ################################################################
93 # NASM, NDISASM link. The &&!...! construct in Borland Make
94 # creates a temporary file and inserts its name on the command
95 # line. It works around the DOS 127-character command line
98 nasm$(EXE): $(NASMOBJS) output\\out.$(LIB)
99 $(CC) $(LINKFLAGS) -onasm$(EXE) @&&!
104 ndisasm$(EXE): $(NDISASMOBJS)
105 $(CC) $(LINKFLAGS) -ondisasm$(EXE) @&&!
109 ################################################################
110 # Build the output formats as a library
111 # The & ... $? construct tells Borland Make to repeat for all
112 # out of date dependencies
113 output\\out.$(LIB): $(OUTOBJ)
114 -del output\\out.$(LIB)
115 for %a in (output\\*.$(OBJ)) do tlib /C output\\out.$(LIB) +%a
117 ################################################################
118 # A quick way to delete the OBJ files as well as the binaries.
122 -del output\\*.$(OBJ)
123 -del output\\out.$(LIB)
131 #-- Magic hints to mkdep.pl --#
132 # @object-ending: ".$(OBJ)"
133 # @path-separator: "\\"
134 #-- Everything below is generated by mkdep.pl - do not edit --#
135 assemble.$(OBJ): assemble.c preproc.h insns.h regs.h version.h nasmlib.h \
136 nasm.h regvals.c insnsi.h assemble.h
137 disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h regs.c version.h \
138 nasm.h insnsn.c names.c insnsi.h disasm.h
139 eval.$(OBJ): eval.c labels.h eval.h regs.h version.h nasmlib.h nasm.h
140 float.$(OBJ): float.c regs.h version.h nasm.h
141 insnsa.$(OBJ): insnsa.c insns.h regs.h version.h nasm.h insnsi.h
142 insnsd.$(OBJ): insnsd.c insns.h regs.h version.h nasm.h insnsi.h
143 insnsn.$(OBJ): insnsn.c
144 labels.$(OBJ): labels.c regs.h version.h nasmlib.h nasm.h
145 listing.$(OBJ): listing.c regs.h version.h nasmlib.h nasm.h listing.h
146 macros.$(OBJ): macros.c
147 names.$(OBJ): names.c regs.c insnsn.c
148 nasm.$(OBJ): nasm.c labels.h preproc.h insns.h parser.h eval.h regs.h \
149 outform.h version.h nasmlib.h nasm.h assemble.h insnsi.h listing.h
150 nasmlib.$(OBJ): nasmlib.c insns.h regs.h regs.c version.h nasmlib.h nasm.h \
151 insnsn.c names.c insnsi.h
152 ndisasm.$(OBJ): ndisasm.c insns.h sync.h regs.h version.h nasmlib.h nasm.h \
154 outform.$(OBJ): outform.c regs.h outform.h version.h nasm.h
155 output\\outaout.$(OBJ): output\\outaout.c regs.h outform.h version.h \
157 output\\outas86.$(OBJ): output\\outas86.c regs.h outform.h version.h \
159 output\\outbin.$(OBJ): output\\outbin.c labels.h eval.h regs.h outform.h \
160 version.h nasmlib.h nasm.h
161 output\\outcoff.$(OBJ): output\\outcoff.c regs.h outform.h version.h \
163 output\\outdbg.$(OBJ): output\\outdbg.c regs.h outform.h version.h nasmlib.h \
165 output\\outelf.$(OBJ): output\\outelf.c regs.h outform.h version.h nasmlib.h \
167 output\\outieee.$(OBJ): output\\outieee.c regs.h outform.h version.h \
169 output\\outobj.$(OBJ): output\\outobj.c regs.h outform.h version.h nasmlib.h \
171 output\\outrdf.$(OBJ): output\\outrdf.c regs.h outform.h version.h nasmlib.h \
173 output\\outrdf2.$(OBJ): output\\outrdf2.c rdoff\\rdoff.h regs.h outform.h \
174 version.h nasmlib.h nasm.h
175 parser.$(OBJ): parser.c insns.h parser.h float.h regs.h regflags.c version.h \
176 nasmlib.h nasm.h insnsi.h
177 preproc.$(OBJ): preproc.c macros.c regs.h version.h nasmlib.h nasm.h
178 regdis.$(OBJ): regdis.c
179 regflags.$(OBJ): regflags.c
181 regvals.$(OBJ): regvals.c
182 sync.$(OBJ): sync.c sync.h