Debian Codegraph @

unix/Makefile

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