1# Makefile for UnZip, fUnZip and UnZipSFX for native Win32-Intel ports of gcc.
2# Currently supported implementations: Cygnus/Win32 and MinGW32.
3#
4# First version: Cosmin Truta, Dec 1997.
5# Last revision: Christian Spieler, 09-Aug-2008.
6#
7# To use, do "make -f win32/makefile.gcc".
8
9# configuration switches supported:
10#   NOASM=1     disable assembler crc32 code, the generic C source code
11#               is used instead.
12#   NOCRC_OPT=1 disable "unfolding CRC tables" optimization.
13#   OPT_P6=1    add "modern gcc" tuning option for PentiumPro family CPU.
14#   USEBZ2=1    activate integrated compilation of bzip2 compression support,
15#               this requires the bzip2 sources present in the bzip2 subfolder.
16#   USEZLIB=1   replace internal deflate code by externally provided zlib.
17#   USE_POSIX=1 build posix-style binaries targeted for the CygWin unix
18#               emulation environment.
19
20
21### Optional section
22
23# The following options allow to override the default assembler code usage
24ifdef NOASM
25APPLY_ASMCRC=0
26endif
27ifdef USEASM
28APPLY_ASMCRC=1
29endif
30
31# The external zlib library supplies its own crc32 implementation...
32ifdef USEZLIB
33APPLY_ASMCRC=0
34endif
35
36# default is ASM CRC code (from .S source) for now...
37ifndef APPLY_ASMCRC
38APPLY_ASMCRC=1
39endif
40
41# optional inclusion of bzip2 decompression
42IZ_BZIP2 = bzip2
43ifdef USEBZ2
44INC_BZ2LIB = -I$(IZ_BZIP2)
45LOCFLAGS = $(INC_BZ2LIB) -DUSE_BZIP2
46LD_BZ2LIB = -L$(IZ_BZIP2) -lbz2
47LIBBZIP2 = $(IZ_BZIP2)/libbz2.a
48else
49INC_BZ2LIB =
50LOCFLAGS =
51LD_BZ2LIB =
52LIBBZIP2 =
53endif
54LIBBZIP2X = $(LIBBZIP2)
55
56ifndef USEZLIB
57
58# Apply the "CRC unfolding tables" optimization unless explicitly disabled.
59# (This optimization might have negative effects on old CPU designs with a
60# small first-level data cache.)
61ifndef NOCRC_OPT
62LOCFLAGS += -DIZ_CRCOPTIM_UNFOLDTBL
63endif
64
65# Optional nonstandard preprocessor flags (as -DUSE_ZLIB or -DUSE_SMITH_CODE)
66# should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added
67# to the declaration of LOCFLAGS here:
68ifneq ($(APPLY_ASMCRC),0)
69LOCFLAGS += -DASM_CRC
70endif
71
72else    # ifndef USEZLIB
73
74LOCFLAGS += -DUSE_ZLIB
75
76endif   # ifndef USEZLIB ... else ...
77
78# Finally, append additional externally supplied options.
79LOCFLAGS += $(LOCAL_UNZIP)
80
81# Some gcc distributions for Win32 (e.g. CygWin) try to emulate a POSIX-
82# compatible (Unix-style) environment.  This Makefile defaults to a
83# "native Win32" build.  To build POSIX-mode binaries, it is recommended
84# to use the Makefile of the Unix port.  However, by defining the variable
85# "USE_POSIX", building binaries for the POSIX environment can be enabled
86# here as well.
87ifdef USE_POSIX
88CC_ENVIR_OPT = -DUNIX -DFORCE_UNIX_OVER_WIN32
89else
90CC_ENVIR_OPT = -DWIN32 -DFORCE_WIN32_OVER_UNIX
91endif
92
93
94### Compiler-specific section
95
96# ------------ GNU C ------------
97CC = gcc
98
99#AS = as
100AS = $(CC)
101
102#LD = ld
103LD = $(CC)
104
105AR = ar
106
107RC = windres
108
109# Quiet
110CC_QUIET_OPT =
111AS_QUIET_OPT = $(CC_QUIET_OPT)
112LD_QUIET_OPT = $(CC_QUIET_OPT)
113
114# Warnings
115CC_WARN_OPT = -Wall
116AS_WARN_OPT = $(CC_WARN_OPT)
117LD_WARN_OPT =
118
119# Debug version
120CC_DEBUG_OPT = -g
121AS_DEBUG_OPT = $(CC_DEBUG_OPT)
122LD_DEBUG_OPT = $(CC_DEBUG_OPT)
123
124# Release version
125CC_RELEASE_OPT =
126AS_RELEASE_OPT =
127LD_RELEASE_OPT = -s
128
129# Prefered target CPU (instruction scheduling optimized for...)
130ifndef CC_CPU_OPT
131CC_CPU_OPT = -mcpu=pentiumpro
132endif
133
134# Smallest code  (-Os is new since EGC 1.1, use -O1 for 2.8.1 and earlier)
135CC_SIZE_OPT = -Os $(CC_CPU_OPT)
136
137# Fastest code
138CC_SPEED_OPT = -O2 $(CC_CPU_OPT)
139
140# Output object file name
141CC_OUT_OPT = -o
142
143# Other specific options
144CC_SPECIFIC_OPT = -c $(CC_ENVIR_OPT)
145AS_SPECIFIC_OPT = -c
146LD_SPECIFIC_OPT = -o $@
147
148# Libraries for the debug & release version
149# (GCC 2.95 and newer does not require the system library specifications)
150ifdef USEZLIB
151LD_RELEASE_LIBS = -L. -lz -luser32 -ladvapi32
152else
153LD_RELEASE_LIBS = -luser32 -ladvapi32
154endif
155LD_DEBUG_LIBS = $(LD_RELEASE_LIBS)
156
157
158### System-specific section
159
160# Suffixes
161OBJ = .o
162EXE = .exe
163
164.SUFFIXES: .c .S $(OBJ) $(EXE)
165.PHONY: FORCE
166
167# Commands
168RM = rm -f
169
170
171### General section
172
173CFLAGS  = $(CC_SPECIFIC_OPT) $(CC_QUIET_OPT) $(CC_WARN_OPT) $(LOCFLAGS) \
174 $(CC_OUT_OPT) $@
175ASFLAGS = $(AS_SPECIFIC_OPT) $(AS_QUIET_OPT) $(AS_WARN_OPT) $(LOCFLAGS)
176LDFLAGS = $(LD_SPECIFIC_OPT) $(LD_QUIET_OPT) $(LD_WARN_OPT)
177
178# To build with debug info, use 'make DEBUG=1'.
179ifdef DEBUG
180CVER     = $(CC_DEBUG_OPT)
181ASVER    = $(AS_DEBUG_OPT)
182LDVER    = $(LD_DEBUG_OPT)
183GENFLAGS =
184FFLAGS   = -DFUNZIP
185SFXFLAGS = -DSFX
186GENDLLFL = -DDLL -DWINDLL
187GENGUILB = -DSFX -DDLL -DWINDLL -DUNZIPLIB
188GENGUISX = -DSFX
189GENLIBFL = -DDLL -DWINDLL -DUNZIPLIB
190LDLIBS   = $(LD_DEBUG_LIBS)
191else
192CVER     = $(CC_RELEASE_OPT)
193ASVER    = $(AS_RELEASE_OPT)
194LDVER    = $(LD_RELEASE_OPT)
195GENFLAGS = $(CC_SPEED_OPT)
196FFLAGS   = $(CC_SPEED_OPT) -DFUNZIP
197SFXFLAGS = $(CC_SIZE_OPT) -DSFX
198GENDLLFL = $(CC_SPEED_OPT) -DDLL -DWINDLL
199GENGUILB = $(CC_SIZE_OPT) -DSFX -DDLL -DWINDLL -DUNZIPLIB
200GENGUISX = $(CC_SIZE_OPT) -DSFX
201GENLIBFL = $(CC_SPEED_OPT) -DDLL -DWINDLL -DUNZIPLIB
202LDLIBS   = $(LD_RELEASE_LIBS)
203endif
204GUILDFLAG=-mwindows
205
206# Object files
207ifneq ($(APPLY_ASMCRC),0)
208OBJA  = crc_i386$(OBJ)
209else
210OBJA  =
211endif
212OBJU1 = unzip$(OBJ) crc32$(OBJ) crypt$(OBJ) envargs$(OBJ)
213OBJU2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) inflate$(OBJ)
214OBJU3 = list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) ubz2err$(OBJ)
215OBJU4 = unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
216OBJUS = win32$(OBJ) win32i64$(OBJ) nt$(OBJ) winapprc$(OBJ)
217OBJU  = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJU4) $(OBJA) $(OBJUS)
218OBJX1 = unzipsfx$(OBJ) crc32x$(OBJ) cryptx$(OBJ) extractx$(OBJ)
219OBJX2 = fileiox$(OBJ) globalsx$(OBJ) inflatex$(OBJ) matchx$(OBJ) processx$(OBJ)
220OBJX3 = ttyiox$(OBJ) ubz2errx$(OBJ)
221OBJXS = win32x$(OBJ) win32i64x$(OBJ) ntx$(OBJ)
222OBJX  = $(OBJX1) $(OBJX2) $(OBJX3) $(OBJA) $(OBJXS)
223OBJF1 = funzip$(OBJ) crc32$(OBJ) cryptf$(OBJ) globalsf$(OBJ) inflatef$(OBJ)
224OBJF2 = ttyiof$(OBJ)
225OBJFS = win32f$(OBJ) win32i64f$(OBJ)
226OBJF  = $(OBJF1) $(OBJF2) $(OBJA) $(OBJFS)
227OBJDLL = windll$(OBJ) windllrc$(OBJ) api$(OBJ)
228OBJD1 = crc32l$(OBJ) cryptl$(OBJ)
229OBJD2 = explodel$(OBJ) extractl$(OBJ) fileiol$(OBJ) globalsl$(OBJ)
230OBJD3 = inflatel$(OBJ) listl$(OBJ) matchl$(OBJ) processl$(OBJ) ubz2errl$(OBJ)
231OBJD4 = unreducl$(OBJ) unshrnkl$(OBJ) zipinfol$(OBJ)
232OBJDS = win32l$(OBJ) win32i64l$(OBJ) ntl$(OBJ)
233OBJD  = $(OBJDLL) $(OBJD1) $(OBJD2) $(OBJD3) $(OBJD4) $(OBJA) $(OBJDS)
234OBLX1 = apig$(OBJ) crc32g$(OBJ) cryptg$(OBJ)
235OBLX2 = extractg$(OBJ) fileiog$(OBJ) globalsg$(OBJ) inflateg$(OBJ)
236OBLX3 = matchg$(OBJ) processg$(OBJ) ubz2errg$(OBJ)
237OBLXS = win32g$(OBJ) win32i64g$(OBJ) ntg$(OBJ) windllg$(OBJ)
238OBLX  = $(OBLX1) $(OBLX2) $(OBLX3) $(OBJA) $(OBLXS)
239OBGX  = sfxwiz$(OBJ) sfxwizrc$(OBJ)
240OBJLIB = windllb$(OBJ) apib$(OBJ)
241OBJB1 = crc32b$(OBJ) cryptb$(OBJ)
242OBJB2 = explodeb$(OBJ) extractb$(OBJ) fileiob$(OBJ) globalsb$(OBJ)
243OBJB3 = inflateb$(OBJ) listb$(OBJ) matchb$(OBJ) processb$(OBJ) ubz2errb$(OBJ)
244OBJB4 = unreducb$(OBJ) unshrnkb$(OBJ) zipinfob$(OBJ)
245OBJBS = win32b$(OBJ) win32i64b$(OBJ) ntb$(OBJ)
246OBJB  = $(OBJLIB) $(OBJB1) $(OBJB2) $(OBJB3) $(OBJB4) $(OBJA) $(OBJBS)
247
248UNZIP_H = unzip.h unzpriv.h globals.h win32/w32cfg.h
249WINDLL_H = windll/windll.h windll/structs.h windll/decs.h
250DLLDEF = windll/windllgcc.def
251WINDLL_IMP_H = windll/decs.h windll/structs.h
252
253
254# Default target is all the executables
255unzips: unzip$(EXE) funzip$(EXE) unzipsfx$(EXE)
256dll:    unzip32.dll
257dllsample: uzexampl$(EXE)
258guisfx: SFXWiz32$(EXE)
259lib:    libunzip32.a
260all:    unzips dll dllsample guisfx lib
261
262unzip$(EXE): $(OBJU) $(LIBBZIP2)
263	$(LD) $(LDFLAGS) $(LDVER) $(OBJU) $(LD_BZ2LIB) $(LDLIBS)
264
265unzipsfx$(EXE): $(OBJX) $(LIBBZIP2X)
266	$(LD) $(LDFLAGS) $(LDVER) $(OBJX) $(LDLIBS)
267
268funzip$(EXE): $(OBJF)
269	$(LD) $(LDFLAGS) $(LDVER) $(OBJF) $(LDLIBS)
270
271unzip32.dll: $(DLLDEF) $(OBJD) $(LIBBZIP2)
272	dllwrap --driver-name $(CC) --def $(DLLDEF) $(LDFLAGS) $(LDVER) $(OBJD) $(LD_BZ2LIB) $(LDLIBS)
273
274libunzsfx32.a: $(OBLX)
275	$(AR) -rus $@ $(OBLX)
276
277SFXWiz32$(EXE): $(OBGX) libunzsfx32.a $(LIBBZIP2X)
278	$(LD) $(GUILDFLAG) $(LDFLAGS) $(LDVER) $(OBGX) -L. -lunzsfx32 $(LDLIBS)
279
280uzexampl$(EXE): uzexampl$(OBJ)
281	$(CC) $(LDFLAGS) $(LDVER) uzexampl$(OBJ) -lversion $(LDLIBS)
282
283libunzip32.a: $(OBJB)
284	$(AR) -rus $@ $(OBJB)
285
286
287# create/update the library for the optional bzip2 support:
288$(IZ_BZIP2)/libbz2.a: FORCE
289	$(subst /,\,$(MAKE)) -C $(IZ_BZIP2) -f Makebz2.iz CC="$(CC)" RM="$(RM)"
290FORCE:
291
292# How to compile sources
293.c$(OBJ):
294	$(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $<
295.S$(OBJ):
296	$(AS) $(ASFLAGS) $(ASVER) $(GENFLAGS) $<
297
298# Dependencies
299crc32$(OBJ):    crc32.c $(UNZIP_H) zip.h crc32.h
300crypt$(OBJ):    crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
301envargs$(OBJ):  envargs.c $(UNZIP_H)
302explode$(OBJ):  explode.c $(UNZIP_H)
303extract$(OBJ):  extract.c $(UNZIP_H) crc32.h crypt.h
304fileio$(OBJ):   fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
305funzip$(OBJ):   funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h
306globals$(OBJ):  globals.c $(UNZIP_H)
307inflate$(OBJ):  inflate.c inflate.h $(UNZIP_H)
308list$(OBJ):     list.c $(UNZIP_H)
309match$(OBJ):    match.c $(UNZIP_H)
310process$(OBJ):  process.c $(UNZIP_H) crc32.h
311ttyio$(OBJ):    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
312ubz2err$(OBJ): ubz2err.c $(UNZIP_H)
313unreduce$(OBJ): unreduce.c $(UNZIP_H)
314unshrink$(OBJ): unshrink.c $(UNZIP_H)
315unzip$(OBJ):    unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
316zipinfo$(OBJ):  zipinfo.c $(UNZIP_H)
317crc_i386$(OBJ): crc_i386.S
318
319win32$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h
320	$(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. $<
321
322win32i64$(OBJ): win32/win32i64.c $(UNZIP_H)
323	$(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. $<
324
325nt$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h
326	$(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. $<
327
328winapprc$(OBJ):	win32/winapp.rc unzvers.h
329	- $(RC) -o $@ $<
330
331# UnZipSFX compilation section
332crc32x$(OBJ): crc32.c $(UNZIP_H) zip.h crc32.h
333	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
334
335cryptx$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
336	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
337
338extractx$(OBJ): extract.c $(UNZIP_H) crc32.h crypt.h
339	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
340
341fileiox$(OBJ):   fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
342	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
343
344globalsx$(OBJ): globals.c $(UNZIP_H)
345	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
346
347inflatex$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
348	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
349
350matchx$(OBJ): match.c $(UNZIP_H)
351	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
352
353processx$(OBJ): process.c $(UNZIP_H) crc32.h
354	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
355
356ttyiox$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
357	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
358
359ubz2errx$(OBJ): ubz2err.c $(UNZIP_H)
360	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
361
362unzipsfx$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
363	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) $<
364
365win32x$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h
366	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) -I. $<
367
368win32i64x$(OBJ): win32/win32i64.c $(UNZIP_H)
369	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) -I. $<
370
371ntx$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h
372	$(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) -I. $<
373
374# fUnZip compilation section
375cryptf$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
376	$(CC) $(CFLAGS) $(CVER) $(FFLAGS) $<
377
378globalsf$(OBJ): globals.c $(UNZIP_H)
379	$(CC) $(CFLAGS) $(CVER) $(FFLAGS) $<
380
381inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
382	$(CC) $(CFLAGS) $(CVER) $(FFLAGS) $<
383
384ttyiof$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
385	$(CC) $(CFLAGS) $(CVER) $(FFLAGS) $<
386
387win32f$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h
388	$(CC) $(CFLAGS) $(CVER) $(FFLAGS) -I. $<
389
390win32i64f$(OBJ): win32/win32i64.c $(UNZIP_H)
391	$(CC) $(CFLAGS) $(CVER) $(FFLAGS) -I. $<
392
393# WINDLL sample
394uzexampl$(OBJ):	windll/uzexampl.c windll/uzexampl.h
395	$(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. $<
396
397# DLL compilation section
398api$(OBJ): api.c $(UNZIP_H) $(WINDLL_H) unzvers.h
399	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
400
401crc32l$(OBJ):	crc32.c $(UNZIP_H) zip.h crc32.h
402	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
403
404cryptl$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
405	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
406
407explodel$(OBJ):	explode.c $(UNZIP_H)
408	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
409
410extractl$(OBJ):	extract.c $(UNZIP_H) $(WINDLL_H) crc32.h crypt.h
411	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
412
413fileiol$(OBJ):	fileio.c $(UNZIP_H) $(WINDLL_H) crc32.h crypt.h ttyio.h ebcdic.h
414	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
415
416globalsl$(OBJ):	globals.c $(UNZIP_H)
417	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
418
419inflatel$(OBJ):	inflate.c inflate.h $(UNZIP_H) crypt.h
420	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
421
422listl$(OBJ):	list.c $(UNZIP_H) $(WINDLL_H)
423	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
424
425matchl$(OBJ):	match.c $(UNZIP_H)
426	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
427
428processl$(OBJ):	process.c $(UNZIP_H) $(WINDLL_H) crc32.h
429	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
430
431ubz2errl$(OBJ): ubz2err.c $(UNZIP_H)
432	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
433
434unreducl$(OBJ):	unreduce.c $(UNZIP_H)
435	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
436
437unshrnkl$(OBJ):	unshrink.c $(UNZIP_H)
438	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
439
440zipinfol$(OBJ):	zipinfo.c $(UNZIP_H)
441	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) $<
442
443win32l$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h
444	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. $<
445
446win32i64l$(OBJ): win32/win32i64.c $(UNZIP_H)
447	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. $<
448
449ntl$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h
450	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. $<
451
452windll$(OBJ): windll/windll.c $(UNZIP_H) $(WINDLL_H) crypt.h unzvers.h consts.h
453	$(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. $<
454
455windllrc$(OBJ):	windll/windll.rc unzvers.h
456	- $(RC) -o $@ $<
457
458# SFX Lib compilation section
459apig$(OBJ):	api.c $(UNZIP_H) $(WINDLL_H) unzvers.h
460	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
461
462crc32g$(OBJ):	crc32.c $(UNZIP_H) zip.h crc32.h
463	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
464
465cryptg$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
466	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
467
468extractg$(OBJ):	extract.c $(UNZIP_H) $(WINDLL_H) crc32.h crypt.h
469	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
470
471fileiog$(OBJ):	fileio.c $(UNZIP_H) $(WINDLL_H) crc32.h crypt.h ttyio.h ebcdic.h
472	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
473
474globalsg$(OBJ):	globals.c $(UNZIP_H)
475	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
476
477inflateg$(OBJ):	inflate.c inflate.h $(UNZIP_H)
478	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
479
480matchg$(OBJ):	match.c $(UNZIP_H)
481	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
482
483processg$(OBJ):	process.c $(UNZIP_H) $(WINDLL_H) crc32.h
484	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
485
486ubz2errg$(OBJ): ubz2err.c $(UNZIP_H)
487	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) $<
488
489win32g$(OBJ):	win32/win32.c $(UNZIP_H) win32/nt.h
490	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) -I. $<
491
492win32i64g$(OBJ):	win32/win32i64.c $(UNZIP_H)
493	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) -I. $<
494
495ntg$(OBJ):	win32/nt.c $(UNZIP_H) win32/nt.h
496	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) -I. $<
497
498windllg$(OBJ):  windll/windll.c $(UNZIP_H) $(WINDLL_H) crypt.h unzvers.h consts.h
499	$(CC) $(CFLAGS) $(CVER) $(GENGUILB) -I. $<
500
501sfxwiz$(OBJ):	windll/guisfx/sfxwiz.c windll/guisfx/dialog.h $(WINDLL_IMP_H)
502	$(CC) $(CFLAGS) $(CVER) $(GENGUISX) -I. $<
503
504sfxwizrc$(OBJ):	windll/guisfx/sfxwiz.rc
505	- $(RC)  --include-dir windll/guisfx --define WIN32 -o$@ $<
506
507# Static LIB compilation section
508apib$(OBJ): api.c $(UNZIP_H) $(WINDLL_H) unzvers.h
509	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
510
511crc32b$(OBJ):	crc32.c $(UNZIP_H) zip.h crc32.h
512	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
513
514cryptb$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
515	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
516
517explodeb$(OBJ):	explode.c $(UNZIP_H)
518	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
519
520extractb$(OBJ):	extract.c $(UNZIP_H) crc32.h crypt.h
521	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
522
523fileiob$(OBJ):	fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
524	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
525
526globalsb$(OBJ):	globals.c $(UNZIP_H)
527	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
528
529inflateb$(OBJ):	inflate.c inflate.h $(UNZIP_H) crypt.h
530	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
531
532listb$(OBJ):	list.c $(UNZIP_H) $(WINDLL_H)
533	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
534
535matchb$(OBJ):	match.c $(UNZIP_H)
536	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
537
538processb$(OBJ):	process.c $(UNZIP_H) crc32.h
539	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
540
541ubz2errb$(OBJ): ubz2err.c $(UNZIP_H)
542	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
543
544unreducb$(OBJ):	unreduce.c $(UNZIP_H)
545	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
546
547unshrnkb$(OBJ):	unshrink.c $(UNZIP_H)
548	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
549
550zipinfob$(OBJ):	zipinfo.c $(UNZIP_H)
551	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) $<
552
553win32b$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h
554	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. $<
555
556win32i64b$(OBJ): win32/win32i64.c $(UNZIP_H)
557	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. $<
558
559ntb$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h
560	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. $<
561
562windllb$(OBJ): windll/windll.c $(UNZIP_H) $(WINDLL_H) crypt.h unzvers.h consts.h
563	$(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. $<
564
565clean:
566	-$(subst /,\,$(MAKE)) -C $(IZ_BZIP2) -f Makebz2.iz RM="$(RM)" clean
567	-$(RM) *$(OBJ)
568	-$(RM) unzip$(EXE) funzip$(EXE) unzipsfx$(EXE)
569	-$(RM) unzip32.dll uzexampl$(EXE) SFXWiz32$(EXE)
570	-$(RM) libunzip32.a libunzsfx32.a
571