1 # Makefile for zlib, derived from Makefile.dj2. 2 # Modified for mingw32 by C. Spieler, 6/16/98. 3 # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. 4 # Last updated: 1-Aug-2003. 5 # Tested under Cygwin and MinGW. 6 7 # Copyright (C) 1995-2003 Jean-loup Gailly. 8 # For conditions of distribution and use, see copyright notice in zlib.h 9 10 # To compile, or to compile and test, type: 11 # 12 # make -fmakefile.gcc; make test testdll -fmakefile.gcc 13 # 14 # To use the asm code, type: 15 # cp contrib/asm?86/match.S ./match.S 16 # make LOC=-DASMV OBJA=match.o -fmakefile.gcc 17 # 18 # To install libz.a, zconf.h and zlib.h in the system directories, type: 19 # 20 # make install -fmakefile.gcc 21 22 # Note: 23 # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), 24 # the DLL name should be changed from "zlib1.dll". 25 26 STATICLIB = libz.a 27 SHAREDLIB = zlib1.dll 28 IMPLIB = libzdll.a 29 30 # 31 # Set to 1 if shared object needs to be installed 32 # 33 SHARED_MODE=0 34 35 #LOC = -DASMV 36 #LOC = -DDEBUG -g 37 38 PREFIX = 39 CC = $(PREFIX)gcc 40 CFLAGS = $(LOC) -O3 -Wall 41 EXTRA_CFLAGS = -DNO_VIZ 42 43 AS = $(CC) 44 ASFLAGS = $(LOC) -Wall 45 46 LD = $(CC) 47 LDFLAGS = $(LOC) 48 49 AR = $(PREFIX)ar 50 ARFLAGS = rcs 51 52 RC = $(PREFIX)windres 53 RCFLAGS = --define GCC_WINDRES 54 55 STRIP = $(PREFIX)strip 56 57 CP = cp -fp 58 # If GNU install is available, replace $(CP) with install. 59 INSTALL = $(CP) 60 RM = rm -f 61 62 prefix = /usr/local 63 exec_prefix = $(prefix) 64 65 OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ 66 gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o 67 OBJA = 68 69 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe 70 71 test: example.exe minigzip.exe 72 ./example 73 echo hello world | ./minigzip | ./minigzip -d 74 75 testdll: example_d.exe minigzip_d.exe 76 ./example_d 77 echo hello world | ./minigzip_d | ./minigzip_d -d 78 79 .c.o: 80 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< 81 82 .S.o: 83 $(AS) $(ASFLAGS) -c -o $@ $< 84 85 $(STATICLIB): $(OBJS) $(OBJA) 86 $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) 87 88 $(IMPLIB): $(SHAREDLIB) 89 90 $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o 91 $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \ 92 -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o 93 $(STRIP) $@ 94 95 example.exe: example.o $(STATICLIB) 96 $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) 97 $(STRIP) $@ 98 99 minigzip.exe: minigzip.o $(STATICLIB) 100 $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) 101 $(STRIP) $@ 102 103 example_d.exe: example.o $(IMPLIB) 104 $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) 105 $(STRIP) $@ 106 107 minigzip_d.exe: minigzip.o $(IMPLIB) 108 $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) 109 $(STRIP) $@ 110 111 zlibrc.o: win32/zlib1.rc 112 $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc 113 114 115 # BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set. 116 117 .PHONY: install uninstall clean 118 119 install: zlib.h zconf.h $(STATICLIB) $(IMPLIB) 120 -@mkdir -p $(INCLUDE_PATH) 121 -@mkdir -p $(LIBRARY_PATH) 122 -if [ "$(SHARED_MODE)" = "1" ]; then \ 123 mkdir -p $(BINARY_PATH); \ 124 $(INSTALL) $(SHAREDLIB) $(BINARY_PATH); \ 125 $(INSTALL) $(IMPLIB) $(LIBRARY_PATH); \ 126 fi 127 -$(INSTALL) zlib.h $(INCLUDE_PATH) 128 -$(INSTALL) zconf.h $(INCLUDE_PATH) 129 -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH) 130 131 uninstall: 132 -if [ "$(SHARED_MODE)" = "1" ]; then \ 133 $(RM) $(BINARY_PATH)/$(SHAREDLIB); \ 134 $(RM) $(LIBRARY_PATH)/$(IMPLIB); \ 135 fi 136 -$(RM) $(INCLUDE_PATH)/zlib.h 137 -$(RM) $(INCLUDE_PATH)/zconf.h 138 -$(RM) $(LIBRARY_PATH)/$(STATICLIB) 139 140 clean: 141 -$(RM) $(STATICLIB) 142 -$(RM) $(SHAREDLIB) 143 -$(RM) $(IMPLIB) 144 -$(RM) *.o 145 -$(RM) *.exe 146 -$(RM) foo.gz 147 148 adler32.o: zlib.h zconf.h 149 compress.o: zlib.h zconf.h 150 crc32.o: crc32.h zlib.h zconf.h 151 deflate.o: deflate.h zutil.h zlib.h zconf.h 152 example.o: zlib.h zconf.h 153 gzclose.o: zlib.h zconf.h gzguts.h 154 gzlib.o: zlib.h zconf.h gzguts.h 155 gzread.o: zlib.h zconf.h gzguts.h 156 gzwrite.o: zlib.h zconf.h gzguts.h 157 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 158 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 159 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 160 inftrees.o: zutil.h zlib.h zconf.h inftrees.h 161 minigzip.o: zlib.h zconf.h 162 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h 163 uncompr.o: zlib.h zconf.h 164 zutil.o: zutil.h zlib.h zconf.h 165