home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip540.zip / msdos / makefile.dj2 < prev    next >
Makefile  |  1997-09-30  |  7KB  |  216 lines

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