Subversion Repositories Kolibri OS

Rev

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

  1. ######################################################################
  2. #
  3. # Makefile for Info-ZIP's unzip, unzipsfx, and funzip on AtheOS
  4. # Version 5.53
  5. #
  6. # Copyright (C) 1998-2006 Info-ZIP
  7. #                    Chris Herborth (chrish@qnx.com)
  8. # Copyright (C) 2004 Nikolaev Ruslan (nruslan@hotbox.ru)
  9. #
  10. # To automatically install the fresh new unzip, use the "install" target:
  11. # make -f atheos/Makefile install
  12. ######################################################################
  13. SHELL = /bin/bash
  14.  
  15. # Punish those of you not running on SMP hardware...
  16. MAKE  = make -j 4 -f atheos/Makefile
  17.  
  18. # UnZipSFX flags
  19. SL = -o unzipsfx
  20. SL2 = $(LF2)
  21.  
  22. # fUnZip flags
  23. FL = -o funzip
  24. FL2 = $(LF2)
  25.  
  26. # general-purpose stuff
  27. CP = cp
  28. AS = as
  29. RM = rm -f
  30. LN = ln -sf
  31. CHMOD = chmod
  32. E =
  33. O = .o
  34. M = atheos
  35.  
  36. OSDEP_H = atheos/athcfg.h
  37.  
  38. # define
  39.  
  40. # object files
  41. OBJS1 = unzip$O crc32$O crc_i386$O crypt$O envargs$O explode$O
  42. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  43. OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
  44. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  45. LOBJS = $(OBJS)
  46. OBJSDLL = $(OBJS) api$O
  47. OBJX = unzipsfx$O crc32_$O crc_i386$O crypt_$O extract_$O fileio_$O globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
  48. LOBJX = $(OBJX)
  49. OBJF = funzip$O crc32f$O crc_i386$O cryptf$O globalsf$O inflatef$O ttyiof$O
  50. UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
  51.  
  52. # installation
  53. INSTALL = install
  54. manext = 1
  55. prefix = /usr
  56. BINDIR = $(prefix)/bin
  57. MANDIR = $(prefix)/man/man$(manext)
  58. INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E $(BINDIR)/unzip$E
  59. INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
  60. #
  61. UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
  62. # this is a little ugly...well, no, it's a lot ugly:
  63. MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1 man/zipgrep.1
  64.  
  65. ######################################################################
  66. CC=gcc
  67. LD=gcc
  68. CF=-O3 -march=i586 -Wall -I. -DPASSWD_FROM_STDIN -DASM_CRC -DUSE_UNSHRINK $(LOCAL_UNZIP)
  69. LF=-o unzip
  70. LF2=
  71. TARGET=$(UNZIPS)
  72. ######################################################################
  73. # Helpful targets
  74. all:
  75.         @echo 'TARGET = $(TARGET)'
  76.         @echo 'CC     = $(CC)'
  77.         if [ -n "$(TARGET)" ] ; then \
  78.                 $(MAKE) CC=$(CC) CF="$(CF)" LD="$(LD)" \
  79.                         LF="$(LF)" LF2="$(LF2)" CCPP="$(CC)" CPPF="$(CF)" \
  80.                         OBJS="$(OBJS)" LOBJS="$(LOBJS)" OBJX="$(OBJX)" \
  81.                         LOBJX="$(LOBJX)" $(TARGET) ; \
  82.         else \
  83.                 $(MAKE) help ; \
  84.         fi
  85.  
  86. help:
  87.         @echo ''
  88.         @echo "This Makefile lets you build Info-ZIP's zip."
  89.         @echo ''
  90.         @echo 'To build zip for this computer using the default compiler, just do:'
  91.         @echo ''
  92.         @echo ' make -f atheos/Makefile'
  93.         @echo ''
  94.  
  95. ######################################################################
  96. # Basic compile instructions and dependencies
  97.  
  98. # this is for GNU make; comment out and notify zip-bugs if it causes errors
  99. .SUFFIXES:      .c .o
  100.  
  101. # default for compiling C files
  102. .c.o:
  103.         $(CC) -c $(CF) $*.c
  104.  
  105.  
  106. unzips:         $(UNZIPS)
  107. objs:           $(OBJS)
  108. objsdll:        $(OBJSDLL)
  109. unzipsman:      unzips
  110.  
  111.  
  112. unzip$E:        $(OBJS)
  113.         $(LD) $(LF) $(LOBJS) $(LF2)
  114.         $(CHMOD) +x unzip$E
  115.  
  116. unzipsfx$E:     $(OBJX)
  117.         $(LD) $(SL) $(LOBJX) $(SL2)
  118.         $(CHMOD) +x unzipsfx$E
  119.  
  120. funzip$E:       $(OBJF)
  121.         $(LD) $(FL) $(OBJF) $(FL2)
  122.         $(CHMOD) +x funzip$E
  123.  
  124. zipinfo$E:      unzip$E
  125.         $(LN) unzip$E zipinfo$E
  126.  
  127. crc32$O:        crc32.c $(UNZIP_H) zip.h crc32.h
  128. crypt$O:        crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  129. envargs$O:      envargs.c $(UNZIP_H)
  130. explode$O:      explode.c $(UNZIP_H)
  131. extract$O:      extract.c $(UNZIP_H) crc32.h crypt.h
  132. fileio$O:       fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  133. funzip$O:       funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
  134. globals$O:      globals.c $(UNZIP_H)
  135. inflate$O:      inflate.c inflate.h $(UNZIP_H)
  136. list$O:         list.c $(UNZIP_H)
  137. match$O:        match.c $(UNZIP_H)
  138. process$O:      process.c $(UNZIP_H) crc32.h
  139. ttyio$O:        ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  140. ubz2err$O:      ubz2err.c $(UNZIP_H)
  141. unreduce$O:     unreduce.c $(UNZIP_H)
  142. unshrink$O:     unshrink.c $(UNZIP_H)
  143. unzip$O:        unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  144. zipinfo$O:      zipinfo.c $(UNZIP_H)
  145.  
  146. crc_i386$O:     crc_i386.S
  147.         $(CC) -E crc_i386.S > crc_i386s.s
  148.         $(AS) -o $@ crc_i386s.s
  149.         $(RM) crc_i386s.s
  150.  
  151. # unzipsfx only
  152. unzipsfx$O:     unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  153.         $(CP) unzip.c unzipsfx.c
  154.         $(CC) -c $(CF) -DSFX unzipsfx.c
  155.         $(RM) unzipsfx.c
  156.  
  157. crc32_$O:       crc32.c $(UNZIP_H) zip.h crc32.h
  158.         $(CP) crc32.c crc32_.c
  159.         $(CC) -c $(CF) -DSFX crc32_.c
  160.         $(RM) crc32_.c
  161.  
  162. crypt_$O:       crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  163.         $(CP) crypt.c crypt_.c
  164.         $(CC) -c $(CF) -DSFX crypt_.c
  165.         $(RM) crypt_.c
  166.  
  167. extract_$O:     extract.c $(UNZIP_H) crc32.h crypt.h
  168.         $(CP) extract.c extract_.c
  169.         $(CC) -c $(CF) -DSFX extract_.c
  170.         $(RM) extract_.c
  171.  
  172. fileio_$O:      fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  173.         $(CP) fileio.c fileio_.c
  174.         $(CC) -c $(CF) -DSFX fileio_.c
  175.         $(RM) fileio_.c
  176.  
  177. globals_$O:     globals.c $(UNZIP_H)
  178.         $(CP) globals.c globals_.c
  179.         $(CC) -c $(CF) -DSFX globals_.c
  180.         $(RM) globals_.c
  181.  
  182. inflate_$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  183.         $(CP) inflate.c inflate_.c
  184.         $(CC) -c $(CF) -DSFX inflate_.c
  185.         $(RM) inflate_.c
  186.  
  187. match_$O:       match.c
  188.         $(CP) match.c match_.c
  189.         $(CC) -c $(CF) -DSFX match_.c
  190.         $(RM) match_.c
  191.  
  192. process_$O:     process.c $(UNZIP_H) crc32.h
  193.         $(CP) process.c process_.c
  194.         $(CC) -c $(CF) -DSFX process_.c
  195.         $(RM) process_.c
  196.  
  197. ttyio_$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  198.         $(CP) ttyio.c ttyio_.c
  199.         $(CC) -c $(CF) -DSFX ttyio_.c
  200.         $(RM) ttyio_.c
  201.  
  202. ubz2err$O:      ubz2err.c $(UNZIP_H)
  203.         $(CP) ubz2err.c ubz2err_.c
  204.         $(CC) -c $(CF) -DSFX ubz2err_.c
  205.         $(RM) ubz2err_.c
  206.  
  207. # funzip only
  208. crc32f$O:       crc32.c $(UNZIP_H) zip.h crc32.h
  209.         $(CP) crc32.c crc32f.c
  210.         $(CC) -c $(CF) -DFUNZIP crc32f.c
  211.         $(RM) crc32f.c
  212.  
  213. cryptf$O:       crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  214.         $(CP) crypt.c cryptf.c
  215.         $(CC) -c $(CF) -DFUNZIP cryptf.c
  216.         $(RM) cryptf.c
  217.  
  218. globalsf$O:     globals.c $(UNZIP_H)
  219.         $(CP) globals.c globalsf.c
  220.         $(CC) -c $(CF) -DFUNZIP globalsf.c
  221.         $(RM) globalsf.c
  222.  
  223. inflatef$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  224.         $(CP) inflate.c inflatef.c
  225.         $(CC) -c $(CF) -DFUNZIP inflatef.c
  226.         $(RM) inflatef.c
  227.  
  228. ttyiof$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  229.         $(CP) ttyio.c ttyiof.c
  230.         $(CC) -c $(CF) -DFUNZIP ttyiof.c
  231.         $(RM) ttyiof.c
  232.  
  233. # AtheOS specific code
  234. atheos$O:       atheos/atheos.c $(UNZIP_H) unzvers.h atheos/atheos.h
  235.         $(CC) -c $(CF) atheos/atheos.c
  236.  
  237. # version() not used by unzipsfx, so no unzvers.h dependency
  238. atheos_$O:      atheos/atheos.c $(UNZIP_H) atheos/atheos.h      # unzipsfx only
  239.         $(CP) atheos/atheos.c atheos_.c
  240.         $(CC) -c $(CF) -Iatheos -DSFX atheos_.c
  241.         $(RM) atheos_.c
  242.  
  243. # this really only works for Unix targets, unless E and O specified on cmd line
  244. clean:
  245.         $(RM) $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O unzipstb$O
  246.  
  247. install:        all
  248.         $(INSTALL) -m 755 $(UNZIPS) $(BINDIR)
  249.         $(RM) $(BINDIR)/zipinfo$E
  250.         $(LN) unzip$E $(BINDIR)/zipinfo$E
  251.         $(RM) $(BINDIR)/zipgrep$E
  252.         $(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
  253.         $(INSTALL) -m 644 man/unzip.1 $(MANDIR)/unzip.$(manext)
  254.         $(INSTALL) -m 644 man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
  255.         $(INSTALL) -m 644 man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
  256.         $(INSTALL) -m 644 man/funzip.1 $(MANDIR)/funzip.$(manext)
  257.         $(INSTALL) -m 644 man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
  258.  
  259. # alternatively, could use zip method:  -cd $(BINDIR); $(RM) $(UNZIPS)  [etc.]
  260. uninstall:
  261.         $(RM) $(INSTALLEDBIN) $(INSTALLEDMAN)
  262.  
  263.  
  264. TESTZIP = testmake.zip  # the test zipfile
  265.  
  266. # test some basic features of the build
  267. test:           check
  268.  
  269. check:
  270.         @echo '#####  This is a Unix-specific target.  (Just so you know.)'
  271.         @echo '#####     Make sure unzip, funzip and unzipsfx are compiled and'
  272.         @echo '#####     in this directory.'
  273.         @if test ! -f ./unzip; then \
  274.             echo "#####  ERROR:  can't find ./unzip"; exit 1; fi
  275.         @if test ! -f ./funzip; then \
  276.             echo "#####  ERROR:  can't find ./funzip"; exit 1; fi
  277.         @if test ! -f ./unzipsfx; then \
  278.             echo "#####  ERROR:  can't find ./unzipsfx"; exit 1; fi
  279. #
  280.         @if test ! -f $(TESTZIP); then \
  281.             echo "#####  ERROR:  can't find test file $(TESTZIP)"; exit 1; fi
  282. #
  283.         @echo "#####  testing extraction"
  284.         @./unzip -bo $(TESTZIP) testmake.zipinfo
  285.         @if test ! -f testmake.zipinfo ; then \
  286.             echo "#####  ERROR:  file extraction from $(TESTZIP) failed"; \
  287.             exit 1; fi
  288. #
  289.         @echo '#####  testing zipinfo (unzip -Z)'
  290.         @./unzip -Z $(TESTZIP) > testmake.unzip-Z
  291.         @if diff testmake.unzip-Z testmake.zipinfo; then echo "OK."; else \
  292.             echo "#####  WARNING:  zipinfo output doesn't match stored version"; \
  293.             echo '#####     (If the only difference is the file times, compare your'; \
  294.             echo '#####      timezone with the Central European timezone, which is one'; \
  295.             echo '#####      hour east of Greenwich but effectively 2 hours east'; \
  296.             echo '#####      during summer Daylight Savings Time.  The upper two'; \
  297.             echo '#####      lines should correspond to your local time when the'; \
  298.             echo '#####      files were created, on 19 November 1998 at 10:46pm CET.'; \
  299.             echo '#####      If the times are consistent, please ignore this warning.)'; \
  300.             fi
  301.         @$(RM) testmake.unzip-Z testmake.zipinfo
  302. #
  303.         @echo '#####  testing unzip -d exdir option'
  304.         @./unzip -bo $(TESTZIP) -d testun notes
  305.         @cat testun/notes
  306. #
  307.         @echo '#####  testing unzip -o and funzip (ignore funzip warning)'
  308.         @./unzip -boq $(TESTZIP) notes -d testun
  309.         @./funzip < $(TESTZIP) > testun/notes2
  310.         @if diff testun/notes testun/notes2; then true; else \
  311.             echo '#####  ERROR:  funzip output disagrees with unzip'; fi
  312. #
  313.         @echo '#####  testing unzipsfx (self-extractor)'
  314.         @cat unzipsfx $(TESTZIP) > testsfx
  315.         @$(CHMOD) 0700 testsfx
  316.         @./testsfx -bo notes
  317.         @if diff notes testun/notes; then true; else \
  318.             echo '#####  ERROR:  unzipsfx file disagrees with unzip'; fi
  319.         @$(RM) testsfx notes testun/notes testun/notes2
  320.         @rmdir testun
  321. #
  322.         @echo '#####  testing complete.'
  323.