Makefile 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. # Makefile for Zip, ZipNote, ZipCloak and ZipSplit
  2. # what you can make ...
  3. all:
  4. @echo ''
  5. @echo 'Make what? You must say what system to make Zip for--e.g.'
  6. @echo '"make generic".'
  7. @echo 'Choices: generic, generic_gcc, att6300nodir,'
  8. @echo 'coherent, cray_v3, cygwin, lynx, minix, os390,'
  9. @echo 'qnx, qnxnto, solaris, solaris_gcc'
  10. @echo 'Try first "make -f unix/Makefile generic" as'
  11. @echo 'it should autodetect and set the proper flags.'
  12. @echo 'To make the manuals use "make zipsman" after Zip is made.'
  13. @echo 'See the files INSTALL and zip.txt for more information.'
  14. @echo ''
  15. list: all
  16. #MAKE = make -f unix/Makefile
  17. MAKEF = -f unix/Makefile
  18. SHELL = /bin/sh
  19. LN = ln -s
  20. # (to use the GNU compiler, change cc to gcc in CC)
  21. CC = cc
  22. BIND = $(CC)
  23. AS = $(CC) -c
  24. CPP = /lib/cpp
  25. E =
  26. # probably can change this to 'install' if you have it
  27. INSTALL_PROGRAM = cp
  28. # probably can change this to 'install -d' if you have it
  29. # XXX NextStep 3.3 and Openstep 4.x don't know about -p !
  30. INSTALL_D = mkdir -p
  31. CHMOD = chmod
  32. BINFLAGS = 755
  33. MANFLAGS = 644
  34. # target directories - where to install executables and man pages to
  35. prefix = /usr/local
  36. BINDIR = $(prefix)/bin
  37. MANEXT=1
  38. MANDIR = $(prefix)/man/man$(MANEXT)
  39. ZIPMANUAL = zip.txt
  40. ZIPMANUALcloak = zipcloak.txt
  41. ZIPMANUALnote = zipnote.txt
  42. ZIPMANUALsplit = zipsplit.txt
  43. ZIPMANUALs = zip.txt zipcloak.txt zipnote.txt zipsplit.txt
  44. PKGDIR = IZzip
  45. VERSION = Version 3.0
  46. # Our bzip2 directory
  47. IZ_OUR_BZIP2_DIR = bzip2
  48. # flags
  49. # CFLAGS flags for C compile
  50. # LFLAGS1 flags after output file spec, before obj file list
  51. # LFLAGS2 flags after obj file list (libraries, etc)
  52. CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)
  53. CFLAGS = -O2 $(CFLAGS_NOOPT)
  54. LFLAGS1 =
  55. LFLAGS2 = -s
  56. # object file lists
  57. OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \
  58. unix.o crc32.o zbz2err.o
  59. OBJI = deflate.o trees.o
  60. OBJA =
  61. OCRCU8 =
  62. OCRCTB = crc32_.o
  63. OBJU = zipfile_.o fileio_.o util_.o globals.o unix_.o $(OCRCU8)
  64. OBJN = zipnote.o $(OBJU)
  65. OBJC = zipcloak.o $(OBJU) $(OCRCTB) crypt_.o ttyio.o
  66. OBJS = zipsplit.o $(OBJU)
  67. ZIP_H = zip.h ziperr.h tailor.h unix/osdep.h
  68. # suffix rules
  69. .SUFFIXES:
  70. .SUFFIXES: _.o .o .c .doc .1
  71. .c_.o:
  72. $(CC) -c $(CFLAGS) -DUTIL -o $@ $<
  73. .c.o:
  74. $(CC) -c $(CFLAGS) $<
  75. .1.doc:
  76. nroff -man $< | col -bx | uniq > $@
  77. # rules for zip, zipnote, zipcloak, zipsplit, and the Zip MANUALs.
  78. $(OBJZ): $(ZIP_H)
  79. $(OBJI): $(ZIP_H)
  80. $(OBJN): $(ZIP_H)
  81. $(OBJS): $(ZIP_H)
  82. $(OBJC): $(ZIP_H)
  83. zip.o zipup.o zipfile.o fileio.o crc32.o crypt.o: crc32.h
  84. zipcloak.o zipfile_.o fileio_.o crc32_.o crypt_.o: crc32.h
  85. zip.o zipup.o crypt.o ttyio.o zipcloak.o crypt_.o: crypt.h
  86. zip.o zipup.o zipnote.o zipcloak.o zipsplit.o: revision.h
  87. zip.o crypt.o ttyio.o zipcloak.o crypt_.o: ttyio.h
  88. zipup.o: unix/zipup.h
  89. match.o: match.S
  90. $(CPP) match.S > _match.s
  91. $(AS) _match.s
  92. mv _match.o match.o
  93. rm -f _match.s
  94. crc_i386.o: crc_i386.S
  95. $(CPP) crc_i386.S > _crc_i386.s
  96. $(AS) _crc_i386.s
  97. mv _crc_i386.o crc_i386.o
  98. rm -f _crc_i386.s
  99. unix.o: unix/unix.c
  100. $(CC) -c $(CFLAGS) unix/unix.c
  101. unix_.o: unix/unix.c
  102. $(CC) -c $(CFLAGS) -DUTIL -o $@ unix/unix.c
  103. ZIPS = zip$E zipcloak$E zipnote$E zipsplit$E
  104. zips: $(ZIPS)
  105. zipsman: $(ZIPS) $(ZIPMANUALs)
  106. zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ)
  107. $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2)
  108. zipnote$E: $(OBJN)
  109. $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2)
  110. zipcloak$E: $(OBJC) $(OCRCTB)
  111. $(BIND) -o zipcloak$E $(LFLAGS1) $(OBJC) $(LFLAGS2)
  112. zipsplit$E: $(OBJS)
  113. $(BIND) -o zipsplit$E $(LFLAGS1) $(OBJS) $(LFLAGS2)
  114. $(ZIPMANUAL): man/zip.1
  115. nroff -man man/zip.1 | col -bx | uniq > $(ZIPMANUAL)
  116. $(ZIPMANUALcloak): man/zipcloak.1
  117. nroff -man man/zipcloak.1 | col -bx | uniq > $(ZIPMANUALcloak)
  118. $(ZIPMANUALnote): man/zipnote.1
  119. nroff -man man/zipnote.1 | col -bx | uniq > $(ZIPMANUALnote)
  120. $(ZIPMANUALsplit): man/zipsplit.1
  121. nroff -man man/zipsplit.1 | col -bx | uniq > $(ZIPMANUALsplit)
  122. # bzip2 object library
  123. $(IZ_OUR_BZIP2_DIR)/libbz2.a : $(IZ_OUR_BZIP2_DIR)/Makefile
  124. @echo "Building bzip2 object library..."
  125. ( cd $(IZ_OUR_BZIP2_DIR); \
  126. $(MAKE) CC="$(CC_BZ)" CFLAGS="$(CFLAGS_BZ)" libbz2.a )
  127. @echo " bzip2 object library created."
  128. # install
  129. install: $(ZIPS)
  130. -$(INSTALL_D) $(BINDIR)
  131. $(INSTALL_PROGRAM) $(ZIPS) $(BINDIR)
  132. -cd $(BINDIR); $(CHMOD) $(BINFLAGS) $(ZIPS)
  133. -$(INSTALL_D) $(MANDIR)
  134. $(INSTALL_PROGRAM) man/zip.1 $(MANDIR)/zip.$(MANEXT)
  135. $(CHMOD) $(MANFLAGS) $(MANDIR)/zip.$(MANEXT)
  136. $(INSTALL_PROGRAM) man/zipcloak.1 $(MANDIR)/zipcloak.$(MANEXT)
  137. $(CHMOD) $(MANFLAGS) $(MANDIR)/zipcloak.$(MANEXT)
  138. $(INSTALL_PROGRAM) man/zipnote.1 $(MANDIR)/zipnote.$(MANEXT)
  139. $(CHMOD) $(MANFLAGS) $(MANDIR)/zipnote.$(MANEXT)
  140. $(INSTALL_PROGRAM) man/zipsplit.1 $(MANDIR)/zipsplit.$(MANEXT)
  141. $(CHMOD) $(MANFLAGS) $(MANDIR)/zipsplit.$(MANEXT)
  142. uninstall:
  143. -cd $(BINDIR); rm -f $(ZIPS)
  144. -cd $(MANDIR); rm -f \
  145. zip.$(MANEXT) zipcloak.$(MANEXT) zipnote.$(MANEXT) zipsplit.$(MANEXT)
  146. flags: unix/configure
  147. sh unix/configure "${CC}" "${CFLAGS_NOOPT}" "${IZ_BZIP2}"
  148. # These symbols, when #defined using -D have these effects on compilation:
  149. # ZMEM - includes C language versions of memset(), memcpy(),
  150. # and memcmp() (util.c).
  151. # HAVE_DIRENT_H - use <dirent.h> instead of <sys/dir.h>
  152. # NODIR - for 3B1, which has neither getdents() nor opendir().
  153. # HAVE_NDIR_H - use <ndir.h> (unix/unix.c).
  154. # HAVE_SYS_DIR_H - use <sys/dir.h>
  155. # HAVE_SYS_NDIR_H - use <sys/ndir.h>
  156. # UTIL - select routines for utilities (note, cloak, split)
  157. # NO_RMDIR - remove directories using a system("rmdir ...") call.
  158. # NO_PROTO - cannot handle ANSI prototypes
  159. # NO_CONST - cannot handle ANSI const
  160. # NO_LARGE_FILE_SUPPORT - do not enable Large File support even if available.
  161. # NO_ZIP64_SUPPORT - do not enable Zip64 archive support even if available.
  162. # NO_UNICODE_SUPPORT - do not enable Unicode support even if available.
  163. # NO_BZIP2_SUPPORT - do not compile in bzip2 code even if available.
  164. # Generic targets:
  165. generic: flags
  166. eval $(MAKE) $(MAKEF) zips `cat flags`
  167. generic_gcc:
  168. $(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E"
  169. # AT&T 6300 PLUS (don't know yet how to allocate 64K bytes):
  170. att6300nodir:
  171. $(MAKE) $(MAKEF) zips LFLAGS1="-Ml -s" \
  172. CFLAGS="-DUNIX -I. -O -Ml -DNO_RMDIR -DDYN_ALLOC -DMEDIUM_MEM \
  173. -DWSIZE=16384 -DNO_STDLIB_H -DNO_STDDEF_H -DNO_RENAME \
  174. -DNO_MKTIME -DNO_SIZE_T -DNO_VOID -DNO_PROTO -DNO_DIR \
  175. -DNO_CONST -DHAVE_TERMIO_H" \
  176. "LFLAGS2="
  177. # Coherent (AS definition not needed for gcc)
  178. coherent:
  179. $(MAKE) $(MAKEF) zips CFLAGS="-DUNIX -I. -O -DDIRENT -DASMV" \
  180. AS="as -gx" OBJA=match.o
  181. # Cray Unicos 6.1, Standard C compiler 3.0 (all routines except trees.c
  182. # may be compiled with vector3; internal compiler bug in 3.0.2.3 and
  183. # earlier requires vector2 for trees.c)
  184. cray_v3:
  185. $(MAKE) $(MAKEF) zips CC="scc" \
  186. CFLAGS="-DUNIX -I. -O -h vector2 -h scalar3 -DHAVE_DIRENT_H"
  187. # Cygwin
  188. cygwin:
  189. $(MAKE) $(MAKEF) generic CC="gcc" CPP="gcc -E" EXE=".exe"
  190. # LynxOS
  191. lynx:
  192. $(MAKE) $(MAKEF) generic CC=gcc CPP="gcc -E" CFLAGS="$(CFLAGS) \
  193. -DNO_UNDERLINE -DLynx -DLYNX LFLAGS2="$LFLAGS2 -lc_p"
  194. # MINIX 1.5.10 with Bruce Evans 386 patches and gcc/GNU make
  195. minix:
  196. $(MAKE) $(MAKEF) zips CFLAGS="-DUNIX -I. -O -DDIRENT -DMINIX" CC=gcc
  197. chmem =262144 zip
  198. # IBM OS/390 (formerly MVS) compiled under "OpenEdition" shell
  199. # You can make the zip executable with IBM's make, but you will
  200. # get errors dealing with the _.o targets for the other executables
  201. # (zipcloak, etc). GNU make will build all the executables.
  202. # If you have GNU make in your path as gmake, you can uncomment
  203. # the following, but it shouldn't be needed:
  204. #MAKE = gmake
  205. os390:
  206. $(MAKE) $(MAKEF) zips CFLAGS="$(CF) -I. -DUNIX -DOS390 -DEBCDIC \
  207. -DSYSV -DNO_PARAM_H" LFLAGS2=""
  208. # QNX is "special" because out /bin/sh is ksh and it doesn't grok the
  209. # configure script properly, generating a bad flags file. D'oh! [cjh]
  210. #
  211. # QNX/Neutrino is "special" because you don't have any native development
  212. # tools yet. Set ARCH to "x86", "ppcbe", "ppcle", "mipsbe", or "mipsle"
  213. # to produce x86, PowerPC (big- or little-endian) and MIPS (big-
  214. # or little-endian) using gcc. [cjh]
  215. qnx:
  216. $(MAKE) $(MAKEF) zips LN=ln CC=cc CFLAGS="-DUNIX -I. -O \
  217. -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DNO_MKTEMP"
  218. qnxnto:
  219. @if [ "$(ARCH)" = "" ] ; then \
  220. echo "You didn't set ARCH; I'll assume you meant ARCH=x86..." ; \
  221. echo "" ; \
  222. $(MAKE) $(MAKEF) zips LN=ln CC="qcc -Vgcc_ntox86" \
  223. CFLAGS="-g -DUNIX -I. -O -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DNO_MKTEMP" \
  224. LFLAGS2=-g ; \
  225. else \
  226. echo "Making zip for $(ARCH)..." ; \
  227. echo "" ; \
  228. $(MAKE) $(MAKEF) zips LN=ln CC="qcc -Vgcc_nto$(ARCH)" \
  229. CFLAGS="-g -DUNIX -I. -O -DHAVE_DIRENT_H -DHAVE_TERMIOS_H -DNO_MKTEMP" \
  230. LFLAGS2=-g ; \
  231. fi
  232. # Solaris: Generic, plus generation of installable package.
  233. solaris: generic svr4package
  234. # Solaris with GCC: generic_gcc, plus generation of installable package
  235. solaris_gcc: generic_gcc svr4package
  236. # Package generation interface (by JBush). Originally tested under Sun Solaris.
  237. # Other SVr4s may be very similar, and could possibly use this.
  238. # Note: Expects version info to be stored in VERSION macro variable.
  239. # See "README" under ./unix/Packaging
  240. svr4package:
  241. @echo "Creating SVR4 package for Unix ..."
  242. -@rm -rf ./$(PKGDIR) ./$(PKGDIR)_`uname -p`.pkg
  243. -@sed -e "s/.VERSION./$(VERSION)/g" \
  244. -e "s/.PSTAMP./$(LOGNAME)_`date | tr ' ' '_'`/g" \
  245. -e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
  246. ./unix/Packaging/pkginfo.in > ./unix/Packaging/pkginfo
  247. -@sed -e "s/.ARCH./`uname -p`/g" \
  248. ./unix/Packaging/preinstall.in > ./unix/Packaging/preinstall
  249. /usr/bin/pkgmk -d . -b . -r . -f ./unix/Packaging/prototype $(PKGDIR)
  250. /usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
  251. @echo " "
  252. @echo "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
  253. @echo "issue the command (as root): pkgadd -d $(PKGDIR)_`uname -p`.pkg"
  254. @echo " "
  255. # make a distribution
  256. dist: $(ZIPMANUAL)
  257. eval zip -r9 zip`sed -e '/VERSION/!d' -e 's/.*"\(.*\)".*/\1/' \
  258. -e 's/[.]//g' -e 's/ .*//g' -e q revision.h` *
  259. # clean up after making stuff and installing it
  260. clean:
  261. rm -f *.o $(ZIPS) flags
  262. rm -rf $(PKGDIR)
  263. clean_bzip2 :
  264. @if test -f "$(IZ_OUR_BZIP2_DIR)/Makefile"; then \
  265. ( cd $(IZ_OUR_BZIP2_DIR); make clean ); \
  266. else \
  267. if test -z "$(IZ_OUR_BZIP2_DIR)"; then \
  268. echo "No bzip2 directory (\"IZ_OUR_BZIP2_DIR\") specified."; \
  269. else \
  270. echo "No bzip2 make file found: $(IZ_OUR_BZIP2_DIR)/Makefile."; \
  271. fi; \
  272. fi
  273. clean_exe :
  274. rm -f $(ZIPS)
  275. #