Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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