summaryrefslogtreecommitdiff
path: root/Mkfiles/Makefile.bc3
blob: a59b817d624eec30697e34238583ef0766429e16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# Makefile for the Netwide Assembler under 16-bit DOS (aimed at Borland C)
#
# The Netwide Assembler is copyright (C) 1996 Simon Tatham and
# Julian Hall. All rights reserved. The software is
# redistributable under the licence given in the file "Licence"
# distributed in the NASM archive.
#
# This Makefile compiles NASM and NDISASM for 16 bit DOS using Borland
# C++; tested with version 3.1.  It probably should work for any
# version of Turbo C++ or Borland C++ from version 3.0 upwards.
# For Turbo C++, replace "bcc" with "tcc", and replace "-O1" with "-O".
#
# Most everything is remarked, and explaned in full, it should be
# easy to convert it to another compiler. I tried to make the devision
# of information logical, and easy to follow.
#
# BEFORE YOU USE THIS MAKE FILE!!!
#
# Make sure the line below is set to the propper location of your standard
# Libaries, if not you'll get some errors. Make sure to keep the trailing
# backslash, as it's needed, and remeber to use \\ not \ as that will cause
# some errors.
#
# This Makefile was updated with NASM 0.98.31, and could compile that
# version correctly using Borland C++ 3.1 under DOS.
#

CC = bcc                #compiler
#compiler flags
CCFLAGS = -d -c -O1 -mh -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
  # -d  = merge dupicate strings
  # -c  = compile only
  # -O1 = optimise for size
  # -mh = model huge
  # -n  = put the OBJ files in the diectory given.

LINKFLAGS = -d -mh

LIBS =             	#any libaries to add, out side of the standard libary
EXE = .exe              #executable file extention (keep the . as the start)
OBJ = obj               #OBJ file extention
LIB = lib		#LIB file extension

# Compilation command line
NASM_ASM=$(CC) $(CCFLAGS) -o$*.$(OBJ) $*.c

################################################################
#The OBJ files that NASM is dependent on

NASMOBJS = nasm.$(OBJ)   nasmlib.$(OBJ)  float.$(OBJ)  \
	   insnsa.$(OBJ) assemble.$(OBJ) labels.$(OBJ) \
	   parser.$(OBJ) outform.$(OBJ)  preproc.$(OBJ) \
	   listing.$(OBJ) eval.$(OBJ)

################################################################
#The OBJ files that NDISASM is dependent on

NDISASMOBJS = ndisasm.$(OBJ)  disasm.$(OBJ) sync.$(OBJ) \
	      nasmlib.$(OBJ) insnsd.$(OBJ)

################################################################
# The OBJ file for the output formats we want to compile in.
# It doesn't make sense for 16-bit MS-DOS to include all formats.

OUTOBJ= output\\outbin.$(OBJ) output\\outaout.$(OBJ) output\\outcoff.$(OBJ) \
	output\\outelf.$(OBJ) output\\outobj.$(OBJ)  output\\outas86.$(OBJ) \
	output\\outrdf.$(OBJ) output\\outdbg.$(OBJ)  output\\outrdf2.$(OBJ) \
	output\\outieee.$(OBJ)


################################################################
# Build everything

all : nasm$(EXE) ndisasm$(EXE)

################################################################
# NASM, NDISASM link.  The &&!...! construct in Borland Make
# creates a temporary file and inserts its name on the command
# line.  It works around the DOS 127-character command line
# limit.

nasm$(EXE): $(NASMOBJS) output\\out.lib
	$(CC) $(LINKFLAGS) -onasm$(EXE) @&&!
$(NASMOBJS)
output\\out.lib
!

ndisasm$(EXE): $(NDISASMOBJS)
	$(CC) $(LINKFLAGS) -ondisasm$(EXE) @&&!
$(NDISASMOBJS)
!

################################################################
# Dependencies for all of NASM's obj files

assemble.$(OBJ): assemble.c nasm.h version.h insnsi.h assemble.h insns.h
	$(NASM_ASM)

float.$(OBJ): float.c nasm.h version.h insnsi.h
	$(NASM_ASM)

labels.$(OBJ): labels.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

listing.$(OBJ): listing.c nasm.h version.h insnsi.h nasmlib.h listing.h
	$(NASM_ASM)

eval.$(OBJ): eval.c nasm.h version.h insnsi.h nasmlib.h eval.h
	$(NASM_ASM)

nasm.$(OBJ): nasm.c nasm.h version.h insnsi.h nasmlib.h parser.h assemble.h labels.h \
		listing.h outform.h
	$(NASM_ASM)

nasmlib.$(OBJ): nasmlib.c nasm.h version.h insnsi.h nasmlib.h names.c insnsn.c
	$(NASM_ASM)

parser.$(OBJ): parser.c nasm.h version.h insnsi.h nasmlib.h parser.h float.h names.c insnsn.c
	$(NASM_ASM)

preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

insnsa.$(OBJ): insnsa.c nasm.h version.h insnsi.h insns.h
	$(NASM_ASM)

################################################################
# Dependencies for all of NDISASM's obj files

disasm.$(OBJ): disasm.c nasm.h version.h insnsi.h disasm.h sync.h insns.h names.c insnsn.c
	$(NASM_ASM)

ndisasm.$(OBJ): ndisasm.c nasm.h version.h insnsi.h sync.h disasm.h
	$(NASM_ASM)

sync.$(OBJ): sync.c sync.h
	$(NASM_ASM)

insnsd.$(OBJ): insnsd.c nasm.h version.h insnsi.h insns.h
	$(NASM_ASM)

################################################################
# Build the output formats as a library
# The & ... $? construct tells Borland Make to repeat for all
# out of date dependencies
output\\out.$(LIB): $(OUTOBJ)
	-del output\\out.$(LIB)
	for %a in (output\\*.obj) do tlib /C output\\out.$(LIB) +%a

################################################################
# Dependencies for all of the output format's OBJ files

output\\outas86.$(OBJ): output\\outas86.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outaout.$(OBJ): output\\outaout.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outbin.$(OBJ): output\\outbin.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outcoff.$(OBJ): output\\outcoff.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outdbg.$(OBJ): output\\outdbg.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outelf.$(OBJ): output\\outelf.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outobj.$(OBJ): output\\outobj.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outrdf.$(OBJ): output\\outrdf.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outrdf2.$(OBJ): output\\outrdf2.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

output\\outieee.$(OBJ): output\\outieee.c nasm.h version.h insnsi.h nasmlib.h
	$(NASM_ASM)

outform.$(OBJ): outform.c outform.h nasm.h version.h insnsi.h
	$(NASM_ASM)

################################################################
# A quick way to delete the OBJ files as well as the binaries.

clean :
	-del *.$(OBJ)
	-del output\\*.$(OBJ)
	-del output\\out.$(LIB)
	-del nasm$(EXE)
	-del ndisasm$(EXE)