Subversion Repositories Kolibri OS

Rev

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

  1. # Makefile for UnZip, fUnZip and UnZipSFX
  2. # for emx 0.9c / gcc under MS-DOS. Derived from makefile.os2
  3. # By E-Yen Tan (with mods by Christian Spieler).
  4. # Last updated 25 December 2006 (Christian Spieler).
  5. #
  6. # This makefile should work fine with GNU make and hopefully some others.
  7. # Tested with GNU make 3.71 gnuish 16-bit and djgpp 32-bit versions.
  8.  
  9. #ifdef NOASM
  10. #AS_FLAGS =
  11. #else
  12. AS_FLAGS = -DASM_CRC
  13. #endif
  14.  
  15. CP=copy
  16. RM=del
  17.  
  18. CC=gcc -O -I. -m486
  19.  
  20. # Version 5.1 of the RSX extender provides long file name support under
  21. # Windows 95. If you don't have Windows 95 or use a version of RSX prior
  22. # to 5.1 (or simply don't want LFN support) remove -DUSE_VFAT from CFLAGS.
  23. # Note that if you have a version of RSX prior to 5.1, you can still compile
  24. # with USE_VFAT enabled and upgrade RSX.EXE at a later stage.
  25. #
  26. # If you enable USE_VFAT then long file names under plain DOS will simply be
  27. # truncated to 8.3 format without mapping. See doscfg.h for details.
  28. #
  29. CFLAGS=-Wall -DMSDOS $(AS_FLAGS) $(LOCAL_UNZIP) -DUSE_VFAT
  30. NFLAGS=
  31. DLLFLAG=
  32. AS=gcc
  33. ASFLAGS=-Di386
  34. LDFLAGS=-o ./
  35. LDFLAGS2=-Zsmall-conv -s
  36. OUT=-o
  37. OBJ=.o
  38.  
  39. #ifdef NOASM
  40. #CRCA_O=
  41. #else
  42. CRCA_O=crc_gcc$(OBJ)
  43. #endif
  44. OBJUS=msdos$(OBJ)
  45. OBJXS=msdos_$(OBJ)
  46. OSDEP_H=msdos/doscfg.h
  47.  
  48.  
  49. # default settings for target dependent macros:
  50. DIRSEP = /
  51. AS_DIRSEP = /
  52.  
  53. OBJU1 = unzip$(OBJ) crc32$(OBJ) $(CRCA_O) crypt$(OBJ) envargs$(OBJ)
  54. OBJU2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ)
  55. OBJU3 = inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ)
  56. OBJU4 = ubz2err$(OBJ) unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
  57. OBJU  = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJU4) $(OBJUS)
  58. OBJX1 = unzipsf_$(OBJ) crc32_$(OBJ) $(CRCA_O) crypt_$(OBJ)
  59. OBJX2 = extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ)
  60. OBJX3 = match_$(OBJ) process_$(OBJ) ttyio_$(OBJ) ubz2err_$(OBJ)
  61. OBJX  = $(OBJX1) $(OBJX2) $(OBJX3) $(OBJXS)
  62. OBJF  = funzip$(OBJ) crc32f$(OBJ) $(CRCA_O) cryptf$(OBJ) inflatef$(OBJ) \
  63.         globalsf$(OBJ) ttyiof$(OBJ)
  64.  
  65. UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
  66.  
  67. # rules
  68.  
  69. .SUFFIXES:      .c $(OBJ)
  70.  
  71. .c$(OBJ):
  72.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ $<
  73.  
  74. # targets
  75.  
  76. all:    unzip.exe funzip.exe unzipsfx.exe
  77.  
  78. # This next bit is nasty, but is needed to overcome the MS-DOS command
  79. # line limit as response files for emx's gcc seem to only work if each
  80. # file is on a different line. DJGPP doesn't do this (if you are at all
  81. # interested).
  82.  
  83. unzip.exe: $(OBJU)
  84.         @ echo off
  85. #       -@ $(RM) unzip.rsp
  86. #       @ for %f in ($(OBJU1)) do echo %f >> unzip.rsp
  87. #       @ for %f in ($(OBJU2)) do echo %f >> unzip.rsp
  88. #       @ for %f in ($(OBJU3)) do echo %f >> unzip.rsp
  89. #       @ for %f in ($(OBJU4) $(OBJUS)) do echo %f >> unzip.rsp
  90.         @ echo unzip$(OBJ) > unzip.rsp
  91.         @ echo crc32$(OBJ)  >> unzip.rsp
  92.         @ if not "$(CRCA_O)"=="" echo $(CRCA_O)  >> unzip.rsp
  93.         @ echo crypt$(OBJ)  >> unzip.rsp
  94.         @ echo envargs$(OBJ)  >> unzip.rsp
  95.         @ echo explode$(OBJ)  >> unzip.rsp
  96.         @ echo extract$(OBJ)  >> unzip.rsp
  97.         @ echo fileio$(OBJ)  >> unzip.rsp
  98.         @ echo globals$(OBJ)  >> unzip.rsp
  99.         @ echo inflate$(OBJ)  >> unzip.rsp
  100.         @ echo list$(OBJ)  >> unzip.rsp
  101.         @ echo match$(OBJ)  >> unzip.rsp
  102.         @ echo process$(OBJ)  >> unzip.rsp
  103.         @ echo ttyio$(OBJ)  >> unzip.rsp
  104.         @ echo ubz2err$(OBJ)  >> unzip.rsp
  105.         @ echo unreduce$(OBJ)  >> unzip.rsp
  106.         @ echo unshrink$(OBJ)  >> unzip.rsp
  107.         @ echo zipinfo$(OBJ)  >> unzip.rsp
  108.         @ echo msdos$(OBJ)  >> unzip.rsp
  109.         $(CC) $(LDFLAGS)$@ $(DEF) @unzip.rsp $(LDFLAGS2)
  110.         @ $(RM) unzip.rsp
  111.  
  112. funzip.exe: $(OBJF)
  113.         $(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(LDFLAGS2)
  114.  
  115. unzipsfx.exe:   $(OBJX)
  116.         @ echo off
  117. #       -@ $(RM) unzipsfx.rsp
  118. #       @ for %f in ($(OBJX1)) do echo %f >> unzipsfx.rsp
  119. #       @ for %f in ($(OBJX2)) do echo %f >> unzipsfx.rsp
  120. #       @ for %f in ($(OBJX3)) do echo %f >> unzipsfx.rsp
  121. #       @ for %f in ($(OBJXS)) do echo %f >> unzipsfx.rsp
  122.         @ echo unzipsf_$(OBJ) > unzipsfx.rsp
  123.         @ echo crc32_$(OBJ)  >> unzipsfx.rsp
  124.         @ if not "$(CRCA_O)"=="" echo $(CRCA_O)  >> unzipsfx.rsp
  125.         @ echo crypt_$(OBJ)  >> unzipsfx.rsp
  126.         @ echo extract_$(OBJ)  >> unzipsfx.rsp
  127.         @ echo fileio_$(OBJ)  >> unzipsfx.rsp
  128.         @ echo globals_$(OBJ)  >> unzipsfx.rsp
  129.         @ echo inflate_$(OBJ)  >> unzipsfx.rsp
  130.         @ echo match_$(OBJ)  >> unzipsfx.rsp
  131.         @ echo process_$(OBJ)  >> unzipsfx.rsp
  132.         @ echo ttyio_$(OBJ)  >> unzipsfx.rsp
  133.         @ echo ubz2err_$(OBJ)  >> unzipsfx.rsp
  134.         @ echo msdos_$(OBJ)  >> unzipsfx.rsp
  135.         $(CC) $(LDFLAGS)$@ $(DEF) @unzipsfx.rsp $(LDFLAGS2)
  136.         @ $(RM) unzipsfx.rsp
  137.  
  138. # dependencies
  139.  
  140. apihelp$(OBJ):  apihelp.c $(UNZIP_H) unzvers.h
  141. crc32$(OBJ):    crc32.c $(UNZIP_H) zip.h crc32.h
  142. envargs$(OBJ):  envargs.c $(UNZIP_H)
  143. explode$(OBJ):  explode.c $(UNZIP_H)
  144. extract$(OBJ):  extract.c $(UNZIP_H) crc32.h crypt.h
  145. fileio$(OBJ):   fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  146. globals$(OBJ):  globals.c $(UNZIP_H)
  147. inflate$(OBJ):  inflate.c $(UNZIP_H)
  148. list$(OBJ):     list.c $(UNZIP_H)
  149. match$(OBJ):    match.c $(UNZIP_H)
  150. process$(OBJ):  process.c $(UNZIP_H) crc32.h
  151. ttyio$(OBJ):    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  152. ubz2err$(OBJ):  ubz2err.c $(UNZIP_H)
  153. unreduce$(OBJ): unreduce.c $(UNZIP_H)
  154. unshrink$(OBJ): unshrink.c $(UNZIP_H)
  155. unzip$(OBJ):    unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  156. api$(OBJ):      api.c $(UNZIP_H) unzvers.h
  157. zipinfo$(OBJ):  zipinfo.c $(UNZIP_H)
  158.  
  159. funzip$(OBJ):   funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h     # funzip only
  160.         $(CC) -c $(CFLAGS) $(OUT)$@ funzip.c
  161.  
  162. msdos$(OBJ):    msdos/msdos.c $(UNZIP_H) unzvers.h              # DOS only
  163.         $(CC) -c $(CFLAGS) $(OUT)$@ msdos$(DIRSEP)msdos.c
  164.  
  165. msdos_$(OBJ):   msdos/msdos.c $(UNZIP_H)                        # DOS unzipsfx
  166.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ msdos$(DIRSEP)msdos.c
  167.  
  168. crc_gcc$(OBJ):  crc_i386.S                                      # 32bit, GNU AS
  169.         $(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  170.  
  171. # NFLAGS are solely used as work-around for optimization bug in IBM C++ Set
  172. crypt$(OBJ):    crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  173.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(NFLAGS) $(OUT)$@ crypt.c
  174.  
  175. # funzip specific section
  176. crc32f$(OBJ):   crc32.c $(UNZIP_H) zip.h crc32.h
  177.         $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ crc32.c
  178.  
  179. cryptf$(OBJ):   crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  180.         $(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ crypt.c
  181.  
  182. globalsf$(OBJ): globals.c $(UNZIP_H)
  183.         $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ globals.c
  184.  
  185. inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
  186.         $(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c
  187.  
  188. ttyiof$(OBJ):   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  189.         $(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ ttyio.c
  190.  
  191. # unzipsfx specific section
  192. crc32_$(OBJ):   crc32.c $(UNZIP_H) zip.h crc32.h
  193.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crc32.c
  194.  
  195. crypt_$(OBJ):   crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  196.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crypt.c
  197.  
  198. extract_$(OBJ): extract.c $(UNZIP_H) crc32.h crypt.h
  199.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ extract.c
  200.  
  201. fileio_$(OBJ):  fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  202.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ fileio.c
  203.  
  204. globals_$(OBJ): globals.c $(UNZIP_H)
  205.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ globals.c
  206.  
  207. inflate_$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
  208.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ inflate.c
  209.  
  210. match_$(OBJ):   match.c $(UNZIP_H)
  211.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ match.c
  212.  
  213. process_$(OBJ): process.c $(UNZIP_H) crc32.h
  214.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ process.c
  215.  
  216. ttyio_$(OBJ):   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  217.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ttyio.c
  218.  
  219. ubz2err_$(OBJ): ubz2err.c $(UNZIP_H)
  220.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ubz2err.c
  221.  
  222. unzipsf_$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  223.         $(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c
  224.