Makefile 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. # Makefile for UnZip 5.53 and later: Human68k with gcc NIIMI Satoshi
  2. #
  3. # The original Makefile maybe works fine, but X680x0 is too slow
  4. # to process it. So I split out needed part.
  5. #
  6. # Last revised: 25 Dec 06
  7. #
  8. # 1999/09/23: Modified by Shimazaki Ryo.
  9. ifeq "$(TARGET)" "X68030"
  10. COPT = -m68020-40
  11. AOPT = -m68020
  12. LDFLAGS = -L/usr/local/lib/lib060
  13. endif
  14. CC = gcc2
  15. CFLAGS = $(COPT) -Wall -O2 -I. -fomit-frame-pointer -fstrength-reduce \
  16. -DHAVE_TWONCALL_H -D__DOS_INLINE__ -DASM_CRC -DASM_INFLATECODES
  17. #LDFLAGS = -Wl,-x
  18. LIBS = -lhmem -lttyi -lsignal
  19. AS = g2as
  20. ASFLAGS = $(AOPT) -1 -c4 -y
  21. # UnZipSFX flags
  22. XC = -DSFX
  23. # fUnZip flags
  24. FC = -DFUNZIP
  25. # object files
  26. OBJS = unzip.o crc32.o crc_68.o crypt.o envargs.o explode.o extract.o \
  27. fileio.o globals.o inflate.o flate.o list.o match.o process.o \
  28. ttyio.o ubz2err.o unreduce.o unshrink.o zipinfo.o human68k.o
  29. OBJX = unzipsfx.o crc32_.o crc_68.o crypt_.o extract_.o fileio_.o globals_.o \
  30. inflate_.o flate_.o match_.o process_.o ttyio_.o ubz2err_.o human68k_.o
  31. OBJF = funzip.o crc32f.o crc_68.o cryptf.o globalsf.o inflatef.o flatef.o \
  32. ttyiof.o
  33. UNZIP_H = unzip.h unzpriv.h globals.h
  34. UNZIPS = unzip.x unzipsfx.x funzip.x
  35. DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt
  36. .c.o:
  37. $(CC) $(CFLAGS) -I. -c $< -o $@
  38. # for debugging
  39. .c.s:
  40. $(CC) $(CFLAGS) -c $< -o $@
  41. all: unzips
  42. unzips: $(UNZIPS)
  43. docs: $(DOCS)
  44. unzipsman: unzips docs
  45. unzipsdocs: unzips docs
  46. clean:
  47. rm -f $(OBJS) $(OBJF) $(OBJX) $(UNZIPS)
  48. unzip.x: $(OBJS)
  49. $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  50. unzipsfx.x: $(OBJX)
  51. $(CC) $(LDFLAGS) -o $@ $(OBJX) $(LIBS)
  52. funzip.x: $(OBJF)
  53. $(CC) $(LDFLAGS) -o $@ $(OBJF) $(LIBS)
  54. crc32.o: crc32.c $(UNZIP_H) zip.h crc32.h
  55. crypt.o: crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  56. envargs.o: envargs.c $(UNZIP_H)
  57. explode.o: explode.c $(UNZIP_H)
  58. extract.o: extract.c $(UNZIP_H) crc32.h crypt.h
  59. fileio.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  60. funzip.o: funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.hh
  61. globals.o: globals.c $(UNZIP_H)
  62. inflate.o: inflate.c inflate.h $(UNZIP_H)
  63. list.o: list.c $(UNZIP_H)
  64. match.o: match.c $(UNZIP_H)
  65. process.o: process.c $(UNZIP_H) crc32.h
  66. ttyio.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  67. ubz2err.o: ubz2err.c $(UNZIP_H)
  68. unreduce.o: unreduce.c $(UNZIP_H)
  69. unshrink.o: unshrink.c $(UNZIP_H)
  70. unzip.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  71. zipinfo.o: zipinfo.c $(UNZIP_H)
  72. # unzipsfx
  73. crc32_.o: crc32.c $(UNZIP_H) zip.h crc32.h
  74. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  75. crypt_.o: crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  76. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  77. extract_.o: extract.c $(UNZIP_H) crc32.h crypt.h
  78. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  79. fileio_.o: fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  80. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  81. globals_.o: globals.c $(UNZIP_H)
  82. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  83. inflate_.o: inflate.c inflate.h $(UNZIP_H) crypt.h
  84. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  85. match_.o: match.c $(UNZIP_H)
  86. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  87. process_.o: process.c $(UNZIP_H) crc32.h
  88. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  89. ttyio_.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  90. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  91. ubz2err_.o: ubz2err.c $(UNZIP_H)
  92. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  93. unzipsfx.o: unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  94. $(CC) $(CFLAGS) $(XC) -c $< -o $@
  95. # funzip
  96. crc32f.o: crc32.c $(UNZIP_H) zip.h crc32.h
  97. $(CC) $(CFLAGS) $(FC) -c $< -o $@
  98. cryptf.o: crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  99. $(CC) $(CFLAGS) $(FC) -c $< -o $@
  100. globalsf.o: globals.c $(UNZIP_H)
  101. $(CC) $(CFLAGS) $(FC) -c $< -o $@
  102. inflatef.o: inflate.c inflate.h $(UNZIP_H) crypt.h
  103. $(CC) $(CFLAGS) $(FC) -c $< -o $@
  104. ttyiof.o: ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  105. $(CC) $(CFLAGS) $(FC) -c $< -o $@
  106. human68k.o: human68k/human68k.c $(UNZIP_H)
  107. $(CC) $(CFLAGS) -I. -c human68k/human68k.c -o $@
  108. human68k_.o: human68k/human68k.c $(UNZIP_H) # unzipsfx
  109. $(CC) $(CFLAGS) $(XC) -I. -c human68k/human68k.c -o $@
  110. crc_68.o: human68k/crc_68.s
  111. $(AS) $(ASFLAGS) $< -o $@
  112. flate.o: human68k/flate.s human68k/g_offs.mac
  113. $(AS) $(ASFLAGS) $< -o $@
  114. flate_.o: human68k/flate.s human68k/g_offs_.mac # unzipsfx
  115. $(AS) $(ASFLAGS) $< -o $@ -sSFX
  116. flatef.o: human68k/flate.s human68k/g_offsf.mac # funzip
  117. $(AS) $(ASFLAGS) $< -o $@ -sFUNZIP
  118. human68k/g_offs.mac: human68k/gbloffs.x
  119. human68k/mkgoff.x >! $@
  120. human68k/g_offs_.mac: human68k/gbloffs_.x # unzipsfx
  121. human68k/mkgoff_.x >! $@
  122. human68k/g_offsf.mac: human68k/gbloffsf.x # funzip
  123. human68k/mkgofff.x >! $@
  124. human68k/gbloffs.x: gbloffs.c $(UNZIP_H) crypt.h
  125. $(CC) $(CFLAGS) gbloffs.c -o $@
  126. human68k/gbloffs_.x: gbloffs.c $(UNZIP_H) crypt.h # unzipsfx
  127. $(CC) $(CFLAGS) gbloffs.c -o $@ $(XC)
  128. human68k/gbloffsf.x: gbloffs.c $(UNZIP_H) crypt.h # funzip
  129. $(CC) $(CFLAGS) gbloffs.c -o $@ $(FC)
  130. # the test zipfile
  131. TESTZIP = testmake.zip
  132. # test some basic features of the build
  133. test: check
  134. check: unzips
  135. @if test ! -f $(TESTZIP); then \
  136. echo "##### ERROR: can't find test file $(TESTZIP)"; exit 1; fi
  137. #
  138. @echo "##### testing extraction"
  139. @./unzip -bo $(TESTZIP) testmake.zipinfo
  140. @if test ! -f testmake.zipinfo ; then \
  141. echo "##### ERROR: file extraction from $(TESTZIP) failed"; \
  142. exit 1; fi
  143. #
  144. @echo '##### testing zipinfo (unzip -Z)'
  145. @./unzip -Z $(TESTZIP) > testmake.unzip-Z
  146. @if diff testmake.unzip-Z testmake.zipinfo; then echo "OK."; else \
  147. echo "##### WARNING: zipinfo output doesn't match stored version"; \
  148. echo '##### (If the only difference is the file times, compare your'; \
  149. echo '##### timezone with the Central European timezone, which is one'; \
  150. echo '##### hour east of Greenwich but effectively 2 hours east'; \
  151. echo '##### during summer Daylight Savings Time. The upper two'; \
  152. echo '##### lines should correspond to your local time when the'; \
  153. echo '##### files were created, on 19 November 1998 at 10:46pm CET.'; \
  154. echo '##### If the times are consistent, please ignore this warning.)'; \
  155. fi
  156. @rm -f testmake.unzip-Z testmake.zipinfo
  157. #
  158. @echo '##### testing unzip -d exdir option'
  159. @./unzip -bo $(TESTZIP) -d testun notes
  160. @cat testun/notes
  161. #
  162. @echo '##### testing unzip -o and funzip (ignore funzip warning)'
  163. @./unzip -boq $(TESTZIP) notes -d testun
  164. @./funzip < $(TESTZIP) > testun/notes2
  165. @if diff testun/notes testun/notes2; then true; else \
  166. echo '##### ERROR: funzip output disagrees with unzip'; fi
  167. #
  168. @echo '##### testing unzipsfx (self-extractor)'
  169. @cat unzipsfx.x $(TESTZIP) > testsfx.x
  170. @chmod 0700 testsfx.x
  171. @./testsfx -bo notes
  172. @if diff notes testun/notes; then true; else \
  173. echo '##### ERROR: unzipsfx file disagrees with unzip'; fi
  174. @rm -f testsfx.x notes testun/notes testun/notes2
  175. @rmdir testun
  176. #
  177. @echo '##### testing complete.'
  178. # EOF