1#==============================================================================
2# Makefile for UnZip, UnZipSFX and fUnZip:  Atari ST             Chris Herborth
3# Version:  UnZip 5.20+, MiNT, GNU C                           25 December 2006
4#==============================================================================
5
6# Based on the original unix Makefile and modified by Chris Herborth
7# (cherborth@semprini.waterloo-rdp.on.ca), Nov.13/93.
8
9# Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful com-
10# pilation does not always imply a working program.
11
12
13#####################
14# MACRO DEFINITIONS #
15#####################
16
17# Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
18# such as -DDOSWILD).
19
20# UnZip flags
21# NOTE: 'cgcc' is my cross-compiler; you'll probably use 'gcc' instead.
22CC = cgcc
23LD = cgcc
24LOC = $(LOCAL_UNZIP) -ansi -D__MINT__ -U__STRICT_ANSI__
25
26CF = -mbaserel -mpcrel -O2 -fomit-frame-pointer -I. $(LOC)
27# CF = -O -I. $(LOC)
28# CF = -mbaserel -O -I. $(LOC)
29LF = -mbaserel -mpcrel -o unzip.ttp
30LF2 = -s -lbiio
31
32# UnZipSFX flags
33XC = -DSFX
34XL = -mbaserel -mpcrel -o unzipsfx.ttp
35XL2 = $(LF2)
36
37# fUnZip flags
38FC = -DFUNZIP
39FL = -mbaserel -mpcrel -o funzip.ttp
40FL2 = $(LF2)
41
42# general-purpose stuff
43CP = cp
44LN = ln -s
45RM = rm -f
46E = .ttp
47O = .o
48M = atari
49SHELL = /bin/sh
50
51# object files
52OBJS1 = unzip$O crc32$O crypt$O envargs$O explode$O
53OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
54OBJS3 = process$O ttyio$O ubz2err$O unreduce$O unshrink$O zipinfo$O
55OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
56LOBJS = $(OBJS)
57OBJX = unzipsfx$O crc32$O crypt_$O extract_$O fileio_$O \
58	globals_$O inflate_$O match_$O process_$O ttyio_$O ubz2err_$O $M_$O
59OBJF = funzip$O crc32$O cryptf$O globalsf$O inflatef$O ttyiof$O
60
61UNZIP_H = unzip.h unzpriv.h globals.h
62
63# installation
64INSTALL = cp#	probably can change this to 'install' if you have it
65# on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
66manext = 1
67MANDIR = /usr/local/man/man$(manext)#	where to install man pages
68BINDIR = /usr/local/bin#		where to install executables
69#
70UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
71MANS = unzip.$(manext) unzipsfx.$(manext) zipinfo.$(manext) funzip.$(manext)
72DOCS = unzip.txt unzipsfx.txt zipinfo.txt funzip.txt
73# this is a little ugly...
74INSTALLED = $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E $(BINDIR)/funzip$E \
75	$(BINDIR)/unzipsfx$E $(MANDIR)/unzipsfx.$(manext) \
76	$(MANDIR)/unzip.$(manext) $(MANDIR)/zipinfo.$(manext) \
77	$(MANDIR)/funzip.$(manext)
78
79###############################################
80# BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
81###############################################
82
83.c$O:
84	$(CC) -c $(CF) $*.c
85
86
87all:		unzips
88unzips:		$(UNZIPS)
89docs:		$(DOCS)
90unzipsman:	unzips docs
91unzipsdocs:	unzips docs
92
93
94clean:
95	rm -f $(OBJS) $(OBJF) $(OBJX) $(UNZIPS)
96
97install:	$(UNZIPS) $(MANS)
98	$(INSTALL) $(UNZIPS) $(BINDIR)
99	$(LN) $(BINDIR)/unzip$E $(BINDIR)/zipinfo$E
100	$(INSTALL) man/unzip.1 $(MANDIR)/unzip.$(manext)
101	$(INSTALL) man/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
102	$(INSTALL) man/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
103	$(INSTALL) man/funzip.1 $(MANDIR)/funzip.$(manext)
104
105# alternatively, could use zip method:  -cd $(BINDIR); rm -f $(UNZIPS)  [etc.]
106uninstall:
107	rm -f $(INSTALLED)
108
109
110unzip$E:	$(OBJS)			# add `&' if parallel makes supported
111	$(LD) $(LF) $(LOBJS) $(LF2)
112
113unzipsfx$E:	$(OBJX)			# add `&' if parallel makes supported
114	$(LD) $(XL) $(OBJX) $(XL2)
115
116funzip$E:	$(OBJF)			# add `&' if parallel makes supported
117	$(LD) $(FL) $(OBJF) $(FL2)
118
119zipinfo$E:	unzip$E
120	@echo\
121 '  This is a Unix-inspired target.  If your filesystem does not support'
122	@echo\
123 '  symbolic links, copy unzip.ttp to zipinfo.ttp rather than linking it,'
124	@echo\
125 '  or else invoke as "unzip -Z".'
126	$(LN) unzip$E zipinfo$E
127
128
129crc32$O:	crc32.c $(UNZIP_H) zip.h crc32.h
130crypt$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
131envargs$O:	envargs.c $(UNZIP_H)
132explode$O:	explode.c $(UNZIP_H)
133extract$O:	extract.c $(UNZIP_H) crc32.h crypt.h
134fileio$O:	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
135funzip$O:	funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
136globals$O:	globals.c $(UNZIP_H)
137inflate$O:	inflate.c inflate.h $(UNZIP_H)
138list$O:		list.c $(UNZIP_H)
139match$O:	match.c $(UNZIP_H)
140process$O:	process.c $(UNZIP_H) crc32.h
141ttyio$O:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
142ubz2err$O:	ubz2err.c $(UNZIP_H)
143unreduce$O:	unreduce.c $(UNZIP_H)
144unshrink$O:	unshrink.c $(UNZIP_H)
145unzip$O:	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
146zipinfo$O:	zipinfo.c $(UNZIP_H)
147
148# unzipsfx only
149crypt_$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
150	$(CP) crypt.c crypt_.c
151	$(CC) -c $(CF) $(XC) crypt_.c
152	$(RM) crypt_.c
153
154extract_$O:	extract.c $(UNZIP_H) crc32.h crypt.h
155	$(CP) extract.c extract_.c
156	$(CC) -c $(CF) $(XC) extract_.c
157	$(RM) extract_.c
158
159fileio_$O:	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
160	$(CP) fileio.c fileio_.c
161	$(CC) -c $(CF) $(XC) fileio_.c
162	$(RM) fileio_.c
163
164globals_$O:	globals.c $(UNZIP_H)
165	$(CP) globals.c globals_.c
166	$(CC) -c $(CF) $(XC) globals_.c
167	$(RM) globals_.c
168
169inflate_$O:	inflate.c inflate.h $(UNZIP_H) crypt.h
170	$(CP) inflate.c inflate_.c
171	$(CC) -c $(CF) $(XC) inflate_.c
172	$(RM) inflate_.c
173
174match_$O:	match.c $(UNZIP_H)
175	$(CP) match.c match_.c
176	$(CC) -c $(CF) $(XC) match_.c
177	$(RM) match_.c
178
179process_$O:	process.c $(UNZIP_H) crc32.h
180	$(CP) process.c process_.c
181	$(CC) -c $(CF) $(XC) process_.c
182	$(RM) process_.c
183
184ttyio_$O:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
185	$(CP) ttyio.c ttyio_.c
186	$(CC) -c $(CF) $(XC) ttyio_.c
187	$(RM) ttyio_.c
188
189ubz2err_$O:	ubz2err.c $(UNZIP_H)
190	$(CP) ubz2err.c ubz2err_.c
191	$(CC) -c $(CF) $(XC) ubz2err_.c
192	$(RM) ubz2err_.c
193
194unzipsfx$O:	unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
195	$(CP) unzip.c unzip_.c
196	$(CC) -c $(CF) $(XC) unzip_.c
197	$(RM) unzip_.c
198
199
200# funzip only
201cryptf$O:	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
202	$(CP) crypt.c cryptf.c
203	$(CC) -c $(CF) $(FC) cryptf.c
204	$(RM) cryptf.c
205
206globalsf$O:	globals.c $(UNZIP_H)
207	$(CP) globals.c globalsf.c
208	$(CC) -c $(CF) $(FC) globalsf.c
209	$(RM) globalsf.c
210
211inflatef$O:	inflate.c inflate.h $(UNZIP_H) crypt.h
212	$(CP) inflate.c inflatef.c
213	$(CC) -c $(CF) $(FC) inflatef.c
214	$(RM) inflatef.c
215
216ttyiof$O:	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
217	$(CP) ttyio.c ttyiof.c
218	$(CC) -c $(CF) $(FC) ttyiof.c
219	$(RM) ttyiof.c
220
221
222# system-specific code
223atari$O:	atari/atari.c $(UNZIP_H)		# Atari only
224	$(CC) -c $(CF) atari/atari.c
225
226atari_$O:	atari/atari.c $(UNZIP_H)		# unzipsfx only
227	$(CP) atari/atari.c atari_.c
228	$(CC) -c $(CF) $(XC) atari_.c
229	$(RM) atari_.c
230