1#==============================================================================
2# Makefile for UnZip, UnZipSFX and fUnZip:  Unix and MS-DOS ("real" makes only)
3# Version:  6.0                                                     18 Jan 2009
4#==============================================================================
5
6include config.mk
7include config.in
8
9# INSTRUCTIONS (such as they are):
10#
11# "make sunos"	-- makes UnZip in current directory on a generic SunOS 4.x Sun
12# "make list"	-- lists all supported systems (targets)
13# "make help"	-- provides pointers on what targets to try if problems occur
14# "make wombat" -- chokes and dies if you haven't added the specifics for your
15#		    Wombat 68000 (or whatever) to the systems list
16#
17# CF are flags for the C compiler.  LF are flags for the loader.  LF2 are more
18# flags for the loader, if they need to be at the end of the line instead of at
19# the beginning (for example, some libraries).  FL and FL2 are the corre-
20# sponding flags for fUnZip.  LOCAL_UNZIP is an environment variable that can
21# be used to add default C flags to your compile without editing the Makefile
22# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
23#
24# Some versions of make do not define the macro "$(MAKE)"; this is rare, but
25# if things don't work, try using "make" instead of "$(MAKE)" in your system's
26# makerule.  Or try adding the following line to your .login file:
27#	setenv MAKE "make"
28# (That never works--makes that are too stupid to define MAKE are also too
29# stupid to look in the environment--but try it anyway for kicks. :-) )
30#
31# Memcpy and memset are provided for those systems that don't have them; they
32# are in fileio.c and will be used if -DZMEM is included in CF.  These days
33# almost all systems have them.
34#
35# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
36# tion does not always imply a working program.
37
38
39#####################
40# MACRO DEFINITIONS #
41#####################
42
43# Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
44# such as -DDOSWILD).
45
46# UnZip flags
47#CC = cc#	try using "gcc" target rather than changing this (CC and LD
48LD = $(CC)#	must match, else "unresolved symbol:  ___main" is possible)
49##AS = as
50LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
51AF = $(LOC)
52CFLAGS = -O
53CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC)
54CF = $(CFLAGS) $(CF_NOOPT)
55#LFLAGS1 =
56LF = -o unzip$E $(LFLAGS1)
57LF2 = -s
58
59# UnZipSFX flags
60SL = -o unzipsfx$E $(LFLAGS1)
61SL2 = $(LF2)
62
63# fUnZip flags
64FL = -o funzip$E $(LFLAGS1)
65FL2 = $(LF2)
66
67# general-purpose stuff
68#CP = cp
69CP = ln
70LN = ln
71RM = rm -f
72CHMOD = chmod
73BINPERMS = 755
74MANPERMS = 644
75STRIP = strip
76E =
77O = .o
78M = unix
79SHELL = /bin/sh
80MAKEF = -f unix/Makefile
81
82# Version info for unix/unix.c
83HOST_VERSINFO=-DIZ_CC_NAME='\"\$$(CC) \"' -DIZ_OS_NAME='\"`uname -a`\"'
84
85# defaults for crc32 stuff and system dependent headers
86CRCA_O =
87OSDEP_H = unix/unxcfg.h
88# default for dependency on auto-configure result, is an empty symbol
89# so that the static non-autoconfigure targets continue to work
90ACONF_DEP =
91
92# optional inclusion of bzip2 decompression
93IZ_OUR_BZIP2_DIR = bzip2
94IZ_BZIP2 = $(IZ_OUR_BZIP2_DIR)
95## The following symbols definitions need to be set to activate bzip2 support:
96#D_USE_BZ2 = -DUSE_BZIP2
97#L_BZ2 = -lbz2
98#LIBBZ2 = $(IZ_BZIP2)/libbz2.a
99
100# defaults for unzip's "built-in" bzip2 library compilation
101CC_BZ = $(CC)
102CFLAGS_BZ = $(CFLAGS)
103
104# object files
105OBJS1 = unzip$O crc32$O $(CRCA_O) crypt$O envargs$O explode$O
106OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
107OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
108OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
109LOBJS = $(OBJS)
110OBJSDLL = $(OBJS:.o=.pic.o) api.pic.o
111OBJX = unzipsfx$O crc32_$O $(CRCA_O) crypt_$O extract_$O fileio_$O \
112	globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
113LOBJX = $(OBJX)
114OBJF = funzip$O crc32$O $(CRCA_O) cryptf$O globalsf$O inflatef$O ttyiof$O
115#OBJS_OS2 = $(OBJS1:.o=.obj) $(OBJS2:.o=.obj) os2.obj
116#OBJF_OS2 = $(OBJF:.o=.obj)
117UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H) $(ACONF_DEP)
118
119# installation
120# (probably can change next two to `install' and `install -d' if you have it)
121INSTALL = cp
122INSTALL_PROGRAM = $(INSTALL)
123INSTALL_D = mkdir -p
124# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
125manext = 1
126prefix = $(TARGETDIR)/usr/sbin
127BINDIR = $(prefix)#			where to install executables
128MANDIR = $(prefix)/man/man$(manext)#	where to install man pages
129INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/unzip$E $(BINDIR)/unzipsfx$E \
130	$(BINDIR)/zipgrep$E $(BINDIR)/zipinfo$E
131INSTALLEDMAN = $(MANDIR)/funzip.$(manext) $(MANDIR)/unzip.$(manext) \
132	$(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipgrep.$(manext) \
133	$(MANDIR)/zipinfo.$(manext)
134
135# Solaris 2.x stuff:
136PKGDIR = IZunzip
137VERSION = Version 6.0
138
139UNZIPS = unzip$E funzip$E unzipsfx$E
140# this is a little ugly...well, OK, it's a lot ugly:
141MANS = man/funzip.1 man/unzip.1 man/unzipsfx.1 man/zipgrep.1 man/zipinfo.1
142DOCS = funzip.txt unzip.txt unzipsfx.txt zipgrep.txt zipinfo.txt
143
144# list of supported systems/targets in this version
145SYSTEMG1 = generic generic_gcc  generic_pkg generic_gccpkg
146SYSTEMG2 = generic1 generic2 generic3 generic_bz2 generic_zlib generic_shlib
147SYSTEMS1 = 386i 3Bx 7300 7300_gcc aix aix_rt amdahl amdahl_eft apollo aviion
148SYSTEMS2 = bsd bsdi bsdi_noasm bull coherent convex cray cray_opt cyber_sgi
149SYSTEMS3 = cygwin dec dnix encore eta freebsd gcc gould hk68 hp hpux
150SYSTEMS4 = isc isc_gcc isi linux linux_dos linux_noasm linux_shlib linux_shlibz
151SYSTEMS5 = lynx macosx macosx_gcc minix mips mpeix next next10 next2x next3x
152SYSTEMS6 = nextfat osf1 pixel ptx pyramid qnxnto realix regulus rs6000 sco
153SYSTEMS7 = sco_dos sco_sl sco_x286 sequent sgi solaris solaris_pkg stardent
154SYSTEMS8 = stellar sunos3 sunos4 sysv sysv_gcc sysv6300 tahoe ti_sysv ultrix
155SYSTEMS9 = vax v7 wombat xenix xos
156
157
158####################
159# DEFAULT HANDLING #
160####################
161
162# By default, print help on which makefile targets to try.  (The SYSTEM
163# variable is no longer supported; use "make <target>" instead.)
164
165help:
166	@echo ""
167	@echo "  If you're not sure about the characteristics of your system, try typing"
168	@echo "  \"make generic\".  This is new and uses the configure script, though it is"
169	@echo "  still being worked on."
170	@echo ""
171	@echo "  If that does not do it, try the original generic which is \"make generic1\"."
172	@echo ""
173	@echo "  If the compiler barfs and says something unpleasant about \"timezone redefined\","
174	@echo "  try typing \"make clean\" followed by \"make generic2\".  If, on the other"
175	@echo "  hand, it complains about an undefined symbol _ftime, try typing \"make clean\""
176	@echo "  followed by \"make generic3\"."
177	@echo ""
178	@echo "  One of these actions should produce a working copy of unzip on most Unix"
179	@echo "  systems.  If you know a bit more about the machine on which you work, you"
180	@echo "  might try \"make list\" for a list of the specific systems supported herein."
181	@echo "  (Many of them do exactly the same thing, so don't agonize too much over"
182	@echo "  which to pick if two or more sound equally likely.)  Also check out the"
183	@echo "  INSTALL file for notes on compiling various targets.  As a last resort,"
184	@echo "  feel free to read the numerous comments within the Makefile itself."
185	@echo ""
186	@echo "  Have a mostly pretty good day."
187	@echo ""
188
189list:
190	@echo ""
191	@echo\
192 'Type "make <system>", where <system> is one of the following:'
193	@echo ""
194	@echo  "	$(SYSTEMG1)"
195	@echo  "	$(SYSTEMG2)"
196	@echo ""
197	@echo  "	$(SYSTEMS1)"
198	@echo  "	$(SYSTEMS2)"
199	@echo  "	$(SYSTEMS3)"
200	@echo  "	$(SYSTEMS4)"
201	@echo  "	$(SYSTEMS5)"
202	@echo  "	$(SYSTEMS6)"
203	@echo  "	$(SYSTEMS7)"
204	@echo  "	$(SYSTEMS8)"
205	@echo  "	$(SYSTEMS9)"
206#	@echo ""
207#	@echo\
208# 'Targets for related utilities (ZipInfo and fUnZip) include:'
209#	@echo ""
210#	@echo  "	$(SYS_UTIL1)"
211#	@echo  "	$(SYS_UTIL2)"
212	@echo ""
213	@echo\
214 'For further (very useful) information, please read the comments in Makefile.'
215	@echo ""
216
217generic_msg:
218	@echo ""
219	@echo\
220 '  Attempting "make generic" now.  If this fails for some reason, type'
221	@echo\
222 '  "make help" and/or "make list" for suggestions.'
223	@echo ""
224
225
226###############################################
227# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
228###############################################
229
230# this is for GNU make; comment out and notify zip-bugs if it causes errors
231.SUFFIXES:	.c .o .obj .pic.o
232
233# yes, we should be able to use the $O macro to combine these two, but it
234# fails on some brain-damaged makes (e.g., AIX's)...no big deal
235.c.o:
236	$(CC) -c $(CF) $*.c
237
238.c.obj:
239	$(CC) -c $(CF) $*.c
240
241.c.pic.o:
242	$(CC) -c $(CF) -o $@ $*.c
243
244# this doesn't work...directories are always a pain with implicit rules
245#.1.txt:		man/$<
246#	nroff -Tman -man $< | col -b | uniq | \
247#	 sed 's/Sun Release ..../Info-ZIP        /' > $@
248
249
250# these rules may be specific to Linux (or at least the GNU groff package)
251# and are really intended only for the authors' use in creating non-Unix
252# documentation files (which are provided with both source and binary
253# distributions).  We should probably add a ".1.txt" rule for more generic
254# systems...
255
256funzip.txt:	man/funzip.1
257	nroff -Tascii -man man/funzip.1 | col -bx | uniq | expand > $@
258
259unzip.txt:	man/unzip.1
260	nroff -Tascii -man man/unzip.1 | col -bx | uniq | expand > $@
261
262unzipsfx.txt:	man/unzipsfx.1
263	nroff -Tascii -man man/unzipsfx.1 | col -bx | uniq | expand > $@
264
265zipgrep.txt:	man/zipgrep.1
266	nroff -Tascii -man man/zipgrep.1 | col -bx | uniq | expand > $@
267
268zipinfo.txt:	man/zipinfo.1
269	nroff -Tascii -man man/zipinfo.1 | col -bx | uniq | expand > $@
270
271
272all:		generic_msg generic
273unzips:		$(UNZIPS)
274objs:		$(OBJS)
275objsdll:	$(OBJSDLL)
276docs:		$(DOCS)
277unzipsman:	unzips docs
278unzipsdocs:	unzips docs
279
280
281# EDIT HERE FOR PARALLEL MAKES on Sequent (and others?)--screws up MS-DOS
282# make utilities if default:  change "unzip$E:" to "unzip$E:&"
283
284unzip$E:	$(OBJS) $(LIBBZ2)	# add `&' for parallel makes
285	$(LD) $(LF) -L$(IZ_BZIP2) $(LOBJS) $(L_BZ2) $(LF2)
286
287unzipsfx$E:	$(OBJX)			# add `&' for parallel makes
288	$(LD) $(SL) $(LOBJX) $(SL2)
289
290funzip$E:	$(OBJF)			# add `&' for parallel makes
291	$(LD) $(FL) $(OBJF) $(FL2)
292
293zipinfo$E:	unzip$E			# `&' is pointless here...
294	@echo\
295 '  This is a Unix-specific target.  ZipInfo is not enabled in some MS-DOS'
296	@echo\
297 '  versions of UnZip; if it is in yours, copy unzip.exe to zipinfo.exe'
298	@echo\
299 '  or else invoke as "unzip -Z" (in a batch file, for example).'
300	$(LN) unzip$E zipinfo$E
301
302# when the optional bzip2 support is provided (as recommended) by sources
303# in the 'bzip2' subdirectory, create/update the library:
304$(IZ_OUR_BZIP2_DIR)/libbz2.a:
305	@echo "Building/updating bzip2 object library..."
306	( cd $(IZ_OUR_BZIP2_DIR) ; $(MAKE) -f Makebz2.iz CC="$(CC_BZ)"\
307	 CFLAGS="$(CFLAGS_BZ)" RM="rm -f" )
308
309
310crc32$O:	crc32.c $(UNZIP_H) zip.h crc32.h
311crypt$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
312envargs$O:	envargs.c $(UNZIP_H)
313explode$O:	explode.c $(UNZIP_H)
314extract$O:	extract.c $(UNZIP_H) crc32.h crypt.h
315fileio$O:	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
316funzip$O:	funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
317globals$O:	globals.c $(UNZIP_H)
318inflate$O:	inflate.c inflate.h $(UNZIP_H)
319list$O:		list.c $(UNZIP_H)
320match$O:	match.c $(UNZIP_H)
321process$O:	process.c $(UNZIP_H) crc32.h
322ttyio$O:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
323ubz2err$O:	ubz2err.c $(UNZIP_H)
324unreduce$O:	unreduce.c $(UNZIP_H)
325unshrink$O:	unshrink.c $(UNZIP_H)
326unzip$O:	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
327zipinfo$O:	zipinfo.c $(UNZIP_H)
328
329# unzipsfx compilation section
330unzipsfx$O:	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
331	$(CC) -c $(CF) -DSFX -o $@ unzip.c
332
333crc32_$O:	crc32.c $(UNZIP_H) zip.h crc32.h
334	$(CC) -c $(CF) -DSFX -o $@ crc32.c
335
336crypt_$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
337	$(CC) -c $(CF) -DSFX -o $@ crypt.c
338
339extract_$O:	extract.c $(UNZIP_H) crc32.h crypt.h
340	$(CC) -c $(CF) -DSFX -o $@ extract.c
341
342fileio_$O:	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
343	$(CC) -c $(CF) -DSFX -o $@ fileio.c
344
345globals_$O:	globals.c $(UNZIP_H)
346	$(CC) -c $(CF) -DSFX -o $@ globals.c
347
348inflate_$O:	inflate.c inflate.h $(UNZIP_H) crypt.h
349	$(CC) -c $(CF) -DSFX -o $@ inflate.c
350
351match_$O:	match.c $(UNZIP_H)
352	$(CC) -c $(CF) -DSFX -o $@ match.c
353
354process_$O:	process.c $(UNZIP_H) crc32.h
355	$(CC) -c $(CF) -DSFX -o $@ process.c
356
357ttyio_$O:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
358	$(CC) -c $(CF) -DSFX -o $@ ttyio.c
359
360ubz2err_$O:	ubz2err.c $(UNZIP_H)
361	$(CC) -c $(CF) -DSFX -o $@ ubz2err.c
362
363
364# funzip compilation section
365cryptf$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
366	$(CC) -c $(CF) -DFUNZIP -o $@ crypt.c
367
368globalsf$O:	globals.c $(UNZIP_H)
369	$(CC) -c $(CF) -DFUNZIP -o $@ globals.c
370
371inflatef$O:	inflate.c inflate.h $(UNZIP_H) crypt.h
372	$(CC) -c $(CF) -DFUNZIP -o $@ inflate.c
373
374ttyiof$O:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
375	$(CC) -c $(CF) -DFUNZIP -o $@ ttyio.c
376
377
378# optional assembler replacements
379crc_i86$O:	msdos/crc_i86.asm				# 16bit only
380	$(AS) $(AF) msdos/crc_i86.asm $(ASEOL)
381
382crc_gcc$O:	crc_i386.S $(ACONF_DEP)				# 32bit, GNU AS
383	$(AS) $(AF) -x assembler-with-cpp -c -o $@ crc_i386.S
384
385crc_gcc.pic.o:	crc_i386.S $(ACONF_DEP)				# 32bit, GNU AS
386	$(AS) $(AF) -x assembler-with-cpp -c -o $@ crc_i386.S
387
388crc_sysv$O:	crc_i386.S $(ACONF_DEP)				# 32bit, SysV AS
389	$(CC) -E $(AF) crc_i386.S > crc_i386s.s
390	$(AS) -o $@ crc_i386s.s
391	$(RM) crc_i386s.s
392
393msdos$O:	msdos/msdos.c $(UNZIP_H) unzvers.h		# DOS only
394	$(CC) -c $(CF) msdos/msdos.c
395
396msdos_$O:	msdos/msdos.c $(UNZIP_H)			# DOS unzipsfx
397	-$(CP) msdos/msdos.c msdos_.c > nul
398	$(CC) -c $(CF) -DSFX msdos_.c
399	$(RM) msdos_.c
400
401#os2$O:		os2/os2.c $(UNZIP_H)				# OS/2 only
402#	$(CC) -c $(CF) os2/os2.c
403
404unix$O:		unix/unix.c $(UNZIP_H) unzvers.h		# Unix only
405	$(CC) -c $(CF) unix/unix.c
406
407unix_$O:	unix/unix.c $(UNZIP_H)				# Unix unzipsfx
408	$(CC) -c $(CF) -DSFX -o $@ unix/unix.c
409
410unix.pic.o:	unix/unix.c $(UNZIP_H) unzvers.h		# Unix shlib
411	$(CC) -c $(CF) -o $@ unix/unix.c
412
413
414unix_make:
415#	@echo\
416# '(Ignore any errors from `make'"' due to the following command; it's harmless.)"
417	-@2>&1 $(LN) unix/Makefile . > /dev/null || echo > /dev/null
418
419# this really only works for Unix targets, unless E and O specified on cmd line
420clean:
421	@echo ""
422	@echo '         This is a Unix-specific target.  (Just so you know.)'
423	@echo ""
424	-( cd $(IZ_OUR_BZIP2_DIR); $(MAKE) -f Makebz2.iz RM="rm -f" clean )
425	rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
426	  crc_sysv$O unzipstb$O crypt_.c extract_.c globals_.c inflate_.c \
427	  ttyio_.c crc_i386s.s msdos_.c process_.c unix_.c unzipsfx.c
428	rm -f flags
429	rm -rf ./$(PKGDIR)
430
431# Package generation interface (by J.Bush).  Originally tested under Sun
432# Solaris 2.x.  Other SVr4s may be very similar and could possibly use this.
433# Note:  expects version info to be stored in VERSION macro variable.
434# See "README" under ./unix/Packaging
435#
436svr4package:	unzips
437	@echo "Creating SVR4 package for Unix ..."
438	-@rm -rf ./$(PKGDIR) ./$(PKGDIR)_`uname -p`.pkg
439	-@sed -e "s/.VERSION./$(VERSION)/g" \
440	      -e "s/.PSTAMP./$(LOGNAME)_`date | tr  ' ' '_'`/g" \
441	      -e "s/.ARCH./Solaris_`uname -rp | tr ' ' ','`/g" \
442	      ./unix/Packaging/pkginfo.in > ./unix/Packaging/pkginfo
443	-@sed -e "s/.ARCH./`uname -p`/g" \
444	      ./unix/Packaging/preinstall.in > ./unix/Packaging/preinstall
445	/usr/bin/pkgmk -d . -b . -r . -f ./unix/Packaging/prototype $(PKGDIR)
446	/usr/bin/pkgtrans -o -s . $(PKGDIR)_`uname -p`.pkg $(PKGDIR)
447	@echo " "
448	@echo "To install, copy $(PKGDIR)_`uname -p`.pkg to the target system, and"
449	@echo "issue the command (as root):  pkgadd -d $(PKGDIR)_`uname -p`.pkg"
450	@echo " "
451
452install:	$(MANS)
453	-$(INSTALL_D) $(BINDIR)
454	$(INSTALL_PROGRAM) $(UNZIPS) $(BINDIR)
455	$(INSTALL) unix/zipgrep $(BINDIR)
456	$(RM) $(BINDIR)/zipinfo$E
457	$(LN) $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E
458	#-$(INSTALL_D) $(MANDIR)
459	#$(INSTALL) man/funzip.1 $(MANDIR)/funzip.$(manext)
460	#$(INSTALL) man/unzip.1 $(MANDIR)/unzip.$(manext)
461	#$(INSTALL) man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
462	#$(INSTALL) man/zipgrep.1 $(MANDIR)/zipgrep.$(manext)
463	#$(INSTALL) man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
464	$(CHMOD) $(BINPERMS) $(INSTALLEDBIN)
465	#$(CHMOD) $(MANPERMS) $(INSTALLEDMAN)
466
467uninstall:
468	$(RM) $(INSTALLEDBIN) $(INSTALLEDMAN)
469
470# added 10/28/04 EG
471flags:  unix/configure
472	sh unix/configure "${CC}" "${CF_NOOPT}" "${IZ_BZIP2}"
473
474# the test zipfile
475TESTZIP = testmake.zip
476
477# test some basic features of the build
478test:		check
479
480check:
481	@echo '#####  This is a Unix-specific target.  (Just so you know.)'
482	@echo '#####     Make sure unzip, funzip and unzipsfx are compiled and'
483	@echo '#####     in this directory.'
484	@if test ! -f ./unzip; then \
485	    echo "#####  ERROR:  can't find ./unzip"; exit 1; fi
486	@if test ! -f ./funzip; then \
487	    echo "#####  ERROR:  can't find ./funzip"; exit 1; fi
488	@if test ! -f ./unzipsfx; then \
489	    echo "#####  ERROR:  can't find ./unzipsfx"; exit 1; fi
490#
491	@if test ! -f $(TESTZIP); then \
492	    echo "#####  ERROR:  can't find test file $(TESTZIP)"; exit 1; fi
493#
494	@echo "#####  testing extraction"
495	@./unzip -bo $(TESTZIP) testmake.zipinfo
496	@if test ! -f testmake.zipinfo ; then \
497	    echo "#####  ERROR:  file extraction from $(TESTZIP) failed"; \
498	    exit 1; fi
499#
500	@echo '#####  testing zipinfo (unzip -Z)'
501	@./unzip -Z $(TESTZIP) > testmake.unzip-Z
502	@if diff testmake.unzip-Z testmake.zipinfo; then echo "OK."; else \
503	    echo "#####  WARNING:  zipinfo output doesn't match stored version"; \
504	    echo '#####     (If the only difference is the file times, compare your'; \
505	    echo '#####      timezone with the Central European timezone, which is one'; \
506	    echo '#####      hour east of Greenwich but effectively 2 hours east'; \
507	    echo '#####      during summer Daylight Savings Time.  The upper two'; \
508	    echo '#####      lines should correspond to your local time when the'; \
509	    echo '#####      files were created, on 19 November 1998 at 10:46pm CET.'; \
510	    echo '#####      If the times are consistent, please ignore this warning.)'; \
511	    fi
512	@$(RM) testmake.unzip-Z testmake.zipinfo
513#
514	@echo '#####  testing unzip -d exdir option'
515	@./unzip -bo $(TESTZIP) -d testun notes
516	@cat testun/notes
517#
518	@echo '#####  testing unzip -o and funzip (ignore funzip warning)'
519	@./unzip -boq $(TESTZIP) notes -d testun
520	@./funzip < $(TESTZIP) > testun/notes2
521	@if diff testun/notes testun/notes2; then true; else \
522	    echo '#####  ERROR:  funzip output disagrees with unzip'; fi
523#
524	@echo '#####  testing unzipsfx (self-extractor)'
525	@cat unzipsfx $(TESTZIP) > testsfx
526	@$(CHMOD) 0700 testsfx
527	@./testsfx -bo notes
528	@if diff notes testun/notes; then true; else \
529	    echo '#####  ERROR:  unzipsfx file disagrees with unzip'; fi
530	@$(RM) testsfx notes testun/notes testun/notes2
531	@rmdir testun
532#
533	@echo '#####  testing complete.'
534
535
536################################
537# INDIVIDUAL MACHINE MAKERULES #
538################################
539
540#----------------------------------------------------------------------------
541#  Generic targets using the configure script to determine configuration.
542#----------------------------------------------------------------------------
543
544# Well, try MAKE and see.  By now everyone may be happy.  10/28/04 EG
545generic:	flags	   # now try autoconfigure first
546	eval $(MAKE) $(MAKEF) unzips ACONF_DEP=flags `cat flags`
547#	make $(MAKEF) unzips CF="${CF} `cat flags`"
548
549generic_gcc:
550	$(MAKE) $(MAKEF) generic CC=gcc IZ_BZIP2="$(IZ_BZIP2)"
551
552# extensions to perform SVR4 package-creation after compilation
553generic_pkg:	generic svr4package
554generic_gccpkg:	generic_gcc svr4package
555
556#----------------------------------------------------------------------------
557#  Old static generic targets (can't assume make utility groks "$(MAKE)")
558#----------------------------------------------------------------------------
559
560generic1:	unzips	   # first try if unknown
561
562generic2:	unix_make  # second try if unknown:  hope make is called "make"
563	make $(MAKEF) unzips CF="$(CF) -DBSD"
564
565generic3:	unix_make  # third try if unknown:  hope make is called "make"
566	make $(MAKEF) unzips CF="$(CF) -DSYSV"
567
568# Generic build including bzip2 decompression support for unzip.
569# Requires presence of the bzip2 sources in subdirectory bzip2.
570
571generic_bz2:	unix_make
572	@echo\
573 "This target assumes bzip2 sources are available in subfolder bzip2/."
574	$(MAKE) $(MAKEF) unzips D_USE_BZ2="-DUSE_BZIP2"\
575	 L_BZ2="-lbz2" LIBBZ2="$(IZ_OUR_BZIP2_DIR)/libbz2.a" \
576	 CC_BZ="$(CC)" CFLAGS_BZ="$(CFLAGS)"
577
578# Generic unzip and funzip target using either shared or static zlib for
579# inflate rather than the original UnZip version.  (libz was libgz prior
580# to 0.94)  Need to figure out how to force unzipsfx to use static libz.
581
582generic_zlib:	unix_make
583	@echo\
584 "This target assumes zlib (libz.a or libz.so.*) is already installed."
585	$(MAKE) unzip funzip CF="$(CF) -DUSE_ZLIB" LF2="-lz $(LF2)"
586
587# Generic GNU C shared library.  This is an example of how to compile UnZip as
588# a shared library.  (Doing so as a static library would be similar.)  See also
589# the linux_shlib target.
590
591generic_shlib:	unix_make
592	@echo\
593 'This target requires GNU C.  When done, do "setenv LD_LIBRARY_PATH `pwd`"'
594	@echo\
595 'or similar in order to test the shared library in place (with ./unzip_shlib ,'
596	@echo\
597 'which is UnZip linked with the DLL).  This target is an example only.'
598	@echo ""
599	$(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC -DDLL"
600	gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)
601	$(RM) libunzip.so.0 libunzip.so
602	$(LN) -s libunzip.so.0.4 libunzip.so.0
603	$(LN) -s libunzip.so.0 libunzip.so
604	gcc -c -O unzipstb.c
605	gcc -o unzip_shlib unzipstb.o -L. -lunzip
606
607#----------------------------------------------------------------------------
608#  "Autoconfig" group, aliases for the generic targets using configure:
609#----------------------------------------------------------------------------
610
611# Solaris:  generic, plus generation of installable package.
612solaris_pkg:	generic_pkg
613
614# Solaris: forcing usage of GCC, plus generation of installable package.
615solaris_gccpkg:	generic_gcc_pkg
616
617#----------------------------------------------------------------------------
618#  "Normal" group (BSD vs. SysV may be set in unzip.h via predefined macros):
619#----------------------------------------------------------------------------
620
621386i:		unzips	# sun386i, SunOS 4.0.2
622#3Bx:		unzips	# AT&T 3B2/1000-80; should work on any WE32XXX machine
623#aix_rt:		unzips	# IBM RT 6150 under AIX 2.2.1
624bull:		unzips	# Bull DPX/2, BOS 2.00.45 (doesn't require -Xk switch)
625convex:		unzips	# Convex C-120 and C-210 (-O is enough; -ext is default)
626cray:		unzips	# Cray-2 and Y-MP, using default (possibly old) compiler
627dec:		unzips	# DEC 5820 (MIPS RISC), test version of Ultrix v4.0
628encore:		unzips	# Multimax
629eta:		unzips	# ETA-10P*, hybrid SysV with BSD 4.3 enhancements
630gould:		unzips	# Gould PN9000 running UTX/32 2.1Bu01
631hp:		unzips	# HP 9000 series (68020), 4.3BSD or HP-UX A.B3.10 Ver D
632hpux:		unzips	# (to match zip's makefile entry)
633mips:		unzips	# MIPS M120-5(?), SysV.3 [error in sys/param.h file?]
634next10:		unzips	# NeXT (generic; use next2x or next3x for better opt.)
635osf1:		unzips	# DECstation, including Alpha-based; DEC OSF/1 v1.x
636pyr_:		unzips	# [failsafe target for pyramid target below]
637pyr_ucb:	unzips	# Pyramids running BSD universe by default (see below)
638realix:		unzips	# Modcomp Real/IX (SysV.3); note "gcc" = GLS C, not GNU
639sco:		unzips	# Xenix/386 (tested on 2.3.1); SCO Unix 3.2.0.
640sgi:		unzips	# Silicon Graphics; Irix 3.3.2, 4.0.x, 5.2, etc.
641stellar:	unzips	# gs-2000
642sun:		unzips	# old target; no good with solaris...use "sunos" now
643sunos:		unzips	# no good with SunOS 3.x...use "sunos3" or "sunos4" now
644sunos4:		unzips	# Sun 3, 4; SunOS 4.x (SOME SYSTEMS ARE SYSTEM V!)
645tahoe:		unzips	# tahoe (CCI Power6/32), 4.3BSD
646ultrix:		unzips	# VAXen, DEC 58x0 (MIPS guts), DECstation 2100; v4.x
647vax:		unzips	# general-purpose VAX target (not counting VMS)
648
649#----------------------------------------------------------------------------
650#  BSD group (for timezone structs [struct timeb]):
651#----------------------------------------------------------------------------
652
653bsd:		_bsd	# generic BSD (BSD 4.2 & Ultrix handled in unzip.h)
654
655_bsd:		unix_make
656	$(MAKE) unzips CF="$(CF) -DBSD"
657
658#----------------------------------------------------------------------------
659#  SysV group (for extern long timezone and ioctl.h instead of sgtty.h):
660#----------------------------------------------------------------------------
661
662aix_rt:		_sysv	# IBM RT 6150 under AIX 2.2.1
663aviion:		_sysv	# Data General AViiONs, DG/UX 4.3x
664pyr_att:	_sysv	# Pyramids running AT&T (SysV) universe by default
665stardent:	_sysv	# Stardent ...
666sysv:		_sysv	# generic System V Unix (Xenix handled in unzip.h)
667xos:		_sysv	# Olivetti LSX-3005..3045, X/OS 2.3 and 2.4
668
669_sysv:		unix_make
670	$(MAKE) unzips CF="$(CF) -DSYSV"
671
672# extension to perform SVR4 package-creation after compilation
673_sysvp:		_sysv svr4package
674
675#----------------------------------------------------------------------------
676#  Version 7 group (old/obsolescent):
677#----------------------------------------------------------------------------
678
679pixel:		_v7	# Pixel 80, 100 (68000-based, V7/mostly BSD4.1 compat.)
680v7:		_v7	# generic Unix Version 7 box (prob. only Pixel...)
681
682_v7:
683	make $(MAKEF) unzips \
684	 CF="$(CF) -DV7 -DNO_PARAM_H -DSHORT_NAMES -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
685
686#----------------------------------------------------------------------------
687#  "Unique" group (require non-standard options):
688#----------------------------------------------------------------------------
689
690# AT&T 3B2/1000-80; should work on any WE32XXX machine
6913Bx:		unix_make
692	$(MAKE) unzips CF="$(CF) -DCBREAK=2"
693
694# AT&T 7300 (M68000/SysV.3) (add -DSYSV? -DNO_LIMITS?)
6957300:		unix_make
696	$(MAKE) unzips CF="$(CF) -DNO_DIR -DNO_MKDIR -DNO_STRNICMP -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2"
697
6987300_gcc:	unix_make
699	$(MAKE) unzips CC=gcc LD=gcc LF2="" CFLAGS="-O2" \
700	 LOC="-DNO_DIR -DNO_MKDIR -DNO_STDLIB_H -DNO_STRNICMP -DNO_UID_GID -DNO_FCHMOD -DNO_LCHOWN -DNO_LCHMOD -DCBREAK=2 $(LOC)"
701	$(STRIP) $(UNZIPS)
702
703# IBM AIX 3.x on an RS/6000:  see rs6000 target below
704aix:		rs6000
705
706# Amdahl (IBMish) mainframe, UTS (SysV) 1.2.4, 2.0.1, 3.x
707amdahl:		unix_make
708	$(MAKE) unzips CF="$(CF) -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
709
710# Amdahl UTS 2.1.4 with "extended file types" filesystem (aarrrggghhhh...)
711amdahl_eft:	unix_make
712	$(MAKE) unzips CF="$(CF) -eft -DSYSV -DNO_UID_GID -DNO_LCHOWN -DNO_LCHMOD"
713
714# Apollo Domain/OS machines (added -D...SOURCE options) [Gordon Fox, 960810]
715apollo:		unix_make
716	$(MAKE) unzips CF="$(CF) -D_INCLUDE_BSD_SOURCE -D_INCLUDE_XOPEN_SOURCE -DNO_LCHOWN -DNO_LCHMOD"
717
718# BSDI BSD/OS on 386 platform, using the assembler replacement for crc32.c
719bsdi:		unix_make
720	@echo 'NOTE:  use bsdi_noasm target for non-Intel BSD/OS compiles.'
721	$(MAKE) unzips CC=gcc2 LD=shlicc2 AS=gcc2\
722	 CFLAGS="-O3 -Wall -DASM_CRC -DBSD" CRCA_O=crc_gcc$O
723
724# BSDI BSD/OS
725bsdi_noasm:	unix_make
726#	@echo 'NOTE:  use bsd target for non-Intel BSD/OS compiles.'
727	$(MAKE) unzips CC=gcc2 LD=shlicc2 AS=gcc2\
728	 CFLAGS="-O3 -Wall -DBSD"
729
730# Coherent 3.x/4.x, Mark Williams C.  ``For Coherent's CC, it needs either
731# -T0 or -T150000 (or bigger) added to the CFLAGS, otherwise the compiler
732# runs out of memory and dies in zipinfo.c.'' [Fred "Fredex" Smith, 940719]
733coherent:	unix_make
734	$(MAKE) unzips CFLAGS="$(CFLAGS) -T0 -DNO_LCHOWN -DNO_LCHMOD"
735
736# Cray-2, Y-MP or C90, running Unicos 5.x to 8.x (SysV + BSD enhancements)
737# and Standard (ANSI) C compiler 3.0 or later.
738cray_opt:	unix_make
739	$(MAKE) unzips CFLAGS="$(CFLAGS) -h scalar3 -h vector3 -DNO_LCHOWN -DNO_LCHMOD"
740
741# The unzip41 build on a Cyber 910/SGI running Irix v3.3.3 was successful
742# with the following change to Makefile:
743cyber_sgi:	unix_make
744	$(MAKE) unzips CFLAGS="$(CFLAGS) -I/usr/include/bsd -DNO_LCHOWN -DNO_LCHMOD"\
745	 LF="-lbsd $(LF)" SL="-lbsd $(SL)"
746
747# The Cygwin environment on a Win32 system, treated as an UNIX emulator.
748# This port does not offer full access to the Windows file system.
749# Info-ZIP recommends using "win32/Makefile.gcc" instead.
750cygwin:		unix_make
751	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
752	 CFLAGS="-O3 -DASM_CRC -DNO_LCHOWN -DNO_LCHMOD"\
753	 AF="-Di386 $(AF)" CRCA_O=crc_gcc$O\
754	 E=".exe" CP="cp" LN="ln -s"
755
756# 680x0, DIAB dnix 5.2/5.3 (a Swedish System V clone)
757#
758# Options for the dnix cc:
759#  -X7 = cc is strict ANSI C
760#  -X9 = warnings if a function is used without a declaration
761#
762dnix:		unix_make
763	$(MAKE) unzips CFLAGS="$(CFLAGS) -X7 -X9 -DDNIX"
764
765# FreeBSD on Intel:
766freebsd:		unix_make
767	@echo 'NOTE:  use bsd target for non-Intel FreeBSD compiles (if any).'
768	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
769	 CFLAGS="-O3 -Wall -DASM_CRC -DBSD"\
770	 AF="-Di386 $(AF)" CRCA_O=crc_gcc$O
771
772# Generic BSDish Unix gcc.  ``The -O3 only works with later versions of gcc;
773# you may have to use -O2 or -O for earlier versions.  I have no idea why
774# -s causes this bug in gcc.''  [Bug:  "nm: unzip: no name list", "collect:
775# /usr/bin/nm returned 1 exit status".]  If you don't have strip, don't
776# worry about it (it just makes the executable smaller and can be replaced
777# with "echo" instead).
778#
779gcc:		unix_make
780	$(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O3" LF2=""
781	$(STRIP) $(UNZIPS)
782
783# Heurikon HK68 (68010), UniPlus+ System V 5.0, Green Hills C-68000
784hk68:		unix_make
785	$(MAKE) unzips CC="gcc" LD="gcc"\
786	 LF="-n $(LF)" SL="-n $(SL)" FL="-n $(FL)"\
787	 CFLAGS="-ga -X138 -Dlocaltime=localti -Dtimezone=timezon"
788
789# ISC Unix on 386 platform
790isc:		unix_make
791	$(MAKE) unzips LF2="-lc_s $(LF2)" CRCA_O=crc_sysv$O \
792	 CFLAGS="-O" LOC="-DASM_CRC -DSYSV -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \
793	 AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
794
795isc_gcc:	unix_make
796	$(MAKE) unzips AS=gcc CC=gcc LD=gcc CRCA_O=crc_gcc$O \
797	 LF="-shlib $(LF)" SL="-shlib $(SL)" FL="-shlib $(FL)" LF2="" \
798	 CFLAGS="-O3" LOC="-DSYSV -DASM_CRC -DNO_UID_GID -DNEED_PTEM -DNO_LCHOWN -DNO_LCHMOD $(LOC)" \
799	 AF="-DNO_UNDERLINE -Djecxz=jcxz -DALIGNMENT='.align 16' $(AF)"
800	$(STRIP) $(UNZIPS)
801
802# "ISI machine (68025 CPU)" (based on e-mail from Rob White <rsw@tfs.com>;
803# no further information).  May also need DIRENT defined.
804isi:		unix_make
805	$(MAKE) unzips CF="$(CF) -DDECLARE_ERRNO -DNO_LCHOWN -DNO_LCHMOD"
806
807# Linux on 386 platform, using the assembler replacement for crc32.c. (-O4 and
808# -fno-strength-reduce have virtually no effect beyond -O3.  Add "-m486
809# -malign-functions=2 -malign-jumps=2 -malign-loops=2" for Pentium [Pro]
810# systems.)
811linux:		unix_make
812	@echo 'NOTE:  use linux_noasm target for non-Intel Linux compiles.'
813	$(MAKE) unzips CC=gcc LD=gcc AS=gcc\
814	 CFLAGS="-O3 -Wall -DASM_CRC"\
815	 AF="-Di386 $(AF)" CRCA_O=crc_gcc$O
816# GRR:  this echo is pointless; if user gets this far, no difference to install
817#	@echo 'Be sure to use the install_asm target rather than the install target'
818
819linux_asm:	linux
820
821# Linux (Posix, approximately SysV):  virtually any version since before 0.96,
822# for any platform.  Change "-O" to "-O3" or whatever, as desired...
823linux_noasm:	unix_make
824	$(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O -Wall"
825
826# Linux with lcc compiler:  __inline__ (stat.h) not recognized, and must edit
827# /usr/include/gnu/types.h to get rid of "long long" if __LCC__ defined.  -O3
828# (or -O2 or -O) is ignored.  [GRR 960828: test target only]
829#
830linux_lcc:	unix_make
831	$(MAKE) unzips CC=lcc LD=lcc CFLAGS="-O3 -Wall -D__inline__= "
832
833# Linux host with go32 (djgpp) cross-compiler (go32crs.tgz) for 32-bit DOS.
834linux_dos:	unix_make
835	$(MAKE) unzips CC=go32gcc LD=go32gcc M=msdos OSDEP_H="msdos/doscfg.h" \
836	 CFLAGS="-O2 -Wall"
837#	go32-strip unzip
838#	Due to limitations of the cross-compiling package, this has to be
839#	done manually:
840	@echo Copy $(UNZIPS) to your DOS partition and use coff2exe.
841
842# Linux ELF shared library (ooo, it's so easy).  This is a test target for
843# now, and it only makes the UnZip/ZipInfo stuff (not fUnZip or UnZipSFX).
844# The version number may eventually change to match the UnZip version.  Or
845# not.  Whatever.  Also do "setenv LD_LIBRARY_PATH `pwd`" or similar to test
846# the DLL in place (with unzip_shlib, which is UnZip linked with the shared
847# library).
848#
849linux_shlib:	unix_make
850	$(MAKE) objsdll CC=gcc CFLAGS="-O3 -Wall -fPIC"\
851	 LOC="-DDLL -DASM_CRC $(LOC)"\
852	 AS=gcc AF="-fPIC -Di386 $(AF)" CRCA_O=crc_gcc$O
853	gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)\
854	 crc_gcc.pic.o
855	ln -sf libunzip.so.0.4 libunzip.so.0
856	ln -sf libunzip.so.0 libunzip.so
857	gcc -c -O unzipstb.c
858	gcc -o unzip_shlib unzipstb.o -L. -lunzip
859
860# Linux ELF shared library, as above, but using inflate() from zlib (libz.so)
861# instead of the original UnZip version.  (libz was libgz prior to 0.94)
862linux_shlibz:	unix_make
863	$(MAKE) objsdll CC=gcc AS=gcc AF="-fPIC -Di386 $(AF)" CRCA_O=crc_gcc$O\
864	 CFLAGS="-O3 -Wall -fPIC" LOC="-DDLL -DUSE_ZLIB -DASM_CRC $(LOC)"
865	gcc -shared -Wl,-soname,libunzip.so.0 -o libunzip.so.0.4 $(OBJSDLL)\
866	 crc_gcc.pic.o
867	ln -sf libunzip.so.0.4 libunzip.so.0
868	gcc -c -O unzipstb.c
869	gcc -o unzip unzipstb.o -L. -lunzip -lz
870
871# LynxOS-x86 2.3.0 and newer, a real-time BSD-like OS; uses gcc.
872lynx:		unix_make
873	$(MAKE) unzips CC=gcc CF="$(CF) -DLynx -DLYNX -DBSD -DUNIX"
874
875# Macintosh MacOS X (Unix-compatible enviroment), using standard compiler
876macosx:	unix_make
877	$(MAKE) unzips CFLAGS="-O3 -Wall -DBSD" LF2=""
878	$(STRIP) $(UNZIPS)
879
880# Macintosh MacOS X (Unix-compatible enviroment), using gcc
881macosx_gcc:	unix_make
882	$(MAKE) unzips CC=gcc CFLAGS="-O3 -Wall -DBSD" LF2=""
883	$(STRIP) $(UNZIPS)
884
885# Minix 1.5 PC for the 386.  Invoke as is to use default cc, or as "make
886# minix CC=gcc" to use gcc.  Try "make linux" if you have a working termios.h.
887minix:		unix_make
888	$(MAKE) unzips CF="$(CF) -DMINIX -DSHORT_NAMES -DNO_LCHOWN -DNO_LCHMOD" CC=$(CC) LD=$(CC)
889
890# MPE/iX, the Unix variant for HP 3000 systems.
891mpeix:		unix_make
892	$(MAKE) unzips CC=c89\
893	 CF="$(CF) -DUNIX -D_POSIX_SOURCE -DHAVE_TERMIOS_H -DPASSWD_FROM_STDIN -DNO_PARAM_H -DNO_LCHOWN -DNO_LCHMOD"\
894	 LF2=-lbsd CP=cp LN="ln -s"
895
896# NeXT info.
897next:
898	@echo
899	@echo\
900 '  Please pick a specific NeXT target:  "make next10" will create a generic'
901	@echo\
902 '  NeXT executable; "make next2x" will create a smaller executable (for'
903	@echo\
904 '  NeXTstep 2.0 and higher); "make next3x" will create a small executable'
905	@echo\
906 '  with significantly better optimization (NeXTstep 3.0 and higher only);'
907	@echo\
908 '  "make nextfat" will create a fat, multi-architecture (NeXT plus Intel)'
909	@echo\
910 '  executable (NeXTstep 3.1 and higher only).'
911	@echo
912
913# 68030 BSD 4.3+Mach.  NeXT 2.x: make the executable smaller.
914next2x:		unix_make
915	$(MAKE) unzips LF2="-object -s"
916
917# NeXT 3.x: as above, plus better optimization.
918next3x:		unix_make
919	$(MAKE) unzips CFLAGS="-O2" LF2="-object -s"
920
921# NeXT 3.1+: make the executable fat (multi-architecture binary [MAB],
922# for "black" [NeXT] and "white" [x86] hardware, so far).
923nextfat:	unix_make
924	$(MAKE) unzips CFLAGS="-O2 -arch i386 -arch m68k" \
925	 LF2="-arch i386 -arch m68k -object -s"
926
927# IBM OS/390 (formerly MVS) compiled under "OpenEdition" shell
928os390:		unix_make
929	set -x; \
930	$(MAKE) $(MAKEF) unzips \
931	 CC=c89 LD="\$$(CC) -Wl,EDIT=NO" \
932	 CF="$(CF) -DSYSV -DUNIX -DOS390 -DEBCDIC -DNO_PARAM_H \
933	 -DNO_LCHOWN -DNO_LCHMOD \
934	 -D_ALL_SOURCE $(HOST_VERSINFO)" LF2=""
935
936# Sequent Symmetry running Dynix/ptx (sort of SysV.3):  needs to link
937# with libseq to get symlink().
938ptx:		unix_make
939	$(MAKE) unzips CF="$(CF) -DSYSV -DTERMIO -DPTX -DNO_LCHOWN -DNO_LCHMOD" LF2="$(LF2) -lseq"
940
941# Pyramid 90X (probably all) under >= OSx4.1, either universe.  (This is an
942# experimental target!  If it fails, use either pyr_ucb or pyr_att instead.)
943# The make in the BSD half is too stupid to understand $(MAKE), sigh...
944pyramid:	unix_make
945	-make $(MAKEF) pyr_`universe`
946
947# QNX/Neutrino is "special" because you don't have any native development
948# tools yet.  Set ARCH to "x86", "ppcbe", "ppcle", "mipsbe", or "mipsle"
949# to produce x86, PowerPC (big- or little-endian) and MIPS (big-
950# or little-endian) using gcc. [cjh]
951qnxnto:		unix_make
952	@if [ "$(ARCH)" = "" ] ; then \
953		echo "You didn't set ARCH; I'll assume you meant ARCH=x86..." ; \
954		echo "" ; \
955		$(MAKE) $(MAKEF) CC="qcc -Vgcc_ntox86" unzips ; \
956	else \
957		echo "Making unzip for $(ARCH)..." ; \
958		echo "" ; \
959		$(MAKE) $(MAKEF) CC="qcc -Vgcc_nto$(ARCH)" unzips ; \
960	fi
961
962# REGULUS:  68040-based, "real-time" SysV.3 mutant; uses gcc, with "REGULUS"
963# predefined.
964regulus:	unix_make
965	$(MAKE) unzips CF="$(CF) -traditional -DSYSV -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD"
966
967# IBM RS/6000 under AIX 3.2
968rs6000:		unix_make
969	$(MAKE) unzips CF="$(CF) -DBSD -D_BSD -DUNIX" LF2="-lbsd"
970
971# SCO cross compile from Unix to DOS. Tested with Xenix/386 and OpenDeskTop.
972# Should work with Xenix/286 as well. (davidsen)  Note that you *must* remove
973# the Unix objects and executable before doing this!  (Piet Plomp:  gcc won't
974# recognize the -M0 flag that forces 8086 code.)  (GRR:  may need to reduce
975# stack to 0c00h if using 286/small-model code...?)
976sco_dos:	unix_make
977	$(MAKE) unzips CFLAGS="-O -dos -M0" M=msdos OSDEP_H="msdos/doscfg.h" \
978	 LF="-dos -F 2000" LF2="-o unzip.exe" \
979	 FL="-dos" FL2="-o funzip.exe" SL="-dos" SL2="-o unzipsfx.exe"
980
981# SCO UNIX with shared libraries and no international support.  If you are
982# not using a USA-style keyboard and display, you may want to remove -nointl
983# to get support.  It adds quite a bit to the size of the executable.
984sco_sl:		unix_make
985	$(MAKE) unzips LF="$(LF) -nointl" LF2="$(LF2) -lc_s"\
986	 SL="$(SL) -nointl" FL="$(FL) -nointl"
987
988# SCO Xenix/286 2.2.3 or later with development system 2.2.1 or later
989sco_x286:	unix_make
990	$(MAKE) unzips CF="$(CF) -Mel2 -LARGE -DNO_MKDIR -DNO_LCHOWN -DNO_LCHMOD" \
991	 LF="$(LF) -Mel2 -LARGE -lx" SL="$(SL) -Mel2 -LARGE" \
992	 FL="$(FL) -Mel2 -LARGE"
993
994# Sequent Symmetry with Dynix.  (386, but needs -DZMEM)
995# This should also work on Balance but I can't test it just yet.
996sequent:	unix_make
997	$(MAKE) unzips CF="$(CF) -DBSD -DZMEM -DNO_LCHOWN -DNO_LCHMOD"
998
999# Sun 2, 3, 4 running SunOS 3.x
1000sunos3:		unix_make
1001	$(MAKE) unzips CF="$(CF) -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
1002
1003# Generic System V + GNU C
1004sysv_gcc:	unix_make
1005	$(MAKE) unzips CC=gcc LD=gcc CFLAGS="-O2 -DSYSV" LF2=""
1006	$(STRIP) $(UNZIPS)
1007
1008# AT&T 6300+, System V.2 Unix:  run-time out-of-memory error if don't use -Ml;
1009# also compile-time error if work arrays dimensioned at HSIZE+2 (>32K)
1010sysv6300:	unix_make
1011	$(MAKE) unzips CF="$(CF) -Ml -DSYSV -DNO_LCHOWN -DNO_LCHMOD" LF="$(LF) -Ml"\
1012	 SL="$(SL) -Ml" FL="$(FL) -Ml"
1013
1014# Texas Instruments System V.3 (running on HP 9000-1500)
1015ti_sysv:	unix_make
1016	$(MAKE) unzips CF="$(CF) -DSYSV -DNO_UID_GID -DUID_USHORT -DNO_LCHOWN -DNO_LCHMOD"
1017
1018# SCO Xenix (Joe Foster 950508:  "unzip needs to be linked with -lx [for the
1019# opendir(), readdir(), telldir(), rewinddir(), and closedir() calls]")
1020xenix:		 unix_make
1021	$(MAKE) unzips LF2="$(LF2) -lx"
1022
1023# Wombat 68000 (or whatever).
1024# I didn't do this.  I swear.  No, really.
1025wombat:		unix_make
1026	@echo
1027	@echo  '	Ha ha!  Just kidding.'
1028	@echo
1029