home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / zip22.zip / unix / Makefile < prev    next >
Makefile  |  1997-10-24  |  7KB  |  222 lines

  1. # Makefile for Zip, ZipNote, ZipCloak and ZipSplit
  2.  
  3. # what you can make ...
  4. all:
  5.     @echo ''
  6.     @echo 'Make what?  You must say what system to make Zip for--e.g.'
  7.     @echo '"make generic".  Choices: generic, generic_gcc,'
  8.     @echo 'att6300nodir, coherent, cray_v3, minix, qnx, solaris, solaris_gcc'
  9.     @echo 'See the files INSTALL and zip.txt for more information.'
  10.     @echo ''
  11.  
  12. list:   all
  13.  
  14. MAKE = make -f unix/Makefile
  15. SHELL = /bin/sh
  16. LN = ln -s
  17.  
  18. # (to use the Gnu compiler, change cc to gcc in CC)
  19. CC = cc
  20. BIND = $(CC)
  21. AS = $(CC) -c
  22. E =
  23. CPP = /lib/cpp
  24.  
  25. # probably can change this to 'install' if you have it
  26. INSTALL = cp
  27. # probably can change this to 'install -d' if you have it
  28. INSTALL_D = mkdir -p
  29.  
  30. # target directories - where to install executables and man pages to
  31. prefix = /usr/local
  32. BINDIR = $(prefix)/bin
  33. manext=1
  34. MANDIR = $(prefix)/man/man$(manext)
  35. ZIPMANUAL = MANUAL
  36. PKGDIR = IZzip
  37. VERSION = Version 2.2
  38.  
  39. # flags
  40. #   CFLAGS    flags for C compile
  41. #   LFLAGS1   flags after output file spec, before obj file list
  42. #   LFLAGS2   flags after obj file list (libraries, etc)
  43. CFLAGS = -O -I. -DUNIX $(LOCAL_ZIP)
  44. LFLAGS1 =
  45. LFLAGS2 = -s
  46.  
  47. # object file lists
  48. OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
  49.        unix.o crc32.o crctab.o
  50. OBJI = deflate.o trees.o bits.o
  51. OBJA =
  52. OBJU = zipfile_.o fileio_.o util_.o globals.o unix_.o
  53. OBJN = zipnote.o  $(OBJU)
  54. OBJC = zipcloak.o $(OBJU) crctab.o crypt_.o ttyio.o
  55. OBJS = zipsplit.o $(OBJU)
  56.  
  57. ZIP_H = zip.h ziperr.h tailor.h unix/osdep.h
  58.  
  59. # suffix rules
  60. .SUFFIXES:
  61. .SUFFIXES: _.o .o .c .doc .1
  62. .c_.o:
  63.     rm -f $*_.c; $(LN) $< $*_.c
  64.     $(CC) -c $(CFLAGS) -DUTIL $*_.c
  65.     rm -f $*_.c
  66. .c.o:
  67.     $(CC) -c $(CFLAGS) $<
  68.  
  69. .1.doc:
  70.     nroff -man $< | col -b | uniq > $@
  71.  
  72. # rules for zip, zipnote, zipcloak, zipsplit, and the Zip MANUAL.
  73. $(OBJZ): $(ZIP_H)
  74. $(OBJI): $(ZIP_H)
  75. $(OBJN): $(ZIP_H)
  76. $(OBJS): $(ZIP_H)
  77. $(OBJC): $(ZIP_H)
  78. zip.o zipup.o crypt.o ttyio.o bits.o zipcloak.o crypt_.o: crypt.h
  79. zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
  80. zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
  81. zipup.o: unix/zipup.h
  82.  
  83. match.o: match.S
  84.     $(CPP) match.S > _match.s
  85.     $(AS) _match.s
  86.     mv _match.o match.o
  87.     rm -f _match.s
  88.  
  89. crc_i386.o: crc_i386.S
  90.     $(CPP) crc_i386.S > crc_i386.s
  91.     $(AS) crc_i386.s
  92.     rm -f crc_i386.s
  93.  
  94. unix.o: unix/unix.c
  95.     $(CC) -c $(CFLAGS) unix/unix.c
  96.  
  97. unix_.o: unix/unix.c
  98.     rm -f unix_.c; $(LN) unix/unix.c unix_.c
  99.     $(CC) -c $(CFLAGS) -DUTIL unix_.c
  100.     rm -f unix_.c
  101.  
  102. ZIPS = zip$E zipnote$E zipsplit$E zipcloak$E
  103.  
  104. zips: $(ZIPS)
  105. zipsman: $(ZIPS) $(ZIPMANUAL)
  106.  
  107. zip$E: $(OBJZ) $(OBJI) $(OBJA)
  108.     $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
  109. zipnote$E: $(OBJN)
  110.     $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
  111. zipcloak$E: $(OBJC)
  112.     $(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
  113. zipsplit$E: $(OBJS)
  114.     $(BIND) -o zipsplit$E $(LFLAGS1) $(OBJS) $(LFLAGS2)
  115.  
  116. $(ZIPMANUAL): man/zip.1
  117.     nroff -man man/zip.1 | col -b | uniq > $(ZIPMANUAL)
  118.  
  119.  
  120. # install
  121. install:        $(ZIPS)
  122.     -$(INSTALL_D) $(BINDIR)
  123.     $(INSTALL) $(ZIPS) $(BINDIR)
  124.     -$(INSTALL_D) $(MANDIR)
  125.     $(INSTALL) man/zip.1 $(MANDIR)/zip.$(manext)
  126.  
  127. uninstall:
  128.     -cd $(BINDIR); rm -f $(ZIPS)
  129.     -cd $(MANDIR); rm -f zip.$(manext)
  130.  
  131. flags:  unix/configure
  132.     sh unix/configure "${CC}" "${CFLAGS}"
  133.  
  134. # These symbols, when #defined using -D have these effects on compilation:
  135. # ZMEM                  - includes C language versions of memset(), memcpy(),
  136. #                         and memcmp() (util.c).
  137. # HAVE_DIRENT_H         - use <dirent.h> instead of <sys/dir.h>
  138. # NODIR                 - for 3B1, which has neither getdents() nor opendir().
  139. # HAVE_NDIR_H           - use <ndir.h> (unix/unix.c).
  140. # HAVE_SYS_DIR_H        - use <sys/dir.h>
  141. # HAVE_SYS_NDIR_H       - use <sys/ndir.h>
  142. # UTIL                  - select routines for utilities (note, cloak, split)
  143. # NO_RMDIR              - remove directories using a system("rmdir ...") call.
  144. # NO_PROTO              - cannot handle ANSI prototypes
  145. # NO_CONST              - cannot handle ANSI const
  146.  
  147. #               Generic targets:
  148.  
  149. generic: flags
  150.     eval $(MAKE) zips `cat flags`
  151.  
  152. generic_gcc:
  153.     $(MAKE) generic CC=gcc CPP="gcc -E"
  154.  
  155. # AT&T 6300 PLUS (don't know yet how to allocate 64K bytes):
  156. att6300nodir:
  157.     $(MAKE) zips LFLAGS1="-Ml -s" \
  158.     CFLAGS="-DUNIX -I. -O -Ml -DNO_RMDIR -DDYN_ALLOC -DMEDIUM_MEM \
  159. -DWSIZE=16384 -DNO_STDLIB_H -DNO_STDDEF_H -DNO_RENAME \
  160. -DNO_MKTIME -DNO_SIZE_T -DNO_VOID -DNO_PROTO -DNO_DIR \
  161. -DNO_CONST -DHAVE_TERMIO_H" \
  162.     "LFLAGS2="
  163.  
  164. # Coherent (AS definition not needed for gcc)
  165. coherent:
  166.     $(MAKE) zips CFLAGS="-DUNIX -I. -O -DDIRENT -DASMV" AS="as -gx" \
  167.                      OBJA=match.o
  168.  
  169. # Cray Unicos 6.1, Standard C compiler 3.0 (all routines except trees.c
  170. # may be compiled with vector3; internal compiler bug in 3.0.2.3 and
  171. # earlier requires vector2 for trees.c)
  172. cray_v3:
  173.     $(MAKE) zips CC="scc" \
  174.                 CFLAGS="-DUNIX -I. -O -h vector2 -h scalar3 -DHAVE_DIRENT_H"
  175.  
  176. # MINIX 1.5.10 with Bruce Evans 386 patches and gcc/GNU make
  177. minix:
  178.     $(MAKE) zips CFLAGS="-DUNIX -I. -O -DDIRENT -DMINIX" CC=gcc
  179.     chmem =262144 zip
  180.  
  181. # QNX is "special" because out /bin/sh is ksh and it doesn't grok the
  182. # configure script properly, generating a bad flags file.  D'oh! [cjh]
  183. qnx:
  184.     $(MAKE) zips CC=cc CFLAGS="-DUNIX -I. -O -DHAVE_DIRENT_H \
  185. -DHAVE_TERMIOS_H -DNO_MKTEMP"
  186.  
  187. # Solaris:  Generic, plus generation of installable package.
  188. solaris:    generic svr4package
  189.  
  190. # Solaris with GCC: generic_gcc, plus generation of installable package
  191. solaris_gcc:    generic_gcc svr4package
  192.  
  193. # Package generation interface (by JBush). Originally tested under Sun Solaris.
  194. # Other SVr4s may be very similar, and could possibly use this.
  195. # Note:  Expects version info to be stored in VERSION macro variable.
  196. # See "README" under ./unix/Packaging
  197. svr4package:
  198.     @echo "Creating SVR4 package for Unix ..."
  199.     -@rm -rf ./$(PKGDIR) ./$(PKGDIR)_`uname -p`.pkg
  200.     -@sed -e "s/.VERSION./$(VERSION)/g" \
  201.           -e "s/.PSTAMP./$(LOGNAME)_`date | tr  ' ' '_'`/g" \
  202.           -e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
  203.           ./unix/Packaging/pkginfo.in > ./unix/Packaging/pkginfo
  204.     -@sed -e "s/.ARCH./`uname -p`/g" \
  205.           ./unix/Packaging/preinstall.in > ./unix/Packaging/preinstall
  206.     /usr/bin/pkgmk -d . -b . -r . -f ./unix/Packaging/prototype $(PKGDIR)
  207.     /usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
  208.     @echo " "
  209.     @echo "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
  210.     @echo "issue the command (as root):  pkgadd -d $(PKGDIR)_`uname -p`.pkg"
  211.     @echo " "
  212.  
  213. # make a distribution
  214. dist:    $(ZIPMANUAL)
  215.     eval zip -r9 zip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
  216.               -e 's/[.]//g' -e 's/ .*//g' -e q revision.h` *
  217.  
  218. # clean up after making stuff and installing it
  219. clean:
  220.     rm -f *.o $(ZIPS) flags
  221.     rm -rf $(PKGDIR)
  222.