summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile112
1 files changed, 68 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index 2fa2e25..6ad7a5c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,8 @@
4 4
5# To compile and test, type: 5# To compile and test, type:
6# ./configure; make test 6# ./configure; make test
7# The call of configure is optional if you don't have special requirements 7# Normally configure builds both a static and a shared library.
8# If you wish to build zlib as a shared library, use: ./configure -s 8# If you want to build just a static library, use: ./configure --static
9 9
10# To use the asm code, type: 10# To use the asm code, type:
11# cp contrib/asm?86/match.S ./match.S 11# cp contrib/asm?86/match.S ./match.S
@@ -26,16 +26,17 @@ CFLAGS=-O
26 26
27SFLAGS=-O 27SFLAGS=-O
28 28
29LDFLAGS=libz.a 29LDFLAGS=-L. libz.a
30LDSHARED=$(CC) 30LDSHARED=$(CC)
31CPP=$(CC) -E 31CPP=$(CC) -E
32 32
33LIBS=libz.a 33STATICLIB=libz.a
34SHAREDLIB=libz.so 34SHAREDLIB=libz.so
35SHAREDLIBV=libz.so.1.2.3.3 35SHAREDLIBV=libz.so.1.2.3.4
36SHAREDLIBM=libz.so.1 36SHAREDLIBM=libz.so.1
37LIBS=$(STATICLIB) $(SHAREDLIB)
37 38
38AR=ar 39AR=ar rc
39RANLIB=ranlib 40RANLIB=ranlib
40TAR=tar 41TAR=tar
41SHELL=/bin/sh 42SHELL=/bin/sh
@@ -52,22 +53,30 @@ pkgconfigdir = ${libdir}/pkgconfig
52OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 53OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
53 zutil.o inflate.o infback.o inftrees.o inffast.o 54 zutil.o inflate.o infback.o inftrees.o inffast.o
54 55
56PIC_OBJC = adler32.lo compress.lo crc32.lo gzio.lo uncompr.lo deflate.lo trees.lo \
57 zutil.lo inflate.lo infback.lo inftrees.lo inffast.lo
58
59# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
55OBJA = 60OBJA =
56# to use the asm code: make OBJA=match.o 61PIC_OBJA =
57 62
58OBJS = $(OBJC) $(OBJA) 63OBJS = $(OBJC) $(OBJA)
59 64
60PIC_OBJS = $(OBJS:%.o=%.lo) 65PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
66
67all: static shared
61 68
62TEST_OBJS = example.o minigzip.o 69static: example$(EXE) minigzip$(EXE)
63 70
64allstatic: example$(EXE) minigzip$(EXE) 71shared: examplesh$(EXE) minigzipsh$(EXE)
65 72
66allshared: examplesh$(EXE) minigzipsh$(EXE) 73all64: example64$(EXE) minigzip64$(EXE)
74
75check: test
67 76
68all: allstatic allshared 77test: all teststatic testshared
69 78
70teststatic: allstatic 79teststatic: static
71 @echo hello world | ./minigzip | ./minigzip -d || \ 80 @echo hello world | ./minigzip | ./minigzip -d || \
72 echo ' *** minigzip test FAILED ***' ; \ 81 echo ' *** minigzip test FAILED ***' ; \
73 if ./example; then \ 82 if ./example; then \
@@ -76,8 +85,9 @@ teststatic: allstatic
76 echo ' *** zlib test FAILED ***'; \ 85 echo ' *** zlib test FAILED ***'; \
77 fi 86 fi
78 87
79testshared: allshared 88testshared: shared
80 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ 89 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
90 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
81 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ 91 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
82 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ 92 SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
83 echo hello world | ./minigzipsh | ./minigzipsh -d || \ 93 echo hello world | ./minigzipsh | ./minigzipsh -d || \
@@ -88,9 +98,14 @@ testshared: allshared
88 echo ' *** zlib shared test FAILED ***'; \ 98 echo ' *** zlib shared test FAILED ***'; \
89 fi 99 fi
90 100
91test: teststatic testshared 101test64: all64
92 102 @echo hello world | ./minigzip64 | ./minigzip64 -d || \
93check: test 103 echo ' *** minigzip 64-bit test FAILED ***' ; \
104 if ./example64; then \
105 echo ' *** zlib 64-bit test OK ***'; \
106 else \
107 echo ' *** zlib 64-bit test FAILED ***'; \
108 fi
94 109
95libz.a: $(OBJS) 110libz.a: $(OBJS)
96 $(AR) $@ $(OBJS) 111 $(AR) $@ $(OBJS)
@@ -108,26 +123,43 @@ match.lo: match.S
108 mv _match.o match.lo 123 mv _match.o match.lo
109 rm -f _match.s 124 rm -f _match.s
110 125
111%.lo: %.c 126example64.o: example.c zlib.h zconf.h zlibdefs.h
112 $(CC) $(SFLAGS) -DPIC -c $< -o $@ 127 $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ $<
128
129minigzip64.o: minigzip.c zlib.h zconf.h zlibdefs.h
130 $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ $<
131
132.SUFFIXES: .lo
133
134.c.lo:
135 -@if [ ! -d objs ]; then mkdir objs; fi
136 $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
137 -@mv objs/$*.o $@
113 138
114$(SHAREDLIBV): $(PIC_OBJS) 139$(SHAREDLIBV): $(PIC_OBJS)
115 $(LDSHARED) -o $@ $(PIC_OBJS) -lc 140 $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) -lc
116 rm -f $(SHAREDLIB) $(SHAREDLIBM) 141 rm -f $(SHAREDLIB) $(SHAREDLIBM)
117 ln -s $@ $(SHAREDLIB) 142 ln -s $@ $(SHAREDLIB)
118 ln -s $@ $(SHAREDLIBM) 143 ln -s $@ $(SHAREDLIBM)
144 -@rmdir objs
119 145
120example$(EXE): example.o $(LIBS) 146example$(EXE): example.o $(STATICLIB)
121 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) 147 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
122 148
123minigzip$(EXE): minigzip.o $(LIBS) 149minigzip$(EXE): minigzip.o $(STATICLIB)
124 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 150 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
125 151
126examplesh$(EXE): example.o $(LIBS) 152examplesh$(EXE): example.o $(SHAREDLIBV)
127 $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB) 153 $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
154
155minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
156 $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
157
158example64$(EXE): example64.o $(STATICLIB)
159 $(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS)
128 160
129minigzipsh$(EXE): minigzip.o $(LIBS) 161minigzip64$(EXE): minigzip64.o $(STATICLIB)
130 $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB) 162 $(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS)
131 163
132install-libs: $(LIBS) 164install-libs: $(LIBS)
133 -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi 165 -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
@@ -168,8 +200,10 @@ mostlyclean: clean
168clean: 200clean:
169 rm -f *.o *.lo *~ \ 201 rm -f *.o *.lo *~ \
170 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ 202 example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
203 example64$(EXE) minigzip64$(EXE) \
171 libz.* foo.gz so_locations \ 204 libz.* foo.gz so_locations \
172 _match.s maketree contrib/infback9/*.o 205 _match.s maketree contrib/infback9/*.o
206 rm -rf objs
173 207
174maintainer-clean: distclean 208maintainer-clean: distclean
175distclean: clean 209distclean: clean
@@ -186,30 +220,20 @@ depend:
186 220
187# DO NOT DELETE THIS LINE -- make depend depends on it. 221# DO NOT DELETE THIS LINE -- make depend depends on it.
188 222
189adler32.o: zlib.h zconf.h zlibdefs.h 223adler32.o gzio.o zutil.o: zutil.h zlib.h zconf.h zlibdefs.h
190compress.o: zlib.h zconf.h zlibdefs.h 224compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h zlibdefs.h
191crc32.o: crc32.h zlib.h zconf.h zlibdefs.h 225crc32.o: zutil.h zlib.h zconf.h zlibdefs.h crc32.h
192deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h 226deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
193example.o: zlib.h zconf.h zlibdefs.h 227infback.o inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
194gzio.o: zutil.h zlib.h zconf.h zlibdefs.h
195inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h 228inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
196inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
197infback.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
198inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h 229inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
199minigzip.o: zlib.h zconf.h zlibdefs.h
200trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h 230trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
201uncompr.o: zlib.h zconf.h zlibdefs.h
202zutil.o: zutil.h zlib.h zconf.h zlibdefs.h
203 231
204adler32.lo: zlib.h zconf.h zlibdefs.h 232adler32.lo gzio.lo zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h
205compress.lo: zlib.h zconf.h zlibdefs.h 233compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h zlibdefs.h
206crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h 234crc32.lo: zutil.h zlib.h zconf.h zlibdefs.h crc32.h
207deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h 235deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
208gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h 236infback.lo inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
209inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h 237inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
210inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
211infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
212inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h 238inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
213trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h 239trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
214uncompr.lo: zlib.h zconf.h zlibdefs.h
215zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h