nasm/Mkfiles/Makefile.bc2
H. Peter Anvin 41bf8002b2 NASM 0.98
2002-04-30 20:58:18 +00:00

245 lines
8.9 KiB
Makefile

# 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