home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nasm097s.zip / MAKEFILE.BC2 < prev    next >
Text File  |  1997-10-01  |  9KB  |  239 lines

  1. # Makefile for the Netwide Assembler under 16-bit DOS (aimed at Borland C)
  2. #
  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.
  7. #
  8. # This makefile is made for compile NASM and NDISASM on a 16 bit dos
  9. # compiler like Microsoft C, or Borland C. This should work on all
  10. # verioson of Turbo C++ and Borland C++ from version 3.0 and upwords.
  11. # I'm not fully sure how it will handel on Microsoft C, but all the
  12. # switches are documented, and it shouldn't be a problem to change it
  13. # over.
  14. #
  15. # It does show a few of my preferances, like putting the OBJ files
  16. # in a seperat directory, but if you just set OBJD to '.', it will
  17. # drop them all in the current directory (though you still need to
  18. # make the directory it's self).
  19. #
  20. # Most everything is remarked, and explaned in full, it should be
  21. # easy to convert it to another compiler. I tried to make the devision
  22. # of information logical, and easy to follow.
  23. #
  24. # BEFORE YOU USE THIS MAKE FILE!!!
  25. #
  26. # Make sure the line below is set to the propper location of your standard
  27. # Libaries, if not you'll get some errors. Make sure to keep the trailing
  28. # backslash, as it's needed, and remeber to use \\ not \ as that will cause
  29. # some errors.
  30. #
  31. # Also inportant, if you get a DGROUP error when you compile NASM, remove
  32. # or comment out the 'NASMSize=l' line, and uncoment (remove the #) from the
  33. # NASMSize=h line. Then run 'make Clean' to delete the object files. Then run
  34. # make again to re-build NASM as huge.
  35. #
  36. # History:
  37. # 06/13/97: * Added the EXED varable for the location to put the EXE files.
  38. #           * Because different versions of Borland and Turbo C have
  39. #             different GROUPings for the DGROUP, some version, when you
  40. #             compile NASM, you will get a DGROUP overflow error, making it
  41. #             so NASM has to be compiled as huge. As this isn't a constant
  42. #             through systems (and apperently some version of Borland,
  43. #             compileing as huge causes some errors) the NASMSize verable
  44. #             has been added to spicify what size of code you want to
  45. #             compile as and defaults to large.
  46. # 06/16/97: * Added 'merge dupicate strings' to the options for compiles.
  47.  
  48. NASMSize=l              #Compile Nasm as Large
  49. #NASMSize=h              #Compile Nasm as Huge
  50.  
  51. LIB =c:\\tc\\lib\\      #location standard libaries
  52.  
  53. OBJD=obj\\              #directory to put OBJ files in
  54. EXED=.\                 #directory to put the EXE files.
  55. CC = tcc                #compiler
  56. LINK = tlink            #linker
  57. CCFLAGS = /d /c /O /A /m$(NASMSize) /n$(OBJD) #compiler flags for NASM
  58.   #/d=merge dupicate strings
  59.   #/c=compile only
  60.   #/O=Optimise jumps
  61.   #/A=ANSI standard C
  62.   #/m$(NASMSize>=the model to use
  63.   #/n$(OBJD)= put the OBJ files in the diectory given.
  64.  
  65. DCCFLAGS = /d /c /O /A /mh /n$(OBJD) #compiler flags for NDISASM
  66.   #/d=merge dupicate strings
  67.   #/c=compile only
  68.   #/O=Optimise jumps
  69.   #/A=ANSI standard C
  70.   #/mh=Model huge
  71.   #/n$(OBJD)= put the OBJ files in the diectory given.
  72.   #NOTE: Huge model is used, and the array in insnsd.c is large enough to
  73.   #over size the d-group in large mode.
  74.  
  75. LINKFLAGS = /c /x       #linker flags
  76.   #/c=case segnificance on symboles
  77.   #/x=No map file at all
  78.  
  79. LIBRARIES =             #any libaries to add, out side of the standard libary
  80. EXE = .exe              #executable file extention (keep the . as the start)
  81. OBJ = obj               #OBJ file extention
  82.  
  83. NASM_ASM=$(CC) $(CCFLAGS) $&.c         #Command line for NASM
  84. DASM_ASM=$(CC) $(DCCFLAGS) $&.c        #command line for NDISASM
  85.  
  86. # NOTE: $& is used to create the file name, as it only gives the name it's
  87. # self, where as using $* would have give the full path of the file it
  88. # want's done. This becomes a problem if the OBJ files are in a seperate
  89. # directory, becuse it will then try to find the source file in the OBJ
  90. # dir.
  91.  
  92. ################################################################
  93. #The OBJ files that NASM is dependent on
  94.  
  95. NASMOBJS = $(OBJD)nasm.$(OBJ)   $(OBJD)nasmlib.$(OBJ)  $(OBJD)float.$(OBJ)  \
  96.            $(OBJD)insnsa.$(OBJ) $(OBJD)assemble.$(OBJ) $(OBJD)labels.$(OBJ) \
  97.            $(OBJD)parser.$(OBJ) $(OBJD)outform.$(OBJ)  $(OBJD)preproc.$(OBJ) \
  98.        $(OBJD)listing.$(OBJ) $(OBJD)eval.$(OBJ)
  99.  
  100. ################################################################
  101. #The OBJ files that NDISASM is dependent on
  102.  
  103. NDISASMOBJS = $(OBJD)ndisasm.$(OBJ)  $(OBJD)disasm.$(OBJ) $(OBJD)sync.$(OBJ) \
  104.               $(OBJD)nasmlibd.$(OBJ) $(OBJD)insnsd.$(OBJ)
  105.  
  106. ################################################################
  107. #The OBJ file for the output formats.
  108.  
  109. OUTOBJ= $(OBJD)outbin.$(OBJ) $(OBJD)outaout.$(OBJ) $(OBJD)outcoff.$(OBJ) \
  110.         $(OBJD)outelf.$(OBJ) $(OBJD)outobj.$(OBJ)  $(OBJD)outas86.$(OBJ) \
  111.         $(OBJD)outrdf.$(OBJ) $(OBJD)outdbg.$(OBJ)
  112.  
  113.  
  114. ################################################################
  115. # Build everything
  116.  
  117. all : nasm$(EXE) ndisasm$(EXE)
  118.  
  119. ################################################################
  120. #NASM, NDISASM compile, I hope it's self explanitorie
  121.  
  122. nasm$(EXE): $(NASMOBJS) $(OUTOBJ)
  123.           $(LINK) $(LINKFLAGS) @&&^                     #command for the linker
  124.           $(LIB)c0$(NASMSize).obj $(NASMOBJS) $(OUTOBJ) #OBJ file list
  125.           $(EXED)nasm$(EXE)                             #EXE file name
  126. # No need of a map file
  127.           $(LIB)c$(NASMSize).lib $(LIBRARIES)           #Libaries needed
  128. ^
  129.  
  130. ndisasm$(EXE): $(NDISASMOBJS)
  131.         $(LINK) $(LINKFLAGS) @&&^              #command for the linker
  132.         $(LIB)c0h.obj $(NDISASMOBJS)           #OBJ file list
  133.         $(EXED)ndisasm$(EXE)                   #EXE file name
  134. # No need of a map file
  135.         $(LIB)ch.lib $(LIBRARIES)              #Libaries needed
  136. ^
  137.  
  138. ################################################################
  139. # Dependencies for all of NASM's obj files
  140.  
  141. $(OBJD)assemble.$(OBJ): assemble.c nasm.h assemble.h insns.h
  142.         $(NASM_ASM)
  143.  
  144. $(OBJD)float.$(OBJ): float.c nasm.h
  145.         $(NASM_ASM)
  146.  
  147. $(OBJD)labels.$(OBJ): labels.c nasm.h nasmlib.h
  148.         $(NASM_ASM)
  149.  
  150. $(OBJD)listing.$(OBJ): listing.c nasm.h nasmlib.h listing.h
  151.         $(NASM_ASM)
  152.  
  153. $(OBJD)eval.$(OBJ): eval.c nasm.h nasmlib.h eval.h
  154.         $(NASM_ASM)
  155.  
  156. $(OBJD)nasm.$(OBJ): nasm.c nasm.h nasmlib.h parser.h assemble.h labels.h \
  157.         listing.h outform.h
  158.         $(NASM_ASM)
  159.  
  160. $(OBJD)nasmlib.$(OBJ): nasmlib.c nasm.h nasmlib.h
  161.         $(NASM_ASM)
  162.  
  163. $(OBJD)parser.$(OBJ): parser.c nasm.h nasmlib.h parser.h float.h names.c
  164.         $(NASM_ASM)
  165.  
  166. $(OBJD)preproc.$(OBJ): preproc.c macros.c preproc.h nasm.h nasmlib.h
  167.     $(NASM_ASM)
  168.  
  169. $(OBJD)insnsa.$(OBJ): insnsa.c nasm.h insns.h
  170.         $(NASM_ASM)
  171.  
  172. ################################################################
  173. # Dependencies for all of NDISASM's obj files
  174.  
  175. $(OBJD)disasm.$(OBJ): disasm.c nasm.h disasm.h sync.h insns.h names.c
  176.         $(DASM_ASM)
  177.  
  178. $(OBJD)ndisasm.$(OBJ): ndisasm.c nasm.h sync.h disasm.h
  179.         $(DASM_ASM)
  180.  
  181. $(OBJD)sync.$(OBJ): sync.c sync.h
  182.         $(DASM_ASM)
  183.  
  184. $(OBJD)insnsd.$(OBJ): insnsd.c nasm.h insns.h
  185.         $(DASM_ASM)
  186.  
  187. # This is a kludge from the word go, as we can't use the nasmlib.obj compiled
  188. # for NASM, as it's could be the wrong model size, so we have to compile it
  189. # again as huge to make sure.
  190. #
  191. # So as not to overwrite the nasmlib.obj for NASM (if it did, that
  192. # could cause all kinds of problems) it compiles it into nasmlibd.obj.
  193. #
  194. # the -o... switch tells it the name to compile the obj file to, right here
  195. # $(OBJD)nasmlibd.obj
  196.  
  197. $(OBJD)nasmlibd.$(OBJ): nasmlib.c nasm.h nasmlib.h
  198.         $(CC) $(DCCFLAGS) -o$(OBJD)nasmlibd.obj nasmlib.c
  199.  
  200. ################################################################
  201. # Dependencies for all of the output format's OBJ files
  202.  
  203. $(OBJD)outas86.$(OBJ): outas86.c nasm.h nasmlib.h
  204.         $(NASM_ASM)
  205.  
  206. $(OBJD)outaout.$(OBJ): outaout.c nasm.h nasmlib.h
  207.         $(NASM_ASM)
  208.  
  209. $(OBJD)outbin.$(OBJ): outbin.c nasm.h nasmlib.h
  210.         $(NASM_ASM)
  211.  
  212. $(OBJD)outcoff.$(OBJ): outcoff.c nasm.h nasmlib.h
  213.         $(NASM_ASM)
  214.  
  215. $(OBJD)outdbg.$(OBJ): outdbg.c nasm.h nasmlib.h
  216.         $(NASM_ASM)
  217.  
  218. $(OBJD)outelf.$(OBJ): outelf.c nasm.h nasmlib.h
  219.         $(NASM_ASM)
  220.  
  221. $(OBJD)outobj.$(OBJ): outobj.c nasm.h nasmlib.h
  222.         $(NASM_ASM)
  223.  
  224. $(OBJD)outrdf.$(OBJ): outrdf.c nasm.h nasmlib.h
  225.         $(NASM_ASM)
  226.  
  227. $(OBJD)outform.$(OBJ): outform.c outform.h nasm.h
  228.         $(NASM_ASM)
  229.  
  230. ################################################################
  231. # A quick way to delete the OBJ files as well as the binaries.
  232.  
  233. clean :
  234.         del $(OBJD)*.obj
  235.     del nasm$(EXE)
  236.     del ndisasm$(EXE)
  237.  
  238. # Makefile created by Fox Cutter <lmb@comtch.iea.com> --01/27/97
  239.