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