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.
7 # Copyright (C) 1995-2003 Jean-loup Gailly.
8 # For conditions of distribution and use, see copyright notice in zlib.h
10 # To compile, or to compile and test, type:
12 # make -fmakefile.gcc; make test testdll -fmakefile.gcc
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
18 # To install libz.a, zconf.h and zlib.h in the system directories, type:
20 # make install -fmakefile.gcc
23 # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
24 # the DLL name should be changed from "zlib1.dll".
31 # Set to 1 if shared object needs to be installed
40 CFLAGS = $(LOC) -O3 -Wall
43 ASFLAGS = $(LOC) -Wall
52 RCFLAGS = --define GCC_WINDRES
54 STRIP = $(PREFIX)strip
57 # If GNU install is available, replace $(CP) with install.
62 exec_prefix = $(prefix)
64 OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
65 gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
68 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
70 test: example.exe minigzip.exe
72 echo hello world | ./minigzip | ./minigzip -d
74 testdll: example_d.exe minigzip_d.exe
76 echo hello world | ./minigzip_d | ./minigzip_d -d
79 $(CC) $(CFLAGS) -c -o $@ $<
82 $(AS) $(ASFLAGS) -c -o $@ $<
84 $(STATICLIB): $(OBJS) $(OBJA)
85 $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
87 $(IMPLIB): $(SHAREDLIB)
89 $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
90 $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
91 -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
94 example.exe: example.o $(STATICLIB)
95 $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
98 minigzip.exe: minigzip.o $(STATICLIB)
99 $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
102 example_d.exe: example.o $(IMPLIB)
103 $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
106 minigzip_d.exe: minigzip.o $(IMPLIB)
107 $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
110 zlibrc.o: win32/zlib1.rc
111 $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
114 # BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
116 .PHONY: install uninstall clean
118 install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
119 -@mkdir -p $(INCLUDE_PATH)
120 -@mkdir -p $(LIBRARY_PATH)
121 -if [ "$(SHARED_MODE)" = "1" ]; then \
122 mkdir -p $(BINARY_PATH); \
123 $(INSTALL) $(SHAREDLIB) $(BINARY_PATH); \
124 $(INSTALL) $(IMPLIB) $(LIBRARY_PATH); \
126 -$(INSTALL) zlib.h $(INCLUDE_PATH)
127 -$(INSTALL) zconf.h $(INCLUDE_PATH)
128 -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
131 -if [ "$(SHARED_MODE)" = "1" ]; then \
132 $(RM) $(BINARY_PATH)/$(SHAREDLIB); \
133 $(RM) $(LIBRARY_PATH)/$(IMPLIB); \
135 -$(RM) $(INCLUDE_PATH)/zlib.h
136 -$(RM) $(INCLUDE_PATH)/zconf.h
137 -$(RM) $(LIBRARY_PATH)/$(STATICLIB)
147 adler32.o: zlib.h zconf.h
148 compress.o: zlib.h zconf.h
149 crc32.o: crc32.h zlib.h zconf.h
150 deflate.o: deflate.h zutil.h zlib.h zconf.h
151 example.o: zlib.h zconf.h
152 gzclose.o: zlib.h zconf.h gzguts.h
153 gzlib.o: zlib.h zconf.h gzguts.h
154 gzread.o: zlib.h zconf.h gzguts.h
155 gzwrite.o: zlib.h zconf.h gzguts.h
156 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
157 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
158 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
159 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
160 minigzip.o: zlib.h zconf.h
161 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
162 uncompr.o: zlib.h zconf.h
163 zutil.o: zutil.h zlib.h zconf.h