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.
30 OPTFLAGS = -d -O1 -Ogmpv -k-
31 # -d = merge duplicate strings
32 # -O1 = optimize for size
33 # -Og = enable global common subexpression elimination
34 # -Om = enable loop invariant removal
35 # -Op = enable constant propagation
36 # -Ov = enable strength-reduction optimization
37 # -k- = omit stack frames where practical
39 OUTFORMS = -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
41 CFLAGS = -mh $(OPTFLAGS) $(OUTFORMS)
45 # -d = merge duplicate strings
48 LIBS = #any libaries to add, out side of the standard libary
49 EXE = .exe #executable file extention (keep the . as the start)
50 OBJ = obj #OBJ file extention
51 LIB = lib #LIB file extension
54 $(CC) $(CFLAGS) -c -o$@ $<
56 ################################################################
57 # The OBJ files that NASM is dependent on
59 NASMOBJS = nasm.$(OBJ) nasmlib.$(OBJ) float.$(OBJ) \
60 insnsa.$(OBJ) assemble.$(OBJ) labels.$(OBJ) \
61 parser.$(OBJ) outform.$(OBJ) preproc.$(OBJ) \
62 listing.$(OBJ) eval.$(OBJ)
64 ################################################################
65 # The OBJ files that NDISASM is dependent on
67 NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) \
68 nasmlib.$(OBJ) insnsd.$(OBJ)
70 ################################################################
71 # The OBJ file for the output formats
73 OUTOBJ= output\\outbin.$(OBJ) output\\outaout.$(OBJ) output\\outcoff.$(OBJ) \
74 output\\outelf.$(OBJ) output\\outobj.$(OBJ) output\\outas86.$(OBJ) \
75 output\\outdbg.$(OBJ) output\\outrdf2.$(OBJ) output\\outieee.$(OBJ)
77 ################################################################
80 all : nasm$(EXE) ndisasm$(EXE)
82 ################################################################
83 # Build the output formats as a library
84 output\\out.$(LIB): $(OUTOBJ)
85 -del output\\out.$(LIB)
86 for %a in (output\\*.$(OBJ)) do tlib /C output\\out.$(LIB) +%a
88 ################################################################
89 # NASM, NDISASM link. The &&!...! construct in Borland Make
90 # creates a temporary file and inserts its name on the command
91 # line. It works around the DOS 127-character command line
94 nasm$(EXE): $(NASMOBJS) output\\out.$(LIB)
95 $(CC) $(LINKFLAGS) -onasm$(EXE) @&&!
100 ndisasm$(EXE): $(NDISASMOBJS)
101 $(CC) $(LINKFLAGS) -ondisasm$(EXE) @&&!
105 ################################################################
106 # A quick way to delete the OBJ files as well as the binaries.
110 -del output\\*.$(OBJ)
111 -del output\\out.$(LIB)
115 #-- Magic hints to mkdep.pl --#
116 # @object-ending: ".$(OBJ)"
117 # @path-separator: "\\"
118 #-- Everything below is generated by mkdep.pl - do not edit --#
119 assemble.$(OBJ): assemble.c insns.h assemble.h regvals.c nasm.h regs.h \
120 insnsi.h nasmlib.h version.h
121 disasm.$(OBJ): disasm.c insns.h regs.c sync.h names.c nasm.h disasm.h regs.h \
122 insnsn.c insnsi.h version.h regdis.c
123 eval.$(OBJ): eval.c nasm.h regs.h labels.h insnsi.h nasmlib.h version.h \
125 float.$(OBJ): float.c nasm.h regs.h insnsi.h version.h
126 insnsa.$(OBJ): insnsa.c insns.h nasm.h regs.h insnsi.h version.h
127 insnsd.$(OBJ): insnsd.c insns.h nasm.h regs.h insnsi.h version.h
128 insnsn.$(OBJ): insnsn.c
129 labels.$(OBJ): labels.c nasm.h regs.h insnsi.h nasmlib.h version.h
130 listing.$(OBJ): listing.c listing.h nasm.h regs.h insnsi.h nasmlib.h \
132 macros.$(OBJ): macros.c
133 names.$(OBJ): names.c regs.c insnsn.c
134 nasm.$(OBJ): nasm.c listing.h preproc.h insns.h outform.h assemble.h \
135 parser.h nasm.h regs.h labels.h insnsi.h nasmlib.h version.h eval.h
136 nasmlib.$(OBJ): nasmlib.c regs.c names.c nasm.h regs.h insnsn.c insnsi.h \
138 ndisasm.$(OBJ): ndisasm.c insns.h sync.h nasm.h disasm.h regs.h insnsi.h \
140 outform.$(OBJ): outform.c outform.h nasm.h regs.h insnsi.h version.h
141 output\\outaout.$(OBJ): output\\outaout.c outform.h nasm.h regs.h insnsi.h \
143 output\\outas86.$(OBJ): output\\outas86.c outform.h nasm.h regs.h insnsi.h \
145 output\\outbin.$(OBJ): output\\outbin.c outform.h nasm.h regs.h insnsi.h \
147 output\\outcoff.$(OBJ): output\\outcoff.c outform.h nasm.h regs.h insnsi.h \
149 output\\outdbg.$(OBJ): output\\outdbg.c outform.h nasm.h regs.h insnsi.h \
151 output\\outelf.$(OBJ): output\\outelf.c outform.h nasm.h regs.h insnsi.h \
153 output\\outieee.$(OBJ): output\\outieee.c outform.h nasm.h regs.h insnsi.h \
155 output\\outobj.$(OBJ): output\\outobj.c outform.h nasm.h regs.h insnsi.h \
157 output\\outrdf.$(OBJ): output\\outrdf.c outform.h nasm.h regs.h insnsi.h \
159 output\\outrdf2.$(OBJ): output\\outrdf2.c outform.h nasm.h regs.h insnsi.h \
161 parser.$(OBJ): parser.c parser.h nasm.h regs.h insnsi.h regflags.c float.h \
163 preproc.$(OBJ): preproc.c nasm.h macros.c regs.h insnsi.h nasmlib.h \
165 regdis.$(OBJ): regdis.c
166 regflags.$(OBJ): regflags.c
168 regvals.$(OBJ): regvals.c
169 sync.$(OBJ): sync.c sync.h