mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
206 lines
6.9 KiB
Makefile
206 lines
6.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 seperat 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.
|
|
|
|
LIB =c:\\tc\\lib\\ #location standard libaries
|
|
|
|
OBJD=obj\\ #directory to put OBJ files in
|
|
CC = tcc #compiler
|
|
LINK = tlink #linker
|
|
CCFLAGS = /c /O /A /ml /n$(OBJD) #compiler flags for NASM
|
|
#/c=compile only
|
|
#/O=Optimise jumps
|
|
#/A=ANSI standard C
|
|
#/ml=Model Large
|
|
#/n$(OBJD)= put the OBJ files in the diectory given.
|
|
|
|
DCCFLAGS = /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
|
|
#/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 modle 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)
|
|
|
|
################################################################
|
|
#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)
|
|
|
|
|
|
################################################################
|
|
# 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)c0l.obj $(NASMOBJS) $(OUTOBJ) #OBJ file list,
|
|
nasm$(EXE) #EXE file name
|
|
# No need of a map file
|
|
$(LIB)cl.lib $(LIBRARIES) #Libaries needed
|
|
^
|
|
|
|
ndisasm$(EXE): $(NDISASMOBJS)
|
|
$(LINK) $(LINKFLAGS) @&&^ #command for the linker
|
|
$(LIB)c0h.obj $(NDISASMOBJS) #OBJ file list
|
|
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 assemble.h insns.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)float.$(OBJ): float.c nasm.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)labels.$(OBJ): labels.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)nasm.$(OBJ): nasm.c nasm.h nasmlib.h parser.h assemble.h labels.h
|
|
outform.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)nasmlib.$(OBJ): nasmlib.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)parser.$(OBJ): parser.c nasm.h nasmlib.h parser.h float.h names.c
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)insnsa.$(OBJ): insnsa.c nasm.h insns.h
|
|
$(NASM_ASM)
|
|
|
|
################################################################
|
|
# Dependencies for all of NDISASM's obj files
|
|
|
|
$(OBJD)disasm.$(OBJ): disasm.c nasm.h disasm.h sync.h insns.h names.c
|
|
$(DASM_ASM)
|
|
|
|
$(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h sync.h disasm.h
|
|
$(DASM_ASM)
|
|
|
|
$(OBJD)sync.$(OBJ): sync.c sync.h
|
|
$(DASM_ASM)
|
|
|
|
$(OBJD)insnsd.$(OBJ): insnsd.c nasm.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 the wrong model size, so we have to compile it again,
|
|
# but in huge.
|
|
#
|
|
# So as not to overwrite the nasmlib.obj for NASM (if I 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 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 nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outaout.$(OBJ): outaout.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outbin.$(OBJ): outbin.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outcoff.$(OBJ): outcoff.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outdbg.$(OBJ): outdbg.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outelf.$(OBJ): outelf.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outobj.$(OBJ): outobj.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outrdf.$(OBJ): outrdf.c nasm.h nasmlib.h
|
|
$(NASM_ASM)
|
|
|
|
$(OBJD)outform.$(OBJ): outform.c outform.h nasm.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/21/97
|