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 CCFLAGS = -d -c -O1 -mh -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
31 # -d = merge dupicate strings
33 # -O1 = optimise for size
35 # -n = put the OBJ files in the diectory given.
39 LIBS = #any libaries to add, out side of the standard libary
40 EXE = .exe #executable file extention (keep the . as the start)
41 OBJ = obj #OBJ file extention
42 LIB = lib #LIB file extension
44 # Compilation command line
45 NASM_ASM=$(CC) $(CCFLAGS) -o$*.$(OBJ) $*.c
47 ################################################################
48 #The OBJ files that NASM is dependent on
50 NASMOBJS = nasm.$(OBJ) nasmlib.$(OBJ) float.$(OBJ) \
51 insnsa.$(OBJ) assemble.$(OBJ) labels.$(OBJ) \
52 parser.$(OBJ) outform.$(OBJ) preproc.$(OBJ) \
53 listing.$(OBJ) eval.$(OBJ)
55 ################################################################
56 #The OBJ files that NDISASM is dependent on
58 NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) \
59 nasmlib.$(OBJ) insnsd.$(OBJ)
61 ################################################################
62 # The OBJ file for the output formats we want to compile in.
63 # It doesn't make sense for 16-bit MS-DOS to include all formats.
65 OUTOBJ= output\\outbin.$(OBJ) output\\outaout.$(OBJ) output\\outcoff.$(OBJ) \
66 output\\outelf.$(OBJ) output\\outobj.$(OBJ) output\\outas86.$(OBJ) \
67 output\\outrdf.$(OBJ) output\\outdbg.$(OBJ) output\\outrdf2.$(OBJ) \
68 output\\outieee.$(OBJ)
71 ################################################################
74 all : nasm$(EXE) ndisasm$(EXE)
76 ################################################################
77 # NASM, NDISASM link. The &&!...! construct in Borland Make
78 # creates a temporary file and inserts its name on the command
79 # line. It works around the DOS 127-character command line
82 nasm$(EXE): $(NASMOBJS) output\\out.lib
83 $(CC) $(LINKFLAGS) -onasm$(EXE) @&&!
88 ndisasm$(EXE): $(NDISASMOBJS)
89 $(CC) $(LINKFLAGS) -ondisasm$(EXE) @&&!
93 ################################################################
94 # Dependencies for all of NASM's obj files
96 assemble.$(OBJ): assemble.c nasm.h version.h insnsi.h assemble.h insns.h
99 float.$(OBJ): float.c nasm.h version.h insnsi.h
102 labels.$(OBJ): labels.c nasm.h version.h insnsi.h nasmlib.h
105 listing.$(OBJ): listing.c nasm.h version.h insnsi.h nasmlib.h listing.h
108 eval.$(OBJ): eval.c nasm.h version.h insnsi.h nasmlib.h eval.h
111 nasm.$(OBJ): nasm.c nasm.h version.h insnsi.h nasmlib.h parser.h assemble.h labels.h \
115 nasmlib.$(OBJ): nasmlib.c nasm.h version.h insnsi.h nasmlib.h names.c insnsn.c
118 parser.$(OBJ): parser.c nasm.h version.h insnsi.h nasmlib.h parser.h float.h names.c insnsn.c
121 preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h version.h insnsi.h nasmlib.h
124 insnsa.$(OBJ): insnsa.c nasm.h version.h insnsi.h insns.h
127 ################################################################
128 # Dependencies for all of NDISASM's obj files
130 disasm.$(OBJ): disasm.c nasm.h version.h insnsi.h disasm.h sync.h insns.h names.c insnsn.c
133 ndisasm.$(OBJ): ndisasm.c nasm.h version.h insnsi.h sync.h disasm.h
136 sync.$(OBJ): sync.c sync.h
139 insnsd.$(OBJ): insnsd.c nasm.h version.h insnsi.h insns.h
142 ################################################################
143 # Build the output formats as a library
144 # The & ... $? construct tells Borland Make to repeat for all
145 # out of date dependencies
146 output\\out.$(LIB): $(OUTOBJ)
147 -del output\\out.$(LIB)
148 for %a in (output\\*.obj) do tlib /C output\\out.$(LIB) +%a
150 ################################################################
151 # Dependencies for all of the output format's OBJ files
153 output\\outas86.$(OBJ): output\\outas86.c nasm.h version.h insnsi.h nasmlib.h
156 output\\outaout.$(OBJ): output\\outaout.c nasm.h version.h insnsi.h nasmlib.h
159 output\\outbin.$(OBJ): output\\outbin.c nasm.h version.h insnsi.h nasmlib.h
162 output\\outcoff.$(OBJ): output\\outcoff.c nasm.h version.h insnsi.h nasmlib.h
165 output\\outdbg.$(OBJ): output\\outdbg.c nasm.h version.h insnsi.h nasmlib.h
168 output\\outelf.$(OBJ): output\\outelf.c nasm.h version.h insnsi.h nasmlib.h
171 output\\outobj.$(OBJ): output\\outobj.c nasm.h version.h insnsi.h nasmlib.h
174 output\\outrdf.$(OBJ): output\\outrdf.c nasm.h version.h insnsi.h nasmlib.h
177 output\\outrdf2.$(OBJ): output\\outrdf2.c nasm.h version.h insnsi.h nasmlib.h
180 output\\outieee.$(OBJ): output\\outieee.c nasm.h version.h insnsi.h nasmlib.h
183 outform.$(OBJ): outform.c outform.h nasm.h version.h insnsi.h
186 ################################################################
187 # A quick way to delete the OBJ files as well as the binaries.
191 -del output\\*.$(OBJ)
192 -del output\\out.$(LIB)