Subversion Repositories Kolibri OS

Rev

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

  1. # Makefile for UnZip(SFX) and fUnZip for Borland C++ 2.x-4.x and Turbo C++ 1.0
  2. # Version: 5.53 and later        Alvin Koh, Jim Knoble, Christian Spieler, etc.
  3. #
  4. # Last revised:  29 Dec 05
  5. #
  6. # To compile with Turbo C++ 1.0, set the macro CC_REV to 1 at the command line
  7. # (make -fmsdos/makefile.bc -DCC_REV=1).
  8.  
  9.  
  10. #    GNU make doesn't like the return value from "rem"
  11. #STRIP=rem
  12. STRIP=echo  Ignore this line.
  13. #    If you don't have UPX, LZEXE, or PKLITE, get one of them. Then define:
  14. #    (NOTE: upx needs a 386 or higher system to run the exe compressor)
  15. #STRIP=upx --8086 --best
  16. #    or
  17. #STRIP=lzexe
  18. #    or
  19. #STRIP=pklite
  20. #    This makes a big difference in .exe size (and possibly load time).
  21.  
  22.  
  23. #    Optional nonstandard preprocessor flags (as -DCHECK_EOF or -DDOS_WILD)
  24. #    should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added
  25. #    to the declaration of LOC here:
  26. LOC = $(LOCAL_UNZIP)
  27.  
  28. # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
  29. CPU_TYP = 0
  30.  
  31. # (De)Select inclusion of optimized assembler CRC32 routine:
  32. USE_ASMCRC = 1
  33.  
  34. !if $(CC_REV) == 1
  35. # Turbo C++ 1.0
  36. CC = tcc
  37. !else
  38. # Borland C++ 2.0, 3.0, 3.1 ...
  39. ! if !$(CC_REV)
  40. CC_REV = 3
  41. ! endif
  42. CC = bcc
  43. !endif
  44.  
  45. AS = tasm
  46.  
  47. # "near data" model is sufficient for UnZip and ZipInfo, now that strings moved
  48. # switched to medium model; UnZip code has grown beyond the 64k limit.
  49. # since 5.42: switched to large model; medium model requires to much memory
  50. # to compile zipinfo, reported for BC++ 4.51 and TC++ 1.0
  51. # (compilation worked with 624k DOS memory and TC++ 1.0, but that much free
  52. # space requires an almost "empty" DOS system)
  53. # for 5.5: large or compact model required for Deflate64 support
  54. UNMODEL = l             # large model for UnZip and ZipInfo
  55. ASUNMODEL=__LARGE__     # keep in sync with UNMODEL definition !!
  56.  
  57. FUMODEL = c             # need compact model for fUnZip with Deflate64 support
  58. ASFUMODEL=__COMPACT__   # keep in sync with FUMODEL definition !!
  59.  
  60. SXMODEL = s             # use small model for SFXUnZip (no Deflate64 support)
  61. ASSXMODEL=__SMALL__     # keep in sync with SXMODEL definition !!
  62.  
  63. !if $(USE_ASMCRC)
  64. ASMFLG = -DASM_CRC
  65. ASMOBJS = crc_i86.obj
  66. ASMOBJF = crc_i86_.obj
  67. ASMOBJX = crc_i86x.obj
  68. !else
  69. ASMFLG =
  70. ASMOBJS =
  71. ASMOBJF =
  72. ASMOBJX =
  73. !endif
  74.  
  75.  
  76. # compiler flags
  77.  
  78. ASCPUFLAG = __$(CPU_TYP)86
  79. !if $(CPU_TYP) != 0
  80. CC_CPUFLG = -$(CPU_TYP)
  81. !endif
  82. ASFLAGS = -ml -m2 -w0 -D$(ASCPUFLAG) $(LOC)
  83. !if $(CC_REV) == 1
  84. # Bug: TC ++ 1.0 ignores "far" on "const" strings, so const is disabled!
  85. CCOPTIM = -O -G -Z -a -d -DZCONST
  86. LDFLAGS = -lxncd                # for tcc
  87. !else
  88. CCOPTIM = -O2
  89. LDFLAGS = -lxncd -l-P           # for bcc
  90. !endif
  91. CFLAGS  = $(CCOPTIM) $(CC_CPUFLG) -ff- -k- -P-.C -I. $(ASMFLG) $(LOC)
  92. UNFLAGS = -m$(UNMODEL) $(CFLAGS)
  93. FUFLAGS = -m$(FUMODEL) $(CFLAGS) -K -d
  94. SXFLAGS = -m$(SXMODEL) $(CFLAGS)
  95.  
  96. # implicit rules
  97.  
  98. .asm.obj:
  99.         $(AS) $(ASFLAGS) -D$(ASUNMODEL) $<
  100.  
  101. .c.obj:
  102.         $(CC) -c $(UNFLAGS) {$< }
  103.  
  104. # list macros
  105.  
  106. OBJU1 = unzip.obj crc32.obj crypt.obj envargs.obj explode.obj
  107. OBJU2 = extract.obj fileio.obj globals.obj inflate.obj list.obj match.obj
  108. OBJU3 = process.obj ttyio.obj unreduce.obj unshrink.obj zipinfo.obj
  109. OBJUS = msdos.obj $(ASMOBJS)
  110. OBJU  = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJUS)
  111. OBJF  = funzip.obj crc32f.obj cryptf.obj globalsf.obj inflatef.obj \
  112.         ttyiof.obj msdosf.obj $(ASMOBJF)
  113. OBJX1 = unzipsfx.obj crc32x.obj cryptx.obj extractx.obj fileiox.obj
  114. OBJX2 = globalsx.obj inflatex.obj matchx.obj processx.obj ttyiox.obj
  115. OBJXS = msdosx.obj $(ASMOBJX)
  116. OBJX  = $(OBJX1) $(OBJX2) $(OBJXS)
  117.  
  118. UNZIP_H = unzip.h unzpriv.h globals.h msdos/doscfg.h
  119.  
  120. # explicit rules
  121.  
  122. all:    unzip.exe funzip.exe unzipsfx.exe
  123.  
  124. unzip.exe:      $(OBJU)
  125.         $(CC) -m$(UNMODEL) $(LDFLAGS) -eunzip.exe @&&|
  126. $(OBJU)
  127. |
  128.         $(STRIP) unzip.exe
  129.  
  130. funzip.exe:     $(OBJF)
  131.         $(CC) -m$(FUMODEL) $(LDFLAGS) -efunzip.exe @&&|
  132. $(OBJF)
  133. |
  134.         $(STRIP) funzip.exe
  135.  
  136. unzipsfx.exe:   $(OBJX)
  137.         $(CC) -m$(SXMODEL) $(LDFLAGS) -eunzipsfx.exe @&&|
  138. $(OBJX)
  139. |
  140.         $(STRIP) unzipsfx.exe
  141.  
  142. clean:
  143.         rem Ignore any errors in the following...
  144.         -del *.obj
  145.         -del unzip.exe
  146.         -del funzip.exe
  147.         -del unzipsfx.exe
  148.  
  149. # individual file dependencies
  150.  
  151. crc32.obj:      crc32.c $(UNZIP_H) zip.h crc32.h
  152. crypt.obj:      crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  153. envargs.obj:    envargs.c $(UNZIP_H)
  154. explode.obj:    explode.c $(UNZIP_H)
  155. extract.obj:    extract.c $(UNZIP_H) crc32.h crypt.h
  156. fileio.obj:     fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  157. globals.obj:    globals.c $(UNZIP_H)
  158. inflate.obj:    inflate.c inflate.h $(UNZIP_H)
  159. list.obj:       list.c $(UNZIP_H)
  160. match.obj:      match.c $(UNZIP_H)
  161. process.obj:    process.c $(UNZIP_H) crc32.h
  162. ttyio.obj:      ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  163. unreduce.obj:   unreduce.c $(UNZIP_H)
  164. unshrink.obj:   unshrink.c $(UNZIP_H)
  165. unzip.obj:      unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  166. zipinfo.obj:    zipinfo.c $(UNZIP_H)
  167.  
  168. crc_i86.obj:    msdos/crc_i86.asm
  169.         $(AS) $(ASFLAGS) -D$(ASUNMODEL) msdos\crc_i86.asm, $*.obj ;
  170.  
  171. crc_i86_.obj:   msdos/crc_i86.asm
  172.         $(AS) $(ASFLAGS) -D$(ASFUMODEL) msdos\crc_i86.asm, $*.obj ;
  173.  
  174. crc_i86x.obj:   msdos/crc_i86.asm
  175.         $(AS) $(ASFLAGS) -D$(ASSXMODEL) msdos\crc_i86.asm, $*.obj ;
  176.  
  177. msdos.obj:      msdos/msdos.c $(UNZIP_H)
  178.         $(CC) -c $(UNFLAGS) msdos/msdos.c
  179.  
  180. funzip.obj:     funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
  181.         $(CC) -c $(FUFLAGS) funzip.c
  182.  
  183. crc32f.obj:     crc32.c $(UNZIP_H) zip.h crc32.h
  184.         $(CC) -c $(FUFLAGS) -DFUNZIP -ocrc32f.obj crc32.c
  185.  
  186. cryptf.obj:     crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  187.         $(CC) -c $(FUFLAGS) -DFUNZIP -ocryptf.obj crypt.c
  188.  
  189. globalsf.obj:   globals.c $(UNZIP_H)
  190.         $(CC) -c $(FUFLAGS) -DFUNZIP -oglobalsf.obj globals.c
  191.  
  192. inflatef.obj:   inflate.c inflate.h $(UNZIP_H) crypt.h
  193.         $(CC) -c $(FUFLAGS) -DFUNZIP -oinflatef.obj inflate.c
  194.  
  195. ttyiof.obj:     ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  196.         $(CC) -c $(FUFLAGS) -DFUNZIP -ottyiof.obj ttyio.c
  197.  
  198. msdosf.obj:     msdos/msdos.c $(UNZIP_H)
  199.         $(CC) -c $(FUFLAGS) -DFUNZIP -omsdosf.obj msdos/msdos.c
  200.  
  201. unzipsfx.obj:   unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  202.         $(CC) -c $(SXFLAGS) -DSFX -ounzipsfx.obj unzip.c
  203.  
  204. crc32x.obj:     crc32.c $(UNZIP_H) zip.h crc32.h
  205.         $(CC) -c $(SXFLAGS) -DSFX -ocrc32x.obj crc32.c
  206.  
  207. cryptx.obj:     crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  208.         $(CC) -c $(SXFLAGS) -DSFX -ocryptx.obj crypt.c
  209.  
  210. extractx.obj:   extract.c $(UNZIP_H) crc32.h crypt.h
  211.         $(CC) -c $(SXFLAGS) -DSFX -oextractx.obj extract.c
  212.  
  213. fileiox.obj:    fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  214.         $(CC) -c $(SXFLAGS) -DSFX -ofileiox.obj fileio.c
  215.  
  216. globalsx.obj:   globals.c $(UNZIP_H)
  217.         $(CC) -c $(SXFLAGS) -DSFX -oglobalsx.obj globals.c
  218.  
  219. inflatex.obj:   inflate.c inflate.h $(UNZIP_H)
  220.         $(CC) -c $(SXFLAGS) -DSFX -oinflatex.obj inflate.c
  221.  
  222. matchx.obj:     match.c $(UNZIP_H)
  223.         $(CC) -c $(SXFLAGS) -DSFX -omatchx.obj match.c
  224.  
  225. processx.obj:   process.c $(UNZIP_H) crc32.h
  226.         $(CC) -c $(SXFLAGS) -DSFX -oprocessx.obj process.c
  227.  
  228. ttyiox.obj:     ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  229.         $(CC) -c $(SXFLAGS) -DSFX -ottyiox.obj ttyio.c
  230.  
  231. msdosx.obj:     msdos/msdos.c $(UNZIP_H)
  232.         $(CC) -c $(SXFLAGS) -DSFX -omsdosx.obj msdos/msdos.c
  233.