summaryrefslogtreecommitdiff
path: root/Mkfiles/Makefile.bc2
blob: 69a376df68bcda0b33b85df8bd917c3d13052df6 (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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# 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 is made for compile NASM and NDISASM on a 16 bit dos
# compiler like Microsoft C, or Borland C. This should work on all
# verioson of Turbo C++ and Borland C++ from version 3.0 and upwords.
# I'm not fully sure how it will handel on Microsoft C, but all the
# switches are documented, and it shouldn't be a problem to change it
# over.
#
# It does show a few of my preferances, like putting the OBJ files
# in a seperate directory, but if you just set OBJD to '.', it will
# drop them all in the current directory (though you still need to
# make the directory it's self).
#
# 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.
#
# Also inportant, if you get a DGROUP error when you compile NASM, remove
# or comment out the 'NASMSize=l' line, and uncoment (remove the #) from the
# NASMSize=h line. Then run 'make Clean' to delete the object files. Then run
# make again to re-build NASM as huge.
#
# History:
# 06/13/97: * Added the EXED varable for the location to put the EXE files.
#           * Because different versions of Borland and Turbo C have
#             different GROUPings for the DGROUP, some version, when you
#             compile NASM, you will get a DGROUP overflow error, making it
#             so NASM has to be compiled as huge. As this isn't a constant
#             through systems (and apperently some version of Borland,
#             compileing as huge causes some errors) the NASMSize verable
#             has been added to spicify what size of code you want to
#             compile as and defaults to large.
# 06/16/97: * Added 'merge dupicate strings' to the options for compiles.

NASMSize=l              #Compile Nasm as Large
#NASMSize=h              #Compile Nasm as Huge

LIB =c:\\tc\\lib\\      #location standard libaries

OBJD=obj\\              #directory to put OBJ files in
EXED=.\                 #directory to put the EXE files.
CC = tcc                #compiler
LINK = tlink            #linker
CCFLAGS = /d /c /O /A /m$(NASMSize) /n$(OBJD) #compiler flags for NASM
  #/d=merge dupicate strings
  #/c=compile only
  #/O=Optimise jumps
  #/A=ANSI standard C
  #/m$(NASMSize>=the model to use
  #/n$(OBJD)= put the OBJ files in the diectory given.

DCCFLAGS = /d /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
  #/d=merge dupicate strings
  #/c=compile only
  #/O=Optimise jumps
  #/A=ANSI standard C
  #/mh=Model huge
  #/n$(OBJD)= put the OBJ files in the diectory given.
  #NOTE: Huge model is used, and the array in insnsd.c is large enough to
  #over size the d-group in large mode.

LINKFLAGS = /c /x       #linker flags
  #/c=case segnificance on symboles
  #/x=No map file at all

LIBRARIES =             #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

NASM_ASM=$(CC) $(CCFLAGS) $&.c         #Command line for NASM
DASM_ASM=$(CC) $(DCCFLAGS) $&.c        #command line for NDISASM

# NOTE: $& is used to create the file name, as it only gives the name it's
# self, where as using $* would have give the full path of the file it
# want's done. This becomes a problem if the OBJ files are in a seperate
# directory, becuse it will then try to find the source file in the OBJ
# dir.

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

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

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

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

################################################################
#The OBJ file for the output formats.

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


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

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

################################################################
#NASM, NDISASM compile, I hope it's self explanitorie

nasm$(EXE): $(NASMOBJS) $(OUTOBJ)
          $(LINK) $(LINKFLAGS) @&&^                     #command for the linker
          $(LIB)c0$(NASMSize).obj $(NASMOBJS) $(OUTOBJ) #OBJ file list
          $(EXED)nasm$(EXE)                             #EXE file name
# No need of a map file
          $(LIB)c$(NASMSize).lib $(LIBRARIES)           #Libaries needed
^

ndisasm$(EXE): $(NDISASMOBJS)
        $(LINK) $(LINKFLAGS) @&&^              #command for the linker
        $(LIB)c0h.obj $(NDISASMOBJS)           #OBJ file list
        $(EXED)ndisasm$(EXE)                   #EXE file name
# No need of a map file
        $(LIB)ch.lib $(LIBRARIES)              #Libaries needed
^

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

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

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

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

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

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

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

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

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

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

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

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

$(OBJD)disasm.$(OBJ): disasm.c nasm.h insnsi.h disasm.h sync.h insns.h names.c insnsn.c
        $(DASM_ASM)

$(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h insnsi.h sync.h disasm.h
        $(DASM_ASM)

$(OBJD)sync.$(OBJ): sync.c sync.h
        $(DASM_ASM)

$(OBJD)insnsd.$(OBJ): insnsd.c nasm.h insnsi.h insns.h
        $(DASM_ASM)

# This is a kludge from the word go, as we can't use the nasmlib.obj compiled
# for NASM, as it's could be the wrong model size, so we have to compile it
# again as huge to make sure.
#
# So as not to overwrite the nasmlib.obj for NASM (if it did, that
# could cause all kinds of problems) it compiles it into nasmlibd.obj.
#
# the -o... switch tells it the name to compile the obj file to, right here
# $(OBJD)nasmlibd.obj

$(OBJD)nasmlibd.$(OBJ): nasmlib.c nasm.h insnsi.h nasmlib.h
        $(CC) $(DCCFLAGS) -o$(OBJD)nasmlibd.obj nasmlib.c

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

$(OBJD)outas86.$(OBJ): outas86.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outaout.$(OBJ): outaout.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outbin.$(OBJ): outbin.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outcoff.$(OBJ): outcoff.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outdbg.$(OBJ): outdbg.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outelf.$(OBJ): outelf.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outobj.$(OBJ): outobj.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outrdf.$(OBJ): outrdf.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)outrdf2.$(OBJ): outrdf2.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

$(OBJD)zoutieee.$(OBJ): zoutieee.c nasm.h insnsi.h nasmlib.h
        $(NASM_ASM)

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

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

clean :
        del $(OBJD)*.obj
	del nasm$(EXE)
	del ndisasm$(EXE)

# Makefile created by Fox Cutter <lmb@comtch.iea.com> --01/27/97