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: Mar 2012.
|
---|
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 from the top level zlib directory:
|
---|
11 | #
|
---|
12 | # make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.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 -fwin32/Makefile.gcc
|
---|
17 | #
|
---|
18 | # To install libz.a, zconf.h and zlib.h in the system directories, type:
|
---|
19 | #
|
---|
20 | # make install -fwin32/Makefile.gcc
|
---|
21 | #
|
---|
22 | # BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
|
---|
23 | #
|
---|
24 | # To install the shared lib, append SHARED_MODE=1 to the make command :
|
---|
25 | #
|
---|
26 | # make install -fwin32/Makefile.gcc SHARED_MODE=1
|
---|
27 |
|
---|
28 | # Note:
|
---|
29 | # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
|
---|
30 | # the DLL name should be changed from "zlib1.dll".
|
---|
31 |
|
---|
32 | STATICLIB = libz.a
|
---|
33 | SHAREDLIB = zlib1.dll
|
---|
34 | IMPLIB = libz.dll.a
|
---|
35 |
|
---|
36 | #
|
---|
37 | # Set to 1 if shared object needs to be installed
|
---|
38 | #
|
---|
39 | SHARED_MODE=0
|
---|
40 |
|
---|
41 | #LOC = -DASMV
|
---|
42 | #LOC = -DZLIB_DEBUG -g
|
---|
43 |
|
---|
44 | PREFIX =
|
---|
45 | CC = $(PREFIX)gcc
|
---|
46 | CFLAGS = $(LOC) -O3 -Wall
|
---|
47 |
|
---|
48 | AS = $(CC)
|
---|
49 | ASFLAGS = $(LOC) -Wall
|
---|
50 |
|
---|
51 | LD = $(CC)
|
---|
52 | LDFLAGS = $(LOC)
|
---|
53 |
|
---|
54 | AR = $(PREFIX)ar
|
---|
55 | ARFLAGS = rcs
|
---|
56 |
|
---|
57 | RC = $(PREFIX)windres
|
---|
58 | RCFLAGS = --define GCC_WINDRES
|
---|
59 |
|
---|
60 | STRIP = $(PREFIX)strip
|
---|
61 |
|
---|
62 | CP = cp -fp
|
---|
63 | # If GNU install is available, replace $(CP) with install.
|
---|
64 | INSTALL = $(CP)
|
---|
65 | RM = rm -f
|
---|
66 |
|
---|
67 | prefix ?= /usr/local
|
---|
68 | exec_prefix = $(prefix)
|
---|
69 |
|
---|
70 | OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
|
---|
71 | gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
|
---|
72 | OBJA =
|
---|
73 |
|
---|
74 | all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
|
---|
75 |
|
---|
76 | test: example.exe minigzip.exe
|
---|
77 | ./example
|
---|
78 | echo hello world | ./minigzip | ./minigzip -d
|
---|
79 |
|
---|
80 | testdll: example_d.exe minigzip_d.exe
|
---|
81 | ./example_d
|
---|
82 | echo hello world | ./minigzip_d | ./minigzip_d -d
|
---|
83 |
|
---|
84 | .c.o:
|
---|
85 | $(CC) $(CFLAGS) -c -o $@ $<
|
---|
86 |
|
---|
87 | .S.o:
|
---|
88 | $(AS) $(ASFLAGS) -c -o $@ $<
|
---|
89 |
|
---|
90 | $(STATICLIB): $(OBJS) $(OBJA)
|
---|
91 | $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
|
---|
92 |
|
---|
93 | $(IMPLIB): $(SHAREDLIB)
|
---|
94 |
|
---|
95 | $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
|
---|
96 | $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
|
---|
97 | -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
|
---|
98 | $(STRIP) $@
|
---|
99 |
|
---|
100 | example.exe: example.o $(STATICLIB)
|
---|
101 | $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
|
---|
102 | $(STRIP) $@
|
---|
103 |
|
---|
104 | minigzip.exe: minigzip.o $(STATICLIB)
|
---|
105 | $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
|
---|
106 | $(STRIP) $@
|
---|
107 |
|
---|
108 | example_d.exe: example.o $(IMPLIB)
|
---|
109 | $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
|
---|
110 | $(STRIP) $@
|
---|
111 |
|
---|
112 | minigzip_d.exe: minigzip.o $(IMPLIB)
|
---|
113 | $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
|
---|
114 | $(STRIP) $@
|
---|
115 |
|
---|
116 | example.o: test/example.c zlib.h zconf.h
|
---|
117 | $(CC) $(CFLAGS) -I. -c -o $@ test/example.c
|
---|
118 |
|
---|
119 | minigzip.o: test/minigzip.c zlib.h zconf.h
|
---|
120 | $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
|
---|
121 |
|
---|
122 | zlibrc.o: win32/zlib1.rc
|
---|
123 | $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
|
---|
124 |
|
---|
125 | .PHONY: install uninstall clean
|
---|
126 |
|
---|
127 | install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
|
---|
128 | @if test -z "$(DESTDIR)$(INCLUDE_PATH)" -o -z "$(DESTDIR)$(LIBRARY_PATH)" -o -z "$(DESTDIR)$(BINARY_PATH)"; then \
|
---|
129 | echo INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH must be specified; \
|
---|
130 | exit 1; \
|
---|
131 | fi
|
---|
132 | -@mkdir -p '$(DESTDIR)$(INCLUDE_PATH)'
|
---|
133 | -@mkdir -p '$(DESTDIR)$(LIBRARY_PATH)' '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig
|
---|
134 | -if [ "$(SHARED_MODE)" = "1" ]; then \
|
---|
135 | mkdir -p '$(DESTDIR)$(BINARY_PATH)'; \
|
---|
136 | $(INSTALL) $(SHAREDLIB) '$(DESTDIR)$(BINARY_PATH)'; \
|
---|
137 | $(INSTALL) $(IMPLIB) '$(DESTDIR)$(LIBRARY_PATH)'; \
|
---|
138 | fi
|
---|
139 | -$(INSTALL) zlib.h '$(DESTDIR)$(INCLUDE_PATH)'
|
---|
140 | -$(INSTALL) zconf.h '$(DESTDIR)$(INCLUDE_PATH)'
|
---|
141 | -$(INSTALL) $(STATICLIB) '$(DESTDIR)$(LIBRARY_PATH)'
|
---|
142 | sed \
|
---|
143 | -e 's|@prefix@|${prefix}|g' \
|
---|
144 | -e 's|@exec_prefix@|${exec_prefix}|g' \
|
---|
145 | -e 's|@libdir@|$(LIBRARY_PATH)|g' \
|
---|
146 | -e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \
|
---|
147 | -e 's|@includedir@|$(INCLUDE_PATH)|g' \
|
---|
148 | -e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
|
---|
149 | zlib.pc.in > '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig/zlib.pc
|
---|
150 |
|
---|
151 | uninstall:
|
---|
152 | -if [ "$(SHARED_MODE)" = "1" ]; then \
|
---|
153 | $(RM) '$(DESTDIR)$(BINARY_PATH)'/$(SHAREDLIB); \
|
---|
154 | $(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(IMPLIB); \
|
---|
155 | fi
|
---|
156 | -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zlib.h
|
---|
157 | -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zconf.h
|
---|
158 | -$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(STATICLIB)
|
---|
159 |
|
---|
160 | clean:
|
---|
161 | -$(RM) $(STATICLIB)
|
---|
162 | -$(RM) $(SHAREDLIB)
|
---|
163 | -$(RM) $(IMPLIB)
|
---|
164 | -$(RM) *.o
|
---|
165 | -$(RM) *.exe
|
---|
166 | -$(RM) foo.gz
|
---|
167 |
|
---|
168 | adler32.o: zlib.h zconf.h
|
---|
169 | compress.o: zlib.h zconf.h
|
---|
170 | crc32.o: crc32.h zlib.h zconf.h
|
---|
171 | deflate.o: deflate.h zutil.h zlib.h zconf.h
|
---|
172 | gzclose.o: zlib.h zconf.h gzguts.h
|
---|
173 | gzlib.o: zlib.h zconf.h gzguts.h
|
---|
174 | gzread.o: zlib.h zconf.h gzguts.h
|
---|
175 | gzwrite.o: zlib.h zconf.h gzguts.h
|
---|
176 | inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
---|
177 | inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
---|
178 | infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
---|
179 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h
|
---|
180 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
|
---|
181 | uncompr.o: zlib.h zconf.h
|
---|
182 | zutil.o: zutil.h zlib.h zconf.h
|
---|