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