1# Makefile for UnZip, UnZipSFX, ZipInfo and fUnZip (5.53 or later)
2# using gcc 2.95.4 (or later).
3# You may look at <URL:http://hard-mofo.dsvr.net/gcc/> for an up-to-date
4# gcc port.
5
6CC   = gcc -mlibscl
7BIND = $(CC)
8AS   = $(CC) -c
9ASM  = as
10SQUEEZE = squeeze -v
11E    =
12
13# flags
14#   CFLAGS    flags for C compile
15#   LFLAGS1   flags after output file spec, before obj file list
16#   LFLAGS2   flags after obj file list (libraries, etc)
17#
18LIB      =
19CFLAGS   = -O2 -mthrowback -DNO_STRNICMP
20ASMFLAGS = -throwback -objasm -upper
21LFLAGS1  =
22LFLAGS2  = $(LIB)
23
24# object file lists
25OBJS1 = o.unzip o.crc32 o.crypt o.envargs o.explode
26OBJS2 = o.extract o.fileio o.globals o.inflate o.list o.match
27OBJS3 = o.process o.ttyio o.unreduce o.unshrink o.zipinfo
28OBJS  = $(OBJS1) $(OBJS2) $(OBJS3) o.riscos o.swiven o.acorn
29OBJF  = o.funzip o.crc32 o.cryptf o.globalsf o.inflatef o.ttyiof \
30	o.riscos o.swiven
31OBJX  = o.unzipsfx o.crc32  o.crypt_ o.extract_ o.fileio_ o.globals_ \
32	o.inflate_ o.match_ o.process_ o.ttyio_ o.acorn_ o.swiven o.riscos_
33
34UNZIP_H = h.unzip h.unzpriv h.globals acorn.h.riscos acorn.h.swiven
35
36all:	  unzip funzip unzipsfx
37
38
39install:  unzip funzip unzipsfx
40	$(SQUEEZE) unzip %.unzip
41	$(SQUEEZE) funzip %.funzip
42	$(SQUEEZE) unzipsfx unzipsfx
43	copy %.unzip %.zipinfo ~CVF
44
45# rules for unzip and funzip
46o.crc32:	c.crc32 $(UNZIP_H) h.zip h.crc32
47	$(CC) $(CFLAGS) -c c.crc32 -o o.crc32
48o.crypt:	c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
49	$(CC) $(CFLAGS) -c c.crypt -o o.crypt
50o.envargs:	c.envargs $(UNZIP_H)
51	$(CC) $(CFLAGS) -c c.envargs -o o.envargs
52o.explode:	c.explode $(UNZIP_H)
53	$(CC) $(CFLAGS) -c c.explode -o o.explode
54o.extract:	c.extract $(UNZIP_H) h.crc32 h.crypt
55	$(CC) $(CFLAGS) -c c.extract -o o.extract
56o.fileio:	c.fileio $(UNZIP_H) h.crc32 h.crypt h.ttyio h.ebcdic
57	$(CC) $(CFLAGS) -c c.fileio -o o.fileio
58o.funzip:	c.funzip $(UNZIP_H) h.crc32 h.crypt h.ttyio
59	$(CC) $(CFLAGS) -c c.funzip -o o.funzip
60o.globals:	c.globals $(UNZIP_H)
61	$(CC) $(CFLAGS) -c c.globals -o o.globals
62o.inflate:	c.inflate h.inflate $(UNZIP_H)
63	$(CC) $(CFLAGS) -c c.inflate -o o.inflate
64o.list:		c.list $(UNZIP_H)
65	$(CC) $(CFLAGS) -c c.list -o o.list
66o.match:	c.match $(UNZIP_H)
67	$(CC) $(CFLAGS) -c c.match -o o.match
68o.process:	c.process $(UNZIP_H) h.crc32
69	$(CC) $(CFLAGS) -c c.process -o o.process
70o.ttyio:	c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
71	$(CC) $(CFLAGS) -c c.ttyio -o o.ttyio
72o.unreduce:	c.unreduce $(UNZIP_H)
73	$(CC) $(CFLAGS) -c c.unreduce -o o.unreduce
74o.unshrink:	c.unshrink $(UNZIP_H)
75	$(CC) $(CFLAGS) -c c.unshrink -o o.unshrink
76o.unzip:	c.unzip $(UNZIP_H) h.crypt h.unzvers h.consts
77	$(CC) $(CFLAGS) -c c.unzip -o o.unzip
78o.zipinfo:	c.zipinfo $(UNZIP_H)
79	$(CC) $(CFLAGS) -c c.zipinfo -o o.zipinfo
80
81o.crypt_:	c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
82	$(CC) $(CFLAGS) -DSFX -c c.crypt -o o.crypt_
83o.extract_:	c.extract $(UNZIP_H) h.crc32 h.crypt
84	$(CC) $(CFLAGS) -DSFX -c c.extract -o o.extract_
85o.fileio_:	c.fileio $(UNZIP_H) h.crc32 h.crypt h.ttyio h.ebcdic
86	$(CC) $(CFLAGS) -DSFX -c c.fileio -o o.fileio_
87o.globals_:	c.globals $(UNZIP_H)
88	$(CC) $(CFLAGS) -DSFX -c c.globals -o o.globals_
89o.inflate_:	c.inflate h.inflate $(UNZIP_H) h.crypt
90	$(CC) $(CFLAGS) -DSFX -c c.inflate -o o.inflate_
91o.match_:	c.match $(UNZIP_H)
92	$(CC) $(CFLAGS) -DSFX -c c.match -o o.match_
93o.process_:	c.process $(UNZIP_H) h.crc32
94	$(CC) $(CFLAGS) -DSFX -c c.process -o o.process_
95o.ttyio_:	c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
96	$(CC) $(CFLAGS) -DSFX -c c.ttyio -o o.ttyio_
97
98o.unzipsfx:	c.unzip $(UNZIP_H) h.crypt h.unzvers h.consts
99	$(CC) $(CFLAGS) -DSFX -c c.unzip -o o.unzipsfx
100
101o.cryptf:	c.crypt $(UNZIP_H) h.zip h.crypt h.crc32 h.ttyio
102	$(CC) $(CFLAGS) -DFUNZIP -c c.crypt -o o.cryptf
103o.globalsf:	c.globals $(UNZIP_H)
104	$(CC) $(CFLAGS) -DFUNZIP -c c.globals -o o.globalsf
105o.inflatef:	c.inflate h.inflate $(UNZIP_H) h.crypt
106	$(CC) $(CFLAGS) -DFUNZIP -c c.inflate -o o.inflatef
107o.ttyiof:	c.ttyio $(UNZIP_H) h.zip h.crypt h.ttyio
108	$(CC) $(CFLAGS) -DFUNZIP -c c.ttyio -o o.ttyiof
109
110o.acorn:	acorn.c.acorn $(UNZIP_H)
111	$(CC) $(CFLAGS) -I@ -c acorn.c.acorn
112o.acorn_:	acorn.c.acorn $(UNZIP_H)
113	$(CC) $(CFLAGS) -I@ -c -DSFX -DSFX_EXDIR -o o.acorn_ acorn.c.acorn
114
115o.riscos:	acorn.c.riscos $(UNZIP_H)
116	$(CC) $(CFLAGS) -I@ -c acorn.c.riscos
117o.riscos_:	acorn.c.riscos $(UNZIP_H)
118	$(CC) $(CFLAGS) -I@ -c -DSFX -DSFX_EXDIR -o o.riscos_ acorn.c.riscos
119
120o.swiven:	acorn.s.swiven
121	$(ASM) $(ASMFLAGS) acorn.s.swiven -o o.swiven
122
123unzip:	  $(OBJS)
124	  $(BIND) -o unzip$(E) $(LFLAGS1) $(OBJS) $(LFLAGS2)
125funzip:	  $(OBJF)
126	  $(BIND) -o funzip$(E) $(LFLAGS1) $(OBJF) $(LFLAGS2)
127unzipsfx: $(OBJX)
128	  $(BIND) -o unzipsfx$(E) $(LFLAGS1) $(OBJX) $(LFLAGS2)
129
130clean:
131	remove unzip
132	remove funzip
133	remove zipinfo
134	remove unzipsfx
135	create o.!fake! 0
136	wipe o.* ~cf
137
138# end of Makefile
139