# Makefile for UnZip, fUnZip and UnZipSFX for native Win32-Intel ports of gcc. # Currently supported implementations: Cygnus/Win32 and MinGW32. # # First version: Cosmin Truta , Dec 1997. # Last revision: Christian Spieler, 10-Nov-2001 # # To use, do "make -f win32/makefile.gcc". ### Optional section # Optional nonstandard preprocessor flags (as -DUSE_ZLIB or -DUSE_SMITH_CODE) # should be added to the environment via "set LOCAL_UNZIP=-DFOO" or added # to the declaration of LOCFLAGS here: LOCFLAGS = $(LOCAL_UNZIP) ### Compiler-specific section # ------------ GNU C ------------ CC = gcc #AS = as AS = $(CC) #LD = ld LD = $(CC) AR = ar RC = windres # Quiet CC_QUIET_OPT = AS_QUIET_OPT = $(CC_QUIET_OPT) LD_QUIET_OPT = $(CC_QUIET_OPT) # Warnings CC_WARN_OPT = -Wall AS_WARN_OPT = $(CC_WARN_OPT) LD_WARN_OPT = # Debug version CC_DEBUG_OPT = -g AS_DEBUG_OPT = $(CC_DEBUG_OPT) LD_DEBUG_OPT = $(CC_DEBUG_OPT) # Release version CC_RELEASE_OPT = AS_RELEASE_OPT = LD_RELEASE_OPT = -s # Prefered target CPU (instruction scheduling optimized for...) #ifndef CC_CPU_OPT CC_CPU_OPT = -mcpu=pentium #endif # Smallest code (-Os is new since EGC 1.1, use -O1 for 2.8.1 and earlier) CC_SIZE_OPT = -Os $(CC_CPU_OPT) # Fastest code CC_SPEED_OPT = -O2 $(CC_CPU_OPT) # Output object file name CC_OUT_OPT = -o # Other specific options CC_SPECIFIC_OPT = -c -DASM_CRC -DWIN32 AS_SPECIFIC_OPT = -c LD_SPECIFIC_OPT = -o $@ # Libraries for the debug & release version # (GCC 2.95 and newer does not require the following library specifications) LD_RELEASE_LIBS = -luser32 -ladvapi32 LD_DEBUG_LIBS = $(LD_RELEASE_LIBS) ### System-specific section # Suffixes OBJ = .o EXE = .exe .SUFFIXES: .c .S $(OBJ) $(EXE) # Commands RM = rm -f ### General section CFLAGS = $(CC_SPECIFIC_OPT) $(CC_QUIET_OPT) $(CC_WARN_OPT) $(LOCFLAGS) \ $(CC_OUT_OPT) $@ ASFLAGS = $(AS_SPECIFIC_OPT) $(AS_QUIET_OPT) $(AS_WARN_OPT) $(LOCFLAGS) LDFLAGS = $(LD_SPECIFIC_OPT) $(LD_QUIET_OPT) $(LD_WARN_OPT) # To build with debug info, use 'make DEBUG=1'. ifdef DEBUG CVER = $(CC_DEBUG_OPT) ASVER = $(AS_DEBUG_OPT) LDVER = $(LD_DEBUG_OPT) GENFLAGS = FFLAGS = -DFUNZIP SFXFLAGS = -DSFX GENDLLFL = -DDLL -DWINDLL GENGUILB = -DSFX -DDLL -DWINDLL -DUNZIPLIB GENGUISX = -DSFX GENLIBFL = -DDLL -DWINDLL -DUNZIPLIB LDLIBS = $(LD_DEBUG_LIBS) else CVER = $(CC_RELEASE_OPT) ASVER = $(AS_RELEASE_OPT) LDVER = $(LD_RELEASE_OPT) GENFLAGS = $(CC_SPEED_OPT) FFLAGS = $(CC_SPEED_OPT) -DFUNZIP SFXFLAGS = $(CC_SIZE_OPT) -DSFX GENDLLFL = $(CC_SPEED_OPT) -DDLL -DWINDLL GENGUILB = $(CC_SIZE_OPT) -DSFX -DDLL -DWINDLL -DUNZIPLIB GENGUISX = $(CC_SIZE_OPT) -DSFX GENLIBFL = $(CC_SPEED_OPT) -DDLL -DWINDLL -DUNZIPLIB LDLIBS = $(LD_RELEASE_LIBS) endif GUILDFLAG=-mwindows # Object files OBJA = crc_i386$(OBJ) OBJU1 = unzip$(OBJ) crc32$(OBJ) crctab$(OBJ) crypt$(OBJ) envargs$(OBJ) OBJU2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) inflate$(OBJ) OBJU3 = list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) unreduce$(OBJ) OBJU4 = unshrink$(OBJ) zipinfo$(OBJ) OBJUS = win32$(OBJ) nt$(OBJ) OBJU = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJU4) $(OBJA) $(OBJUS) OBJX1 = unzipsfx$(OBJ) crc32x$(OBJ) crctabx$(OBJ) cryptx$(OBJ) extractx$(OBJ) OBJX2 = fileiox$(OBJ) globalsx$(OBJ) inflatex$(OBJ) matchx$(OBJ) processx$(OBJ) OBJX3 = ttyiox$(OBJ) OBJXS = win32x$(OBJ) ntx$(OBJ) OBJX = $(OBJX1) $(OBJX2) $(OBJX3) $(OBJA) $(OBJXS) OBJF1 = funzip$(OBJ) crc32$(OBJ) cryptf$(OBJ) globalsf$(OBJ) inflatef$(OBJ) OBJF2 = ttyiof$(OBJ) OBJFS = win32f$(OBJ) OBJF = $(OBJF1) $(OBJF2) $(OBJA) $(OBJFS) OBJDLL = windll$(OBJ) windllrc$(OBJ) api$(OBJ) OBJD1 = crc32l$(OBJ) crctabl$(OBJ) cryptl$(OBJ) OBJD2 = explodel$(OBJ) extractl$(OBJ) fileiol$(OBJ) globalsl$(OBJ) OBJD3 = inflatel$(OBJ) listl$(OBJ) matchl$(OBJ) processl$(OBJ) OBJD4 = unreducl$(OBJ) unshrnkl$(OBJ) zipinfol$(OBJ) OBJDS = win32l$(OBJ) ntl$(OBJ) OBJD = $(OBJDLL) $(OBJD1) $(OBJD2) $(OBJD3) $(OBJD4) $(OBJA) $(OBJDS) OBLX1 = apig$(OBJ) crc32g$(OBJ) crctabg$(OBJ) cryptg$(OBJ) OBLX2 = extractg$(OBJ) fileiog$(OBJ) globalsg$(OBJ) inflateg$(OBJ) OBLX3 = matchg$(OBJ) processg$(OBJ) OBLXS = win32g$(OBJ) ntg$(OBJ) windllg$(OBJ) OBLX = $(OBLX1) $(OBLX2) $(OBLX3) $(OBJA) $(OBLXS) OBGX = sfxwiz$(OBJ) sfxwizrc$(OBJ) OBJLIB = windllb$(OBJ) apib$(OBJ) OBJB1 = crc32b$(OBJ) crctabb$(OBJ) cryptb$(OBJ) OBJB2 = explodeb$(OBJ) extractb$(OBJ) fileiob$(OBJ) globalsb$(OBJ) OBJB3 = inflateb$(OBJ) listb$(OBJ) matchb$(OBJ) processb$(OBJ) OBJB4 = unreducb$(OBJ) unshrnkb$(OBJ) zipinfob$(OBJ) OBJBS = win32b$(OBJ) ntb$(OBJ) OBJB = $(OBJLIB) $(OBJB1) $(OBJB2) $(OBJB3) $(OBJB4) $(OBJA) $(OBJBS) UNZIP_H = unzip.h unzpriv.h globals.h win32/w32cfg.h WINDLL_H = windll/windll.h windll/structs.h windll/decs.h DLLDEF = windll/windllgcc.def WINDLL_IMP_H = windll/decs.h windll/structs.h # Default target is all the executables unzips: unzip$(EXE) funzip$(EXE) unzipsfx$(EXE) dll: unzip32.dll dllsample: uzexampl.exe guisfx: SFXWiz32.exe lib: libunzip32.a all: unzips dll dllsample guisfx lib unzip$(EXE): $(OBJU) $(LD) $(LDFLAGS) $(LDVER) $(OBJU) $(LDLIBS) unzipsfx$(EXE): $(OBJX) $(LD) $(LDFLAGS) $(LDVER) $(OBJX) $(LDLIBS) funzip$(EXE): $(OBJF) $(LD) $(LDFLAGS) $(LDVER) $(OBJF) $(LDLIBS) unzip32.dll: $(DLLDEF) $(OBJD) dllwrap --driver-name $(CC) --def $(DLLDEF) $(LDFLAGS) $(LDVER) $(OBJD) $(LDLIBS) libunzsfx32.a: $(OBLX) $(AR) -rus $@ $(OBLX) SFXWiz32$(EXE): $(OBGX) libunzsfx32.a $(LD) $(GUILDFLAG) $(LDFLAGS) $(LDVER) $(OBGX) -L. -lunzsfx32 $(LDLIBS) uzexampl$(EXE): uzexampl$(OBJ) $(CC) $(LDFLAGS) $(LDVER) uzexampl$(OBJ) -lversion $(LDLIBS) libunzip32.a: $(OBJB) $(AR) -rus $@ $(OBJB) # How to compile sources .c$(OBJ): $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) $< .S$(OBJ): $(AS) $(ASFLAGS) $(ASVER) $(GENFLAGS) $< # Dependencies crc32$(OBJ): crc32.c $(UNZIP_H) zip.h crctab$(OBJ): crctab.c $(UNZIP_H) zip.h crypt$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h envargs$(OBJ): envargs.c $(UNZIP_H) explode$(OBJ): explode.c $(UNZIP_H) extract$(OBJ): extract.c $(UNZIP_H) crypt.h fileio$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h funzip$(OBJ): funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h globals$(OBJ): globals.c $(UNZIP_H) inflate$(OBJ): inflate.c inflate.h $(UNZIP_H) list$(OBJ): list.c $(UNZIP_H) match$(OBJ): match.c $(UNZIP_H) process$(OBJ): process.c $(UNZIP_H) ttyio$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h unreduce$(OBJ): unreduce.c $(UNZIP_H) unshrink$(OBJ): unshrink.c $(UNZIP_H) unzip$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h zipinfo$(OBJ): zipinfo.c $(UNZIP_H) crc_i386$(OBJ): crc_i386.S win32$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. win32/win32.c nt$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. win32/nt.c win32x$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) -I. win32/win32.c ntx$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) -I. win32/nt.c win32f$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # funzip only $(CC) $(CFLAGS) $(CVER) $(FFLAGS) -I. win32/win32.c crc32x$(OBJ): crc32.c $(UNZIP_H) zip.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) crc32.c crctabx$(OBJ): crctab.c $(UNZIP_H) zip.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) crctab.c cryptx$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) crypt.c cryptf$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only $(CC) $(CFLAGS) $(CVER) $(FFLAGS) crypt.c extractx$(OBJ): extract.c $(UNZIP_H) crypt.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) extract.c fileiox$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) fileio.c globalsx$(OBJ): globals.c $(UNZIP_H) # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) globals.c globalsf$(OBJ): globals.c $(UNZIP_H) # funzip only $(CC) $(CFLAGS) $(CVER) $(FFLAGS) globals.c inflatex$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) inflate.c inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h # funzip only $(CC) $(CFLAGS) $(CVER) $(FFLAGS) inflate.c matchx$(OBJ): match.c $(UNZIP_H) # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) match.c processx$(OBJ): process.c $(UNZIP_H) # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) process.c ttyiox$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) ttyio.c ttyiof$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h # funzip only $(CC) $(CFLAGS) $(CVER) $(FFLAGS) ttyio.c unzipsfx$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h # unzipsfx only $(CC) $(CFLAGS) $(CVER) $(SFXFLAGS) unzip.c uzexampl$(OBJ): windll/uzexampl.c windll/uzexampl.h # WINDLL sample $(CC) $(CFLAGS) $(CVER) $(GENFLAGS) -I. windll/uzexampl.c # DLL compilation section api$(OBJ): api.c $(UNZIP_H) $(WINDLL_H) unzvers.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) api.c crc32l$(OBJ): crc32.c $(UNZIP_H) zip.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) crc32.c crctabl$(OBJ): crctab.c $(UNZIP_H) zip.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) crctab.c cryptl$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) crypt.c explodel$(OBJ): explode.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) explode.c extractl$(OBJ): extract.c $(UNZIP_H) $(WINDLL_H) crypt.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) extract.c fileiol$(OBJ): fileio.c $(UNZIP_H) $(WINDLL_H) crypt.h ttyio.h ebcdic.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) fileio.c globalsl$(OBJ): globals.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) globals.c inflatel$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) inflate.c listl$(OBJ): list.c $(UNZIP_H) $(WINDLL_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) list.c matchl$(OBJ): match.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) match.c processl$(OBJ): process.c $(UNZIP_H) $(WINDLL_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) process.c unreducl$(OBJ): unreduce.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) unreduce.c unshrnkl$(OBJ): unshrink.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) unshrink.c zipinfol$(OBJ): zipinfo.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) zipinfo.c win32l$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. win32/win32.c ntl$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. win32/nt.c windll$(OBJ): windll/windll.c $(UNZIP_H) $(WINDLL_H) crypt.h unzvers.h consts.h $(CC) $(CFLAGS) $(CVER) $(GENDLLFL) -I. windll/windll.c windllrc$(OBJ): windll/windll.rc unzvers.h - $(RC) -o $@ windll/windll.rc # SFX Lib compilation section apig$(OBJ): api.c $(UNZIP_H) $(WINDLL_H) unzvers.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) api.c crc32g$(OBJ): crc32.c $(UNZIP_H) zip.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) crc32.c crctabg$(OBJ): crctab.c $(UNZIP_H) zip.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) crctab.c cryptg$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) crypt.c extractg$(OBJ): extract.c $(UNZIP_H) $(WINDLL_H) crypt.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) extract.c fileiog$(OBJ): fileio.c $(UNZIP_H) $(WINDLL_H) crypt.h ttyio.h ebcdic.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) fileio.c globalsg$(OBJ): globals.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENGUILB) globals.c inflateg$(OBJ): inflate.c inflate.h $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENGUILB) inflate.c matchg$(OBJ): match.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENGUILB) match.c processg$(OBJ): process.c $(UNZIP_H) $(WINDLL_H) $(CC) $(CFLAGS) $(CVER) $(GENGUILB) process.c win32g$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) -I. win32/win32.c ntg$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) -I. win32/nt.c windllg$(OBJ): windll/windll.c $(UNZIP_H) $(WINDLL_H) crypt.h unzvers.h consts.h $(CC) $(CFLAGS) $(CVER) $(GENGUILB) windll/windll.c sfxwiz$(OBJ): windll/guisfx/sfxwiz.c windll/guisfx/dialog.h $(WINDLL_IMP_H) $(CC) $(CFLAGS) $(CVER) $(GENGUISX) -I. windll/guisfx/sfxwiz.c sfxwizrc$(OBJ): windll/guisfx/sfxwiz.rc - $(RC) --include-dir windll/guisfx --define WIN32 -o$@ \ windll/guisfx/sfxwiz.rc # Static LIB compilation section apib$(OBJ): api.c $(UNZIP_H) $(WINDLL_H) unzvers.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) api.c crc32b$(OBJ): crc32.c $(UNZIP_H) zip.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) crc32.c crctabb$(OBJ): crctab.c $(UNZIP_H) zip.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) crctab.c cryptb$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) crypt.c explodeb$(OBJ): explode.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) explode.c extractb$(OBJ): extract.c $(UNZIP_H) crypt.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) extract.c fileiob$(OBJ): fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) fileio.c globalsb$(OBJ): globals.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) globals.c inflateb$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) inflate.c listb$(OBJ): list.c $(UNZIP_H) $(WINDLL_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) list.c matchb$(OBJ): match.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) match.c processb$(OBJ): process.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) process.c unreducb$(OBJ): unreduce.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) unreduce.c unshrnkb$(OBJ): unshrink.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) unshrink.c zipinfob$(OBJ): zipinfo.c $(UNZIP_H) $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) zipinfo.c win32b$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. win32/win32.c ntb$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. win32/nt.c windllb$(OBJ): windll/windll.c $(UNZIP_H) $(WINDLL_H) crypt.h unzvers.h consts.h $(CC) $(CFLAGS) $(CVER) $(GENLIBFL) -I. windll/windll.c clean: $(RM) *$(OBJ) $(RM) *$(EXE)