makefile.dj1 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. # Makefile for Info-ZIP's unzip, zipinfo, funzip and unzipsfx
  2. # using djgpp v1.12m4. Tested with unzip550 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. # Separators colon and <sp> are used in U**X, semi-colon and <sp> in DOS.
  26. VPATH=. msdos
  27. ifdef NOASM
  28. USE_ASMCRC=
  29. else
  30. USE_ASMCRC=1
  31. endif
  32. # UnZip flags
  33. LOC=-DDOS $(ASMFLG) $(LOCAL_UNZIP)
  34. CC=gcc
  35. LD=$(CC)
  36. CPPFLAGS=-I. $(LOC)
  37. ASFLAGS=$(CPPFLAGS)
  38. CFLAGS=-Wall -O2 -m486 $(CPPFLAGS)
  39. FUN_FLAGS=$(CFLAGS) -DFUNZIP
  40. SFX_FLAGS=$(CFLAGS) -DSFX
  41. LDFLAGS=-s -v
  42. LIBS=-lpc
  43. STRIP=strip
  44. # Define the STANDALONE macro to create executables which can be
  45. # used without any external extender file.
  46. # >>> NOTE: Either copy the go32 extender into your build directory, or
  47. # >>> edit the STUBIFY macro and add the correct path to "go32.exe".
  48. ifdef STANDALONE
  49. STUBIFY=coff2exe -s go32.exe
  50. else
  51. STUBIFY=coff2exe
  52. endif
  53. # general-purpose stuff
  54. # If cp.exe is not found change to CP=copy /Y .
  55. CP = cp -f
  56. # If install.exe is not found change to INSTALL=$(CP) .
  57. INSTALL=install
  58. # The default value of RM is "rm -f" . If rm.exe is not found, uncomment
  59. # the following:
  60. RM=del
  61. E = .exe
  62. O = .o
  63. M=msdos
  64. # defaults for crc32 stuff and system dependent headers
  65. ifdef USE_ASMCRC
  66. ASMFLG = -DASM_CRC
  67. CRCA_O = crc_gcc$O
  68. else
  69. ASMFLG =
  70. CRCA_O =
  71. endif
  72. # object files
  73. OBJS1 = unzip$O crc32$O $(CRCA_O) crypt$O envargs$O explode$O
  74. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  75. OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
  76. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  77. OBJX1 = unzipsfx$O crc32_$O $(CRCA_O) crypt_$O extract_$O fileio_$O
  78. OBJX2 = globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
  79. OBJX = $(OBJX1) $(OBJX2)
  80. OBJF = funzip$O crc32-$O $(CRCA_O) crypt-$O globals-$O inflate-$O ttyio-$O
  81. OBJECTS_ALL = $(sort $(OBJS) $(OBJX) $(OBJF) crc_gcc$O)
  82. # Common header files included by all C sources:
  83. UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h
  84. # executable files
  85. UNZIPS = unzip$E zipinfo$E funzip$E unzipsfx$E
  86. # pattern rules to compile the sources:
  87. %$O : %.c
  88. $(CC) $(CFLAGS) -c $< -o $@
  89. %-$O: %.c
  90. $(CC) $(FUN_FLAGS) -c $< -o $@
  91. %_$O: %.c
  92. $(CC) $(SFX_FLAGS) -c $< -o $@
  93. %sfx$O: %.c
  94. $(CC) $(SFX_FLAGS) -c $< -o $@
  95. all: unzips
  96. unzips: unzip$E zipinfo$E funzip$E unzipsfx$E
  97. unzip$E: $(OBJS)
  98. ifdef LONGARGS
  99. $(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o unzip
  100. else
  101. echo $(OBJS1) > unzip.rsp
  102. echo $(OBJS2) >> unzip.rsp
  103. echo $(OBJS3) $M$O >> unzip.rsp
  104. echo $(LIBS) >> unzip.rsp
  105. $(LD) $(LDFLAGS) -o unzip @unzip.rsp
  106. $(RM) unzip.rsp
  107. endif
  108. $(STRIP) unzip
  109. $(STUBIFY) unzip
  110. stubedit $@ globbing=no
  111. $(RM) unzip
  112. zipinfo$E: unzip$E
  113. coff2exe -g zipinfo
  114. stubedit $@ runfile=unzip globbing=no
  115. funzip$E: $(OBJF)
  116. $(LD) $(LDFLAGS) $(OBJF) -o funzip
  117. $(STRIP) funzip
  118. $(STUBIFY) funzip
  119. $(RM) funzip
  120. unzipsfx$E: $(OBJX)
  121. ifdef LONGARGS
  122. $(LD) $(LDFLAGS) $(OBJX) $(LIBS) -o unzipsfx
  123. else
  124. echo $(OBJX1) > unzipsfx.rsp
  125. echo $(OBJX2) >> unzipsfx.rsp
  126. echo $(LIBS) >> unzipsfx.rsp
  127. $(LD) $(LDFLAGS) -o unzipsfx @unzipsfx.rsp
  128. $(RM) unzipsfx.rsp
  129. endif
  130. $(STRIP) unzipsfx
  131. $(STUBIFY) unzipsfx
  132. stubedit $@ globbing=no
  133. $(RM) unzipsfx
  134. # explicit compilation instructions:
  135. crc_gcc$O: crc_i386.S # 32bit, GNU AS
  136. $(CC) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  137. # BIN_PATH may be defined in djgpp.env [make] or defined above.
  138. install:
  139. $(INSTALL) $(UNZIPS) $(BIN_PATH)
  140. uninstall:
  141. cd $(BIN_PATH); $(RM) $(UNZIPS)
  142. clean:
  143. ifeq ($(firstword $(RM)), del)
  144. $(RM) *$O
  145. $(RM) *.zip
  146. else
  147. $(RM) $(OBJECTS_ALL) *.zip
  148. endif
  149. # Source dependencies:
  150. crc_gcc$O: crc_i386.S
  151. crc32$O: crc32.c $(UNZIP_H) zip.h crc32.h
  152. crc32-$O: crc32.c $(UNZIP_H) zip.h crc32.h
  153. crc32_$O: crc32.c $(UNZIP_H) zip.h crc32.h
  154. crypt$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  155. crypt-$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  156. crypt_$O: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  157. envargs$O: envargs.c $(UNZIP_H)
  158. explode$O: explode.c $(UNZIP_H)
  159. extract$O: extract.c $(UNZIP_H) crc32.h crypt.h
  160. extract_$O: extract.c $(UNZIP_H) crc32.h crypt.h
  161. fileio$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  162. fileio_$O: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  163. funzip$O: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
  164. globals$O: globals.c $(UNZIP_H)
  165. globals-$O: globals.c $(UNZIP_H)
  166. globals_$O: globals.c $(UNZIP_H)
  167. inflate$O: inflate.c inflate.h $(UNZIP_H)
  168. inflate-$O: inflate.c inflate.h $(UNZIP_H) crypt.h
  169. inflate_$O: inflate.c inflate.h $(UNZIP_H)
  170. list$O: list.c $(UNZIP_H)
  171. match$O: match.c $(UNZIP_H)
  172. match_$O: match.c $(UNZIP_H)
  173. msdos$O: msdos/msdos.c $(UNZIP_H)
  174. msdos_$O: msdos/msdos.c $(UNZIP_H)
  175. process$O: process.c $(UNZIP_H) crc32.h
  176. process_$O: process.c $(UNZIP_H) crc32.h
  177. ttyio$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  178. ttyio-$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  179. ttyio_$O: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  180. ubz2err$O: ubz2err.c $(UNZIP_H)
  181. ubz2err_$O: ubz2err.c $(UNZIP_H)
  182. unreduce$O: unreduce.c $(UNZIP_H)
  183. unshrink$O: unshrink.c $(UNZIP_H)
  184. unzip$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  185. unzipsfx$O: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  186. zipinfo$O: zipinfo.c $(UNZIP_H)