Subversion Repositories Kolibri OS

Rev

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

  1. # Makefile for UnZip, fUnZip and UnZipSFX
  2. # for emx 0.9d + rsxnt 1.42 / gcc under WIN32. Derived from makefile.os2
  3. # By E-Yen Tan and Christian Spieler. Last updated 25 December 2006.
  4. #
  5. # This makefile should work fine with GNU make and hopefully some others.
  6. # Tested with Spieler's special GNU make 3.74 gnuish 16-bit version.
  7. #
  8. # If make does not support long command-line passing to gcc, the link step
  9. # will fail. In this case, you have to edit the link commands to use the
  10. # commented-out alternative that creates a link response file "by hand".
  11.  
  12. #ifdef NOASM
  13. #AS_FLAGS =
  14. #else
  15. AS_FLAGS = -DASM_CRC
  16. #endif
  17.  
  18. CP=copy
  19. RM=del
  20.  
  21. CC=gcc -Zwin32 -I.
  22. CC_OSIZ=-O1
  23. CC_OTIM=-O2 -mpentium
  24. CC_OPTS=-Wall -DWIN32 $(AS_FLAGS) $(LOCAL_UNZIP)
  25. CFLAGS=$(CC_OTIM) $(CC_OPTS)
  26. CFLAGSX=$(CC_OSIZ) $(CC_OPTS) -DSFX
  27. CFLAGSF=$(CC_OTIM) $(CC_OPTS) -DFUNZIP
  28. DLLFLAG=
  29. AS=gcc
  30. ASFLAGS=-Di386
  31. LDFLAGS=-Zsys -o ./
  32. LDFLAGS2=-ladvapi32 -Zsmall-conv -s
  33. OUT=-o
  34. OBJ=.o
  35.  
  36. #ifdef NOASM
  37. #CRCA_O=
  38. #else
  39. CRCA_O=crc_gcc
  40. #endif
  41. OBJUS=win32$(OBJ) nt$(OBJ)
  42. OBJXS=win32_$(OBJ) nt_$(OBJ)
  43. OBJFS=win32f$(OBJ)
  44. OSDEP_H=win32/w32cfg.h
  45.  
  46.  
  47. # default settings for target dependent macros:
  48. DIRSEP = /
  49. AS_DIRSEP = /
  50.  
  51. OBJU1 = unzip$(OBJ) crc32$(OBJ) $(CRCA_O) crypt$(OBJ) envargs$(OBJ)
  52. OBJU2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ)
  53. OBJU3 = inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ)
  54. OBJU4 = ubz2err$(OBJ) unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
  55. OBJU  = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJU4) $(OBJUS)
  56. OBJX1 = unzipsf_$(OBJ) crc32_$(OBJ) $(CRCA_O) crypt_$(OBJ)
  57. OBJX2 = extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ)
  58. OBJX3 = match_$(OBJ) process_$(OBJ) ttyio_$(OBJ) ubz2err_$(OBJ)
  59. OBJX  = $(OBJX1) $(OBJX2) $(OBJX3) $(OBJXS)
  60. OBJF  = funzip$(OBJ) crc32f$(OBJ) $(CRCA_O) cryptf$(OBJ) inflatef$(OBJ) \
  61.         globalsf$(OBJ) ttyiof$(OBJ) $(OBJFS)
  62.  
  63. UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
  64.  
  65. # rules
  66.  
  67. .SUFFIXES:      .c $(OBJ)
  68.  
  69. .c$(OBJ):
  70.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ $<
  71.  
  72. # targets
  73.  
  74. all:    unzip.exe funzip.exe unzipsfx.exe
  75.  
  76. # This next bit is nasty, but is needed to overcome the MS-DOS command
  77. # line limit as response files for emx's gcc seem to only work if each
  78. # file is on a different line. DJGPP doesn't do this (if you are at all
  79. # interested).
  80.  
  81. unzip.exe: $(OBJU)
  82. #       @ echo off
  83. #       -@ $(RM) unzip.rsp
  84. #       @ for %f in ($(OBJU1)) do echo %f >> unzip.rsp
  85. #       @ for %f in ($(OBJU2)) do echo %f >> unzip.rsp
  86. #       @ for %f in ($(OBJU3)) do echo %f >> unzip.rsp
  87. #       @ for %f in ($(OBJU4) $(OBJUS)) do echo %f >> unzip.rsp
  88. #       $(CC) $(LDFLAGS)$@ $(DEF) @unzip.rsp $(LDFLAGS2)
  89.         $(CC) $(LDFLAGS)$@ $(DEF) $(OBJU) $(LDFLAGS2)
  90. #       @ $(RM) unzip.rsp
  91.  
  92. funzip.exe: $(OBJF)
  93.         $(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(LDFLAGS2)
  94.  
  95. unzipsfx.exe:   $(OBJX)
  96. #       @ echo off
  97. #       -@ $(RM) unzipsfx.rsp
  98. #       @ for %f in ($(OBJX1)) do echo %f >> unzipsfx.rsp
  99. #       @ for %f in ($(OBJX2)) do echo %f >> unzipsfx.rsp
  100. #       @ for %f in ($(OBJX3)) do echo %f >> unzipsfx.rsp
  101. #       @ for %f in ($(OBJXS)) do echo %f >> unzipsfx.rsp
  102. #       $(CC) $(LDFLAGS)$@ $(DEF) @unzipsfx.rsp $(LDFLAGS2)
  103.         $(CC) $(LDFLAGS)$@ $(DEF) $(OBJX) $(LDFLAGS2)
  104. #       @ $(RM) unzipsfx.rsp
  105.  
  106. uzexampl.exe:   uzexampl$(OBJ)
  107.         $(CC) $(LDFLAGS)$@ $(DEF) uzexampl$(OBJ) -lversion $(LDFLAGS2)
  108.  
  109. # dependencies
  110.  
  111. apihelp$(OBJ):  apihelp.c $(UNZIP_H) unzvers.h
  112. crc32$(OBJ):    crc32.c $(UNZIP_H) zip.h crc32.h
  113. envargs$(OBJ):  envargs.c $(UNZIP_H)
  114. explode$(OBJ):  explode.c $(UNZIP_H)
  115. extract$(OBJ):  extract.c $(UNZIP_H) crc32.h crypt.h
  116. fileio$(OBJ):   fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  117. globals$(OBJ):  globals.c $(UNZIP_H)
  118. inflate$(OBJ):  inflate.c $(UNZIP_H)
  119. list$(OBJ):     list.c $(UNZIP_H)
  120. match$(OBJ):    match.c $(UNZIP_H)
  121. process$(OBJ):  process.c $(UNZIP_H) crc32.h
  122. ttyio$(OBJ):    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  123. ubz2err$(OBJ):  ubz2err.c $(UNZIP_H)
  124. unreduce$(OBJ): unreduce.c $(UNZIP_H)
  125. unshrink$(OBJ): unshrink.c $(UNZIP_H)
  126. unzip$(OBJ):    unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  127. api$(OBJ):      api.c $(UNZIP_H) unzvers.h
  128. zipinfo$(OBJ):  zipinfo.c $(UNZIP_H)
  129.  
  130. funzip$(OBJ):   funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h     # funzip only
  131.         $(CC) -c $(CFLAGS) $(OUT)$@ funzip.c
  132.  
  133. unzipstb$(OBJ): unzipstb.c                                      # DLL version
  134.         $(CC) -c $(CFLAGS) $(OUT)$@ unzipstb.c
  135.  
  136. uzexampl$(OBJ): windll/uzexampl.c windll/uzexampl.h             # WINDLL example
  137.         $(CC) -c $(CFLAGS) $(OUT)$@ windll/uzexampl.c
  138.  
  139. win32$(OBJ):    win32/win32.c $(UNZIP_H) win32/nt.h unzvers.h   # win32 only
  140.         $(CC) -c $(CFLAGS) $(OUT)$@ win32$(DIRSEP)win32.c
  141.  
  142. win32f$(OBJ):   win32/win32.c $(UNZIP_H) win32/nt.h             # win32 funzip
  143.         $(CC) -c $(CFLAGSF) $(OUT)$@ win32$(DIRSEP)win32.c
  144.  
  145. win32_$(OBJ):   win32/win32.c $(UNZIP_H) win32/nt.h             # win32 unzipsfx
  146.         $(CC) -c $(CFLAGSX) $(OUT)$@ win32$(DIRSEP)win32.c
  147.  
  148. nt$(OBJ):       win32/nt.c $(UNZIP_H) win32/nt.h                # win32 only
  149.         $(CC) -c $(CFLAGS) $(OUT)$@ win32$(DIRSEP)nt.c
  150.  
  151. nt_$(OBJ):      win32/nt.c $(UNZIP_H) win32/nt.h                # win32 only
  152.         $(CC) -c $(CFLAGSX) $(OUT)$@ win32$(DIRSEP)nt.c
  153.  
  154. os2$(OBJ):      os2/os2.c $(UNZIP_H) unzvers.h                  # OS/2 only
  155.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)os2.c
  156.  
  157. os2_$(OBJ):     os2/os2.c $(UNZIP_H)                            # OS/2 unzipsfx
  158.         $(CC) -c $(CFLAGSX) $(OUT)$@ os2$(DIRSEP)os2.c
  159.  
  160. os2acl$(OBJ):   os2/os2acl.c $(UNZIP_H) unzvers.h               # OS/2 only
  161.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)os2acl.c
  162.  
  163. rexxhelp$(OBJ): os2/rexxhelp.c                                  # OS/2 DLL only
  164.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)rexxhelp.c
  165.  
  166. rexxapi$(OBJ):  os2/rexxapi.c                                   # OS/2 DLL only
  167.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)rexxapi.c
  168.  
  169. crc_i86$(OBJ):  msdos/crc_i86.asm                               # 16bit only
  170.         $(AS) $(ASFLAGS) msdos$(AS_DIRSEP)crc_i86.asm $(ASEOL)
  171.  
  172. crc_i386$(OBJ): win32/crc_i386.asm                              # 32bit, MASM
  173.         $(AS) $(ASFLAGS) win32$(AS_DIRSEP)crc_i386.asm $(ASEOL)
  174.  
  175. crc_gcc$(OBJ):  crc_i386.S                                      # 32bit, GNU AS
  176.         $(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  177.  
  178. crypt$(OBJ):    crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  179.         $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ crypt.c
  180.  
  181. # funzip compilation section
  182. cryptf$(OBJ):   crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  183.         $(CC) -c $(CFLAGSF) $(OUT)$@ crypt.c
  184.  
  185. crc32f$(OBJ):   crc32.c $(UNZIP_H) zip.h crc32.h
  186.         $(CC) -c $(CFLAGSF) $(OUT)$@ crc32.c
  187.  
  188. globalsf$(OBJ): globals.c $(UNZIP_H)
  189.         $(CC) -c $(CFLAGSF) $(OUT)$@ globals.c
  190.  
  191. inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
  192.         $(CC) -c $(CFLAGSF) $(OUT)$@ inflate.c
  193.  
  194. ttyiof$(OBJ):   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  195.         $(CC) -c $(CFLAGSF) $(OUT)$@ ttyio.c
  196.  
  197. # unzipsfx compilation section
  198. crc32_$(OBJ):   crc32.c $(UNZIP_H) zip.h crc32.h
  199.         $(CC) -c $(CFLAGSX) $(OUT)$@ crc32.c
  200.  
  201. crypt_$(OBJ):   crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  202.         $(CC) -c $(CFLAGSX) $(OUT)$@ crypt.c
  203.  
  204. extract_$(OBJ): extract.c $(UNZIP_H) crc32.h crypt.h
  205.         $(CC) -c $(CFLAGSX) $(OUT)$@ extract.c
  206.  
  207. fileio_$(OBJ):  fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  208.         $(CC) -c $(CFLAGSX) $(OUT)$@ fileio.c
  209.  
  210. globals_$(OBJ): globals.c $(UNZIP_H)
  211.         $(CC) -c $(CFLAGSX) $(OUT)$@ globals.c
  212.  
  213. inflate_$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
  214.         $(CC) -c $(CFLAGSX) $(OUT)$@ inflate.c
  215.  
  216. match_$(OBJ):   match.c $(UNZIP_H)
  217.         $(CC) -c $(CFLAGSX) $(OUT)$@ match.c
  218.  
  219. process_$(OBJ): process.c $(UNZIP_H) crc32.h
  220.         $(CC) -c $(CFLAGSX) $(OUT)$@ process.c
  221.  
  222. ttyio_$(OBJ):   ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  223.         $(CC) -c $(CFLAGSX) $(OUT)$@ ttyio.c
  224.  
  225. ubz2err_$(OBJ): ubz2err.c $(UNZIP_H)
  226.         $(CC) -c $(CFLAGSX) $(OUT)$@ ubz2err.c
  227.  
  228. unzipsf_$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  229.         $(CC) -c $(CFLAGSX) $(OUT)$@ unzip.c
  230.