home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip531.zip / msdos / makefile.dj2 < prev    next >
Makefile  |  1996-11-10  |  6KB  |  208 lines

  1. # Makefile for Info-ZIP's UnZip, UnZipSFX and fUnZip using djgpp v2.0, by
  2. # Frank Donahoe.                                 Last updated:  10 Nov 96
  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 used:
  7. # - pattern rules (%.o : %.c, etc.)
  8. # - GNU-specific conditionals and functions  (ifeq, $(patsubst,,),...)
  9. #
  10. # The stand-alone executable requires DPMI services to run.  If running
  11. # in a DOS window under Windows 3.1 or later, the dpmi server is auto-
  12. # matically present.  Under DOS, if a DPMI server is not loaded, the
  13. # program will look for "cwsdpmi.exe."  If found, it will be loaded for
  14. # the duration of the program.
  15. #
  16. # cwsdpmi is a "free" dpmi server written by Charles W. Sandmann
  17. # (sandman@clio.rice.edu).  It may be found, among other sites, on SimTel
  18. # Net at the URL:
  19. #
  20. #   ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/csdpmi?[b,s].zip
  21. #
  22. # and on its mirrors worldwide.  The latest version as of this writing is 3.
  23. # Archives with the b postscript contain the binaries.  An alternate server
  24. # is found, l.c., in the archive pmode??[b,s].zip.  The latest (960908) is
  25. # v1.1.
  26.  
  27. # Separators colon and <sp> are used in Unix, semi-colon and <sp> in DOS.
  28. VPATH=. msdos
  29.  
  30. ifdef NOASM
  31. USE_ASMCRC=
  32. else
  33. USE_ASMCRC=1
  34. endif
  35.  
  36. # UnZip flags
  37. # LOCAL_UNZIP may be set in AUTOEXEC.BAT or defined in djgpp.env [make].
  38. # See, for example, DOSWILD, in the file INSTALL.
  39.  
  40. # [make]
  41. # LOCAL_UNZIP=-DDOSWILD
  42. # BUTT=-m486
  43.  
  44. # BUTT may also be defined to specify the target system.  At present, -m386
  45. # and -m486 are the only supported options.  Either will produce code which
  46. # will run on the other microprocessor, though possibly not so fast.
  47. # In any case, omitting BUTT will result in a slightly smaller executable.
  48.  
  49. LOC=-DDOS -DUSE_VFAT $(ASMFLG) $(LOCAL_UNZIP)
  50. CC=gcc
  51. LD=$(CC)
  52. CPPFLAGS=-I. $(LOC)
  53. ASFLAGS=$(CPPFLAGS)
  54. CFLAGS=-Wall -O2 $(BUTT) $(CPPFLAGS)
  55.  
  56. # See INSTALL for discussion of SFX_EXDIR.
  57. # EXDIR=-DSFX_EXDIR
  58.  
  59. FUN_FLAGS=$(CFLAGS) -DFUNZIP
  60.  
  61. # Include OFP for a modest decrease in size of unzipsfx.exe.
  62. OFP=-fomit-frame-pointer
  63.  
  64. SFX_FLAGS=-Wall -O2 $(CPPFLAGS) -DSFX $(EXDIR) $(OFP)
  65. LDFLAGS=-s
  66.  
  67. # general-purpose stuff
  68. # If cp.exe is not found change to CP=copy /Y    .
  69. CP = cp -f
  70. # If install.exe is not found change to INSTALL=$(CP)   .
  71. INSTALL=install
  72. # The default value of RM is "rm -f"  .  If rm.exe is not found, uncomment
  73. # the following:
  74. # RM=del
  75. # If "djp.exe," which is Laszlo Molnar's executable file packer, is in the
  76. # path, uncomment the three lines found far below containing $(DJP).  The
  77. # executable files will be converted to self-extracting compressed files.
  78. # Look for "djp.exe" in the directory v2misc in the archive mlp???b.zip.
  79. # Do not add the option -s to DJP without making the required changes to
  80. # the targets zipinfo$E and unzipsfx$E.
  81.  
  82. DJP = djp -bq
  83. E = .exe
  84. O = .o
  85. M=msdos
  86.  
  87. # defaults for crc32 stuff and system dependent headers
  88. ifdef USE_ASMCRC
  89. ASMFLG = -DASM_CRC
  90. CRC32 = crc_gcc
  91. else
  92. ASMFLG =
  93. CRC32 = crc32
  94. endif
  95.  
  96. # object files
  97. OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
  98. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  99. OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
  100. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  101.  
  102. OBJX = unzipsfx$O $(CRC32)$O crctab_$O crypt_$O extract_$O fileio_$O \
  103.     globals_$O inflate_$O match_$O process_$O ttyio_$O $M_$O
  104.  
  105. OBJF = funzip$O $(CRC32)$O crypt-$O globals-$O inflate-$O ttyio-$O
  106.  
  107. OBJECTS_ALL = $(sort $(OBJS) $(OBJX) $(OBJF) crc32$O crc_gcc$O)
  108.  
  109. # Common header files included by all C sources:
  110. UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h
  111.  
  112. # executable files
  113. UNZIPS = unzip$E zipinfo$E funzip$E unzipsfx$E
  114.  
  115. # pattern rules to compile the sources:
  116. %$O : %.c
  117.     $(CC) $(CFLAGS) -c $< -o $@
  118.  
  119. %-$O: %.c
  120.     $(CC) $(FUN_FLAGS) -c $< -o $@
  121.  
  122. %_$O: %.c
  123.     $(CC) $(SFX_FLAGS) -c $< -o $@
  124.  
  125. %sfx$O: %.c
  126.     $(CC) $(SFX_FLAGS) -c $< -o $@
  127.  
  128. all: unzips
  129.  
  130. unzips:    unzip$E zipinfo$E funzip$E unzipsfx$E
  131.  
  132. unzip$E: $(OBJS)
  133.     $(LD) $(LDFLAGS) $(OBJS) -o $@
  134. #    $(DJP) $@
  135.  
  136. zipinfo$E: unzip$E
  137.     stubify -g $@
  138.     stubedit $@ runfile=unzip argv0=zipinfo
  139.  
  140. funzip$E: $(OBJF)
  141.     $(LD) $(LDFLAGS) $(OBJF) -o $@
  142. #    $(DJP) $@
  143.  
  144. unzipsfx$E: $(OBJX)
  145.     $(LD) $(LDFLAGS) $(OBJX) -o $@
  146. #    $(DJP) -s $@
  147.  
  148. # explicit compilation instructions:
  149.  
  150. crc_gcc$O: crc_i386.S        # 32bit, GNU AS
  151.     $(CC) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  152.  
  153. # BIN_PATH may be defined in djgpp.env [make] or defined below.  If the
  154. # installation is to the directory containing gcc.exe etc. place the
  155. # following in djgpp.env:
  156.  
  157. # [make]
  158. # BIN_PATH=%\>;BIN_PATH%%\DJDIR%\bin
  159.  
  160. # Even if so placed, it can be over-ridden here by, say:
  161. # BIN_PATH=c:\usr\bin
  162.  
  163. install:  $(UNZIPS)
  164.     -@if not exist $(BIN_PATH)\nul mkdir $(BIN_PATH)
  165.     for %%f in ($(UNZIPS)) do $(INSTALL) %%f $(BIN_PATH)
  166.  
  167. uninstall:
  168.     for %%f in ($(UNZIPS)) do $(RM) $(BIN_PATH)\%%f
  169.  
  170. clean:
  171. ifeq ($(firstword $(RM)), del)
  172.     $(RM) *$O
  173.     $(RM) *.~
  174.     $(RM) *.exe
  175. else
  176.     $(RM) $(OBJECTS_ALL) *.~ *.exe
  177. endif
  178.  
  179. # Source dependencies:
  180. crc_gcc$O:      crc_i386.S
  181. crc32$O:        crc32.c $(UNZIP_H) zip.h
  182. crctab$O:       crctab.c $(UNZIP_H) zip.h
  183. crypt$O:        crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  184. crypt-$O:       crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  185. envargs$O:      envargs.c $(UNZIP_H)
  186. explode$O:      explode.c $(UNZIP_H)
  187. extract$O:      extract.c $(UNZIP_H) crypt.h
  188. extract_$O:     extract.c $(UNZIP_H) crypt.h
  189. fileio$O:       fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  190. funzip$O:       funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  191. globals$O:      globals.c $(UNZIP_H)
  192. globals-$O:     globals.c $(UNZIP_H)
  193. inflate$O:      inflate.c inflate.h $(UNZIP_H)
  194. inflate-$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  195. list$O:         list.c $(UNZIP_H)
  196. match$O:        match.c $(UNZIP_H)
  197. msdos$O:        msdos/msdos.c $(UNZIP_H)
  198. msdos_$O:       msdos/msdos.c $(UNZIP_H)
  199. process$O:      process.c $(UNZIP_H)
  200. process_$O:     process.c $(UNZIP_H)
  201. ttyio$O:        ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  202. ttyio-$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  203. unreduce$O:     unreduce.c $(UNZIP_H)
  204. unshrink$O:     unshrink.c $(UNZIP_H)
  205. unzip$O:        unzip.c $(UNZIP_H) crypt.h version.h consts.h
  206. unzipsfx$O:     unzip.c $(UNZIP_H) crypt.h version.h consts.h
  207. zipinfo$O:      zipinfo.c $(UNZIP_H)
  208.