Subversion Repositories Kolibri OS

Rev

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

  1. #==============================================================================
  2. # Makefile for UnZip, UnZipSFX and fUnZip:  Atari           ("real" makes only)
  3. # Version:  5.53                                               25 December 2006
  4. #==============================================================================
  5.  
  6.  
  7. # INSTRUCTIONS (such as they are):
  8. #
  9. # "make"        -- makes UnZip on a generic Atari
  10. #
  11. # CF are flags for the C compiler.  LF are flags for the loader.  LF2 are more
  12. # flags for the loader, if they need to be at the end of the line instead of at
  13. # the beginning (for example, some libraries).  FL and FL2 are the corre-
  14. # sponding flags for fUnZip.  LOCAL_UNZIP is an environment variable that can
  15. # be used to add default C flags to your compile without editing the Makefile
  16. # (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
  17. #
  18. # Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
  19. # tion does not always imply a working program.
  20.  
  21.  
  22. #####################
  23. # MACRO DEFINITIONS #
  24. #####################
  25.  
  26. # Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
  27. # such as -DDOSWILD).
  28.  
  29. # UnZip flags
  30. CC = gcc#       try using "gcc" target rather than changing this (if you do,
  31. LD = $(CC)#     you MUST change LD, too--else "unresolved symbol:  ___main")
  32. LOC = $(LOCAL_UNZIP)
  33. CF = $(CFLAGS) $(LOC)
  34. LF = -o unzip$E
  35. LF2 = -s
  36.  
  37. # UnZipSFX flags
  38. SL = -o unzipsfx$E
  39. SL2 = $(LF2)
  40.  
  41. # fUnZip flags
  42. FL = -o funzip$E
  43. FL2 = $(LF2)
  44.  
  45. # general-purpose stuff
  46. CP = ln -s
  47. LN = ln
  48. RM = rm -f
  49. CHMOD = chmod
  50. STRIP = strip
  51. E = .ttp
  52. O = .o
  53. M = atari
  54. SHELL = /bin/sh
  55.  
  56. # object files
  57. OBJS1 = unzip$O crc32$O crypt$O envargs$O explode$O
  58. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  59. OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
  60. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  61. LOBJS = $(OBJS)
  62. OBJSDLL = $(OBJS) api$O
  63. OBJX = unzipsfx$O crc32$O crypt_$O extract_$O fileio_$O \
  64.         globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
  65. LOBJX = $(OBJX)
  66. OBJF = funzip$O crc32$O cryptf$O globalsf$O inflatef$O ttyiof$O
  67. #OBJS_OS2 = $(OBJS1:.o=.obj) $(OBJS2:.o=.obj) os2.obj
  68. #OBJF_OS2 = $(OBJF:.o=.obj)
  69.  
  70. UNZIP_H = unzip.h unzpriv.h globals.h
  71.  
  72. # installation
  73. INSTALL = cp#   probably can change this to 'install' if you have it
  74. # on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
  75. manext = 1
  76. prefix = /usr/local
  77. BINDIR = $(prefix)/bin#                 where to install executables
  78. MANDIR = $(prefix)/man/man$(manext)#    where to install man pages
  79. INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
  80.         $(BINDIR)/unzip$E
  81. INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
  82.         $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
  83. #
  84. UNZIPS = unzip$E funzip$E unzipsfx$E
  85. # this is a little ugly...well, no, it's a lot ugly:
  86. MANS = man/unzip.1 man/unzipsfx.1 man/zipinfo.1 man/funzip.1
  87. DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt
  88.  
  89.  
  90. ###############################################
  91. # BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
  92. ###############################################
  93.  
  94. # this is for GNU make; comment out and notify zip-bugs if it causes errors
  95. .SUFFIXES:      .c .o .obj
  96.  
  97. # yes, we should be able to use the $O macro to combine these two, but it
  98. # fails on some brain-damaged makes (e.g., AIX's)...no big deal
  99. .c.o:
  100.         $(CC) -c $(CF) $*.c
  101.  
  102. .c.obj:
  103.         $(CC) -c $(CF) $*.c
  104.  
  105.  
  106. ####################
  107. # DEFAULT HANDLING #
  108. ####################
  109.  
  110.  
  111. all:            unzips
  112. unzips:         $(UNZIPS)
  113. docs:           $(DOCS)
  114. unzipsman:      unzips docs
  115. unzipsdocs:     unzips docs
  116.  
  117.  
  118. unzip$E:        $(OBJS)
  119.         $(LD) $(LF) $(LOBJS) $(LF2)
  120.  
  121. unzipsfx$E:     $(OBJX)
  122.         $(LD) $(SL) $(LOBJX) $(SL2)
  123.  
  124. funzip$E:       $(OBJF)
  125.         $(LD) $(FL) $(OBJF) $(FL2)
  126.  
  127.  
  128. crc32$O:        crc32.c $(UNZIP_H) zip.h crc32.h
  129. crypt$O:        crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  130. envargs$O:      envargs.c $(UNZIP_H)
  131. explode$O:      explode.c $(UNZIP_H)
  132. extract$O:      extract.c $(UNZIP_H) crc32.h crypt.h
  133. fileio$O:       fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  134. funzip$O:       funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
  135. globals$O:      globals.c $(UNZIP_H)
  136. inflate$O:      inflate.c inflate.h $(UNZIP_H)
  137. list$O:         list.c $(UNZIP_H)
  138. match$O:        match.c $(UNZIP_H)
  139. process$O:      process.c $(UNZIP_H) crc32.h
  140. ttyio$O:        ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  141. ubz2err$O:      ubz2err.c $(UNZIP_H)
  142. unreduce$O:     unreduce.c $(UNZIP_H)
  143. unshrink$O:     unshrink.c $(UNZIP_H)
  144. unzip$O:        unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  145. zipinfo$O:      zipinfo.c $(UNZIP_H)
  146.  
  147. # unzipsfx only
  148. crypt_$O:       crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  149.         $(CP) crypt.c crypt_.c
  150.         $(CC) -c $(CF) -DSFX crypt_.c
  151.         $(RM) crypt_.c
  152.  
  153. extract_$O:     extract.c $(UNZIP_H) crc32.h crypt.h
  154.         $(CP) extract.c extract_.c
  155.         $(CC) -c $(CF) -DSFX extract_.c
  156.         $(RM) extract_.c
  157.  
  158. fileio_$O:      fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  159.         $(CP) fileio.c fileio_.c
  160.         $(CC) -c $(CF) -DSFX fileio_.c
  161.         $(RM) fileio_.c
  162.  
  163. globals_$O:     globals.c $(UNZIP_H)
  164.         $(CP) globals.c globals_.c
  165.         $(CC) -c $(CF) -DSFX globals_.c
  166.         $(RM) globals_.c
  167.  
  168. inflate_$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  169.         $(CP) inflate.c inflate_.c
  170.         $(CC) -c $(CF) -DSFX inflate_.c
  171.         $(RM) inflate_.c
  172.  
  173. match_$O:       match.c $(UNZIP_H)
  174.         $(CP) match.c match_.c
  175.         $(CC) -c $(CF) -DSFX match_.c
  176.         $(RM) match_.c
  177.  
  178. process_$O:     process.c $(UNZIP_H) crc32.h
  179.         $(CP) process.c process_.c
  180.         $(CC) -c $(CF) -DSFX process_.c
  181.         $(RM) process_.c
  182.  
  183. ttyio_$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  184.         $(CP) ttyio.c ttyio_.c
  185.         $(CC) -c $(CF) -DSFX ttyio_.c
  186.         $(RM) ttyio_.c
  187.  
  188. ubz2err$O:      ubz2err.c $(UNZIP_H)
  189.         $(CP) ubz2err.c ubz2err_.c
  190.         $(CC) -c $(CF) -DSFX ubz2err_.c
  191.         $(RM) ubz2err_.c
  192.  
  193. unzipsfx$O:     unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  194.         $(CP) unzip.c unzipsfx.c
  195.         $(CC) -c $(CF) -DSFX unzipsfx.c
  196.         $(RM) unzipsfx.c
  197.  
  198.  
  199. # funzip only
  200. cryptf$O:       crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  201.         $(CP) crypt.c cryptf.c
  202.         $(CC) -c $(CF) -DFUNZIP cryptf.c
  203.         $(RM) cryptf.c
  204.  
  205. globalsf$O:     globals.c $(UNZIP_H)
  206.         $(CP) globals.c globalsf.c
  207.         $(CC) -c $(CF) -DFUNZIP globalsf.c
  208.         $(RM) globalsf.c
  209.  
  210. inflatef$O:     inflate.c inflate.h $(UNZIP_H) crypt.h
  211.         $(CP) inflate.c inflatef.c
  212.         $(CC) -c $(CF) -DFUNZIP inflatef.c
  213.         $(RM) inflatef.c
  214.  
  215. ttyiof$O:       ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  216.         $(CP) ttyio.c ttyiof.c
  217.         $(CC) -c $(CF) -DFUNZIP ttyiof.c
  218.         $(RM) ttyiof.c
  219.  
  220.  
  221. # system-specific code
  222. atari$O:        atari/atari.c $(UNZIP_H)
  223.         $(CC) -c $(CF) atari/atari.c
  224.  
  225. atari_$O:       atari/atari.c $(UNZIP_H)
  226.         $(CP) atari/atari.c atari_.c
  227.         $(CC) -c $(CF) -DSFX atari_.c
  228.         $(RM) atari_.c
  229.  
  230.  
  231. # this really only works for Unix targets, unless specify E and O on cmd line
  232. clean:
  233.         @echo ""
  234.         @echo '         This is a Unix-specific target.  (Just so you know.)'
  235.         @echo ""
  236.         rm -f $(OBJS) api$O apihelp$O unzipstb$O $(OBJF) $(OBJX) $(UNZIPS)
  237.  
  238. install:        $(UNZIPS) $(MANS)
  239.         $(INSTALL) $(UNZIPS) $(BINDIR)
  240.         $(RM) $(BINDIR)/zipinfo$E
  241.         $(LN) $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E
  242.         $(INSTALL) man/unzip.1 $(MANDIR)/unzip.$(manext)
  243.         $(INSTALL) man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
  244.         $(INSTALL) man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
  245.         $(INSTALL) man/funzip.1 $(MANDIR)/funzip.$(manext)
  246.         $(CHMOD) 755  $(INSTALLEDBIN)
  247.         $(CHMOD) 644  $(INSTALLEDMAN)
  248.  
  249. # alternatively, could use zip method:  -cd $(BINDIR); rm -f $(UNZIPS)  [etc.]
  250. uninstall:
  251.         rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
  252.  
  253.  
  254. TESTZIP = testmake.zip  # the test zipfile
  255.  
  256. # test some basic features of the build
  257. test:           check
  258.  
  259. check:  unzips
  260.         @echo '  This is a Unix-specific target.  (Just so you know.)'
  261.         if test ! -f $(TESTZIP); then \
  262.                 echo "  error:  can't find test file $(TESTZIP)"; exit 1; fi
  263. #
  264.         echo "  testing extraction"
  265.         ./unzip -b $(TESTZIP) testmake.zipinfo
  266.         if test $? ; then \
  267.             echo "  error:  file extraction from $(TESTZIP) failed"; exit 1; fi
  268. #
  269.         echo '  testing zipinfo (unzip -Z)'
  270.         ./unzip -Z $(TESTZIP) > testmake.unzip-Z
  271.         if diff testmake.unzip-Z testmake.zipinfo; then ;; else \
  272.             echo '  error:  zipinfo output doesn't match stored version'; fi
  273.         $(RM) testmake.unzip-Z testmake.zipinfo
  274. #
  275.         echo '  testing unzip -d exdir option'
  276.         ./unzip -b $(TESTZIP) -d testun
  277.         cat testun/notes
  278. #
  279.         echo '  testing unzip -o and funzip (ignore funzip warning)'
  280.         ./unzip -boq $(TESTZIP) notes -d testun
  281.         ./funzip < $(TESTZIP) > testun/notes2
  282.         if diff testun/notes testun/notes2; then ;; else \
  283.             echo 'error:  funzip output disagrees with unzip'; fi
  284. #
  285.         echo '  testing unzipsfx (self-extractor)'
  286.         cat unzipsfx $(TESTZIP) > testsfx
  287.         $(CHMOD) 0700 testsfx
  288.         ./testsfx -b notes
  289.         if diff notes testun/notes; then ;; else \
  290.             echo '  error:  unzipsfx file disagrees with unzip'; fi
  291.         $(RM) testsfx notes testun/notes testun/notes2
  292.         rmdir testun
  293. #
  294.         echo '  testing complete.'
  295.  
  296.  
  297. ################################
  298. # INDIVIDUAL MACHINE MAKERULES #
  299. ################################
  300.  
  301. # these are left over for backward compatibility/convenience
  302.  
  303. generic:        unzips
  304. atari:          unzips
  305.