makefile.emx 7.2 KB

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