home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip532.zip / msdos / makefile.dj1 < prev    next >
Makefile  |  1996-03-21  |  6KB  |  203 lines

  1. # Makefile for Info-ZIP's unzip, zipinfo, funzip and unzipsfx
  2. # using djgpp v1.12m4.  Tested with unz520p by Christian Spieler
  3. #
  4. # This Makefile is specifically tailored for GNU Make and GNU C and
  5. # may not work with a generic UNIX compatible Make utility.
  6. # Features use:
  7. # - pattern rules (%.o : %.c, etc.)
  8. # - GNUMake conditionals and functions  (ifeq, $(patsubst,,),...)
  9. #
  10. # To allow mixed use of real mode (16bit) vs. GO32 (32bit protected mode)
  11. # GNUMake utility and GCC driver, precautions have been taken to
  12. # limit command lines to the DOS 126 bytes limit.
  13. # In case you have an environment that supports long command lines
  14. # at all "interface" levels (e.g.: DJGPPv1 Gmake 3.71 and GO32 gcc.exe),
  15. # you may define the Makefile macro LONGARGS to take advantage of the
  16. # "long command lines" capability.
  17. # I have archived the fastest compilation (with LONGARGS support!) by
  18. # using both a real mode gnumake (private port) and the real mode
  19. # gcc.exe driver.
  20. #
  21. # The Makefile allows the optional creation of standalone exectutables.
  22. # This has the advantage that unzip.exe does not rely on any other file,
  23. # but results in much larger executables.
  24. #
  25.  
  26. # Separators colon and <sp> are used in U**X, semi-colon and <sp> in DOS.
  27. VPATH=. msdos
  28.  
  29. ifdef NOASM
  30. USE_ASMCRC=
  31. else
  32. USE_ASMCRC=1
  33. endif
  34.  
  35. # UnZip flags
  36. LOC=-DDOS $(ASMFLG) $(LOCAL_UNZIP)
  37. CC=gcc
  38. LD=$(CC)
  39. CPPFLAGS=-I. $(LOC)
  40. ASFLAGS=$(CPPFLAGS)
  41. CFLAGS=-Wall -O2 -m486 $(CPPFLAGS)
  42. FUN_FLAGS=$(CFLAGS) -DFUNZIP
  43. SFX_FLAGS=$(CFLAGS) -DSFX
  44. LDFLAGS=-s -v
  45.  
  46. STRIP=strip
  47.  
  48. # Define the STANDALONE macro to create executables which can be
  49. # used without any external extender file.
  50. # >>> NOTE: Either copy the go32 extender into your build directory, or
  51. # >>>       edit the STUBIFY macro and add the correct path to "go32.exe".
  52. ifdef STANDALONE
  53. STUBIFY=coff2exe -s go32.exe
  54. else
  55. STUBIFY=coff2exe
  56. endif
  57.  
  58. # general-purpose stuff
  59. # If cp.exe is not found change to CP=copy /Y    .
  60. CP = cp -f
  61. # If install.exe is not found change to INSTALL=$(CP)   .
  62. INSTALL=install
  63. # The default value of RM is "rm -f"  .  If rm.exe is not found, uncomment
  64. # the following:
  65. RM=del
  66. E = .exe
  67. O = .o
  68. M=msdos
  69.  
  70. # defaults for crc32 stuff and system dependent headers
  71. ifdef USE_ASMCRC
  72. ASMFLG = -DASM_CRC
  73. CRC32 = crc_gcc
  74. else
  75. ASMFLG =
  76. CRC32 = crc32
  77. endif
  78.  
  79. # object files
  80. OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
  81. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  82. OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
  83. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  84.  
  85. OBJX1 = unzipsfx$O $(CRC32)$O crctab$O crypt$O extract_$O fileio$O globals$O
  86. OBJX2 =    inflate$O match$O process_$O ttyio$O $M_$O
  87. OBJX = $(OBJX1) $(OBJX2)
  88.  
  89. OBJF = funzip$O $(CRC32)$O crypt-$O globals-$O inflate-$O ttyio-$O
  90.  
  91. OBJECTS_ALL = $(sort $(OBJS) $(OBJX) $(OBJF) crc32$O crc_gcc$O)
  92.  
  93. # Common header files included by all C sources:
  94. UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h
  95.  
  96. # executable files
  97. UNZIPS = unzip$E zipinfo$E funzip$E unzipsfx$E
  98.  
  99. # pattern rules to compile the sources:
  100. %$O : %.c
  101.     $(CC) $(CFLAGS) -c $< -o $@
  102.  
  103. %-$O: %.c
  104.     $(CC) $(FUN_FLAGS) -c $< -o $@
  105.  
  106. %_$O: %.c
  107.     $(CC) $(SFX_FLAGS) -c $< -o $@
  108.  
  109. %sfx$O: %.c
  110.     $(CC) $(SFX_FLAGS) -c $< -o $@
  111.  
  112. all: unzips
  113.  
  114. unzips:    unzip$E zipinfo$E funzip$E unzipsfx$E
  115.  
  116. unzip$E: $(OBJS)
  117. ifdef LONGARGS
  118.     $(LD) $(LDFLAGS) $(OBJS) -o unzip
  119. else
  120.     echo $(OBJS1) > unzip.rsp
  121.     echo $(OBJS2) >> unzip.rsp
  122.     echo $(OBJS3) $M$O >> unzip.rsp
  123.     $(LD) $(LDFLAGS) -o unzip @unzip.rsp
  124.     $(RM) unzip.rsp
  125. endif
  126.     $(STRIP) unzip
  127.     $(STUBIFY) unzip
  128.     stubedit $@ globbing=no
  129.     $(RM) unzip
  130.  
  131. zipinfo$E: unzip$E
  132.     coff2exe -g zipinfo
  133.     stubedit $@ runfile=unzip globbing=no
  134.  
  135. funzip$E: $(OBJF)
  136.     $(LD) $(LDFLAGS) $(OBJF) -o funzip
  137.     $(STRIP) funzip
  138.     $(STUBIFY) funzip
  139.     $(RM) funzip
  140.  
  141. unzipsfx$E: $(OBJX)
  142. ifdef LONGARGS
  143.     $(LD) $(LDFLAGS) $(OBJX) -o unzipsfx
  144. else
  145.     echo $(OBJX1) > unzipsfx.rsp
  146.     echo $(OBJX2) >> unzipsfx.rsp
  147.     $(LD) $(LDFLAGS) -o unzipsfx @unzipsfx.rsp
  148.     $(RM) unzipsfx.rsp
  149. endif
  150.     $(STRIP) unzipsfx
  151.     $(STUBIFY) unzipsfx
  152.     stubedit $@ globbing=no
  153.     $(RM) unzipsfx
  154.  
  155. # explicit compilation instructions:
  156. crc_gcc$O: crc_i386.S        # 32bit, GNU AS
  157.     $(CC) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  158.  
  159. # BIN_PATH may be defined in djgpp.env [make] or defined above.
  160. install:
  161.     $(INSTALL) $(UNZIPS) $(BIN_PATH)
  162.  
  163. uninstall:
  164.     cd $(BIN_PATH); $(RM) $(UNZIPS)
  165.  
  166. clean:
  167. ifeq ($(firstword $(RM)), del)
  168.     $(RM) *$O
  169.     $(RM) *.zip
  170. else
  171.     $(RM) $(OBJECTS_ALL) *.zip
  172. endif
  173.  
  174. # Source dependencies:
  175. crc_gcc$O:      crc_i386.S
  176. crc32$O:        crc32.c $(UNZIP_H) zip.h
  177. crctab$O:       crctab.c $(UNZIP_H) zip.h
  178. crypt$O:        crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  179. crypt-$O:       crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  180. envargs$O:      envargs.c $(UNZIP_H)
  181. explode$O:      explode.c $(UNZIP_H)
  182. extract$O:      extract.c $(UNZIP_H) crypt.h
  183. extract_$O:     extract.c $(UNZIP_H) crypt.h
  184. fileio$O:       fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  185. funzip$O:       funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  186. globals$O:      globals.c $(UNZIP_H)
  187. globals-$O:     globals.c $(UNZIP_H)
  188. inflate$O:      inflate.c inflate.h $(UNZIP_H)
  189. inflate-$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  190. list$O:         list.c $(UNZIP_H)
  191. match$O:        match.c $(UNZIP_H)
  192. msdos$O:        msdos/msdos.c $(UNZIP_H)
  193. msdos_$O:       msdos/msdos.c $(UNZIP_H)
  194. process$O:      process.c $(UNZIP_H)
  195. process_$O:     process.c $(UNZIP_H)
  196. ttyio$O:        ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  197. ttyio-$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  198. unreduce$O:     unreduce.c $(UNZIP_H)
  199. unshrink$O:     unshrink.c $(UNZIP_H)
  200. unzip$O:        unzip.c $(UNZIP_H) crypt.h version.h consts.h
  201. unzipsfx$O:     unzip.c $(UNZIP_H) crypt.h version.h consts.h
  202. zipinfo$O:      zipinfo.c $(UNZIP_H)
  203.