1#==============================================================================
2# Makefile for UnZip, UnZipSFX and fUnZip:  Unix and MS-DOS ("real" makes only)
3# Version:  5.53                                               25 December 2006
4#==============================================================================
5
6
7# INSTRUCTIONS (such as they are):
8#
9# "make vax"	-- makes UnZip on a generic Unix VAX in the current directory
10# "make list"	-- lists all supported systems (targets)
11# "make help"	-- provides pointers on what targets to try if problems occur
12# "make wombat" -- chokes and dies if you haven't added the specifics for your
13#		    Wombat 68000 (or whatever) to the systems list
14#
15# CF are flags for the C compiler.  LF are flags for the loader.  LF2 are more
16# flags for the loader, if they need to be at the end of the line instead of at
17# the beginning (for example, some libraries).  FL and FL2 are the corre-
18# sponding flags for fUnZip.  LOCAL_UNZIP is an environment variable that can
19# be used to add default C flags to your compile without editing the Makefile
20# (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
21#
22# Some versions of make do not define the macro "$(MAKE)"; this is rare, but
23# if things don't work, try using "make" instead of "$(MAKE)" in your system's
24# makerule.  Or try adding the following line to your .login file:
25#	setenv MAKE "make"
26# (That never works--makes which are too stupid to define MAKE are also too
27# stupid to look in the environment--but try it anyway for kicks. :-) )
28#
29# Memcpy and memset are provided for those systems that don't have them; they
30# are in file_io.c and will be used if -DZMEM is included in CF.  These days
31# almost all systems have them.
32#
33# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
34# tion does not always imply a working program.
35
36
37#####################
38# MACRO DEFINITIONS #
39#####################
40
41# Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
42# such as -DDOSWILD).
43
44# UnZip flags
45CC = cl
46LD = cl
47LOC = $(LOCAL_UNZIP)
48CF = -c -Zi -W2 -DCRYPT -DOLD_THEOS_EXTRA $(LOCAL_UNZIP)
49LF = -Zi -o
50LF2 = -m
51
52# defaults for crc32 stuff and system dependent headers
53CRCA_O =
54OSDEP_H =
55
56# general-purpose stuff
57CP = copyfile
58LN = copyfile
59RM = erase
60
61.c.o:
62	$(CC) $(CF) $*.c
63
64# object files
65OBJS1 = unzip.o crc32.o $(CRCA_O) crypt.o envargs.o explode.o
66OBJS2 = extract.o fileio.o globals.o inflate.o list.o match.o
67OBJS3 = process.o ttyio.o ubz2err.o unreduce.o unshrink.o zipinfo.o
68OBJS4 = _sprintf.o _fprintf.o _isatty.o _stat.o _setargv.o
69OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) theos.o
70#LOBJS = $(OBJS)
71LOBJS = $(OBJS1) $(OBJS2) $(OBJS3) theos.o
72OBJX = unzipsfx.o crc32_.o $(CRCA_O) crypt_.o extract_.o fileio_.o \
73	globals_.o inflate_.o match_.o process_.o ttyio_.o obz2err_.o theos_.o
74LOBJX = $(OBJX)
75OBJF = funzip.o crc32f.o $(CRCA_O) cryptf.o globalsf.o inflatef.o ttyiof.o \
76	_sprintf.o _fprintf.o _isatty.o
77UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
78EBCDIC_H = ebcdic.h theos/charconv.h
79
80UNZIPS = unzip.command funzip.command unzipsfx.command zipinfo.command
81
82unzips:	$(UNZIPS)
83
84
85crc32.o:	crc32.c $(UNZIP_H) zip.h crc32.h
86crypt.o:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
87envargs.o:	envargs.c $(UNZIP_H)
88explode.o:	explode.c $(UNZIP_H)
89extract.o:	extract.c $(UNZIP_H) crc32.h crypt.h
90fileio.o:	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h EBCDIC_H
91funzip.o:	funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
92globals.o:	globals.c $(UNZIP_H)
93inflate.o:	inflate.c inflate.h $(UNZIP_H)
94list.o:		list.c $(UNZIP_H)
95match.o:	match.c $(UNZIP_H)
96process.o:	process.c $(UNZIP_H) crc32.h
97ttyio.o:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
98ubz2err.o:	ubz2err.c $(UNZIP_H)
99unreduce.o:	unreduce.c $(UNZIP_H)
100unshrink.o:	unshrink.c $(UNZIP_H)
101unzip.o:	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
102zipinfo.o:	zipinfo.c $(UNZIP_H)
103
104# unzipsfx only
105crc32_.o:	crc32.c $(UNZIP_H) zip.h crc32.h
106	$(CC) $(CF) -DSFX -Fo$@ crc32.c
107
108crypt_.o:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
109	$(CC) $(CF) -DSFX -Fo$@ crypt.c
110
111extract_.o:	extract.c $(UNZIP_H) crc32.h crypt.h
112	$(CC) $(CF) -DSFX -Fo$@ extract.c
113
114fileio_.o:	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h EBCDIC_H
115	$(CC) $(CF) -DSFX -Fo$@ fileio.c
116
117globals_.o:	globals.c $(UNZIP_H)
118	$(CC) $(CF) -DSFX -Fo$@ globals.c
119
120inflate_.o:	inflate.c inflate.h $(UNZIP_H) crypt.h
121	$(CC) $(CF) -DSFX -Fo$@ inflate.c
122
123match_.o:	match.c $(UNZIP_H)
124	$(CC) $(CF) -DSFX -Fo$@ match.c
125
126process_.o:	process.c $(UNZIP_H) crc32.h
127	$(CC) $(CF) -DSFX -Fo$@ process.c
128
129ttyio_.o:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
130	$(CC) $(CF) -DSFX -Fo$@ ttyio.c
131
132ubz2err_.o:	ubz2err.c $(UNZIP_H)
133	$(CC) $(CF) -DSFX -Fo$@ ubz2err.c
134
135unzipsfx.o:	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
136	$(CC) $(CF) -DSFX -Fo$@ unzip.c
137
138# funzip only
139crc32f.o:	crc32.c $(UNZIP_H) zip.h crc32.h
140	$(CC) $(CF) -DFUNZIP -Fo$@ crc32.c
141
142cryptf.o:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
143	$(CC) $(CF) -DFUNZIP -Fo$@ crypt.c
144
145globalsf.o:	globals.c $(UNZIP_H)
146	$(CC) $(CF) -DFUNZIP -Fo$@ globals.c
147
148inflatef.o:	inflate.c inflate.h $(UNZIP_H) crypt.h
149	$(CC) $(CF) -DFUNZIP -Fo$@ inflate.c
150
151ttyiof.o:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
152	$(CC) $(CF) -DFUNZIP -Fo$@ ttyio.c
153
154theos.o:	theos/theos.c $(UNZIP_H) unzvers.h		# THEOS only
155	$(CC) $(CF) theos/theos.c
156
157theos_.o:	theos/theos.c $(UNZIP_H)			# THEOS unzipsfx
158	$(CC) $(CF) -DSFX -Fo$@ theos/theos.c
159
160_sprintf.o:	theos/_sprintf.c $(UNZIP_H)			# THEOS only
161	$(CC) $(CF) theos/_sprintf.c
162
163_fprintf.o:	theos/_fprintf.c $(UNZIP_H)			# THEOS only
164	$(CC) $(CF) theos/_fprintf.c
165
166_isatty.o:	theos/_isatty.c $(UNZIP_H)			# THEOS only
167	$(CC) $(CF) theos/_isatty.c
168
169_stat.o:	theos/_stat.c $(UNZIP_H)			# THEOS only
170	$(CC) $(CF) theos/_stat.c
171
172_setargv.o:	theos/_setargv.c $(UNZIP_H)			# THEOS only
173	$(CC) $(CF) theos/_setargv.c
174
175unzip.command:	$(OBJS)
176	$(LD) $(LF) $@ $(LOBJS) $(LF2)
177
178unzipsfx.command:	$(OBJX)
179	$(LD) $(LF) $@ $(LOBJX) $(LF2)
180
181funzip.command:	$(OBJF)
182	$(LD) $(LF) $@ $(OBJF) $(LF2)
183
184zipinfo.command:	unzip.command
185	$(LN) $? $@ ( rep not
186
187install:
188	copy *.command /system.cmd32.=(rep noq
189
190clean:
191	erase *.o(noq not
192	erase *.command(noq not
193