diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:40 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:40 -0700 |
| commit | f6194ef39af5864f792412460c354cc339dde7d1 (patch) | |
| tree | 5ea1e6849128e9b2194c66ee3d82afa36b4ac07c /Makefile | |
| parent | 639be997883d9016baaf46017a2802b2ce1698bd (diff) | |
| download | zlib-1.2.3.4.tar.gz zlib-1.2.3.4.tar.bz2 zlib-1.2.3.4.zip | |
zlib 1.2.3.4v1.2.3.4
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 112 |
1 files changed, 68 insertions, 44 deletions
| @@ -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 | ||
| 27 | SFLAGS=-O | 27 | SFLAGS=-O |
| 28 | 28 | ||
| 29 | LDFLAGS=libz.a | 29 | LDFLAGS=-L. libz.a |
| 30 | LDSHARED=$(CC) | 30 | LDSHARED=$(CC) |
| 31 | CPP=$(CC) -E | 31 | CPP=$(CC) -E |
| 32 | 32 | ||
| 33 | LIBS=libz.a | 33 | STATICLIB=libz.a |
| 34 | SHAREDLIB=libz.so | 34 | SHAREDLIB=libz.so |
| 35 | SHAREDLIBV=libz.so.1.2.3.3 | 35 | SHAREDLIBV=libz.so.1.2.3.4 |
| 36 | SHAREDLIBM=libz.so.1 | 36 | SHAREDLIBM=libz.so.1 |
| 37 | LIBS=$(STATICLIB) $(SHAREDLIB) | ||
| 37 | 38 | ||
| 38 | AR=ar | 39 | AR=ar rc |
| 39 | RANLIB=ranlib | 40 | RANLIB=ranlib |
| 40 | TAR=tar | 41 | TAR=tar |
| 41 | SHELL=/bin/sh | 42 | SHELL=/bin/sh |
| @@ -52,22 +53,30 @@ pkgconfigdir = ${libdir}/pkgconfig | |||
| 52 | OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | 53 | OBJC = 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 | ||
| 56 | PIC_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 | ||
| 55 | OBJA = | 60 | OBJA = |
| 56 | # to use the asm code: make OBJA=match.o | 61 | PIC_OBJA = |
| 57 | 62 | ||
| 58 | OBJS = $(OBJC) $(OBJA) | 63 | OBJS = $(OBJC) $(OBJA) |
| 59 | 64 | ||
| 60 | PIC_OBJS = $(OBJS:%.o=%.lo) | 65 | PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) |
| 66 | |||
| 67 | all: static shared | ||
| 61 | 68 | ||
| 62 | TEST_OBJS = example.o minigzip.o | 69 | static: example$(EXE) minigzip$(EXE) |
| 63 | 70 | ||
| 64 | allstatic: example$(EXE) minigzip$(EXE) | 71 | shared: examplesh$(EXE) minigzipsh$(EXE) |
| 65 | 72 | ||
| 66 | allshared: examplesh$(EXE) minigzipsh$(EXE) | 73 | all64: example64$(EXE) minigzip64$(EXE) |
| 74 | |||
| 75 | check: test | ||
| 67 | 76 | ||
| 68 | all: allstatic allshared | 77 | test: all teststatic testshared |
| 69 | 78 | ||
| 70 | teststatic: allstatic | 79 | teststatic: 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 | ||
| 79 | testshared: allshared | 88 | testshared: 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 | ||
| 91 | test: teststatic testshared | 101 | test64: all64 |
| 92 | 102 | @echo hello world | ./minigzip64 | ./minigzip64 -d || \ | |
| 93 | check: 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 | ||
| 95 | libz.a: $(OBJS) | 110 | libz.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 | 126 | example64.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 | |||
| 129 | minigzip64.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 | ||
| 120 | example$(EXE): example.o $(LIBS) | 146 | example$(EXE): example.o $(STATICLIB) |
| 121 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) | 147 | $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) |
| 122 | 148 | ||
| 123 | minigzip$(EXE): minigzip.o $(LIBS) | 149 | minigzip$(EXE): minigzip.o $(STATICLIB) |
| 124 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 150 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
| 125 | 151 | ||
| 126 | examplesh$(EXE): example.o $(LIBS) | 152 | examplesh$(EXE): example.o $(SHAREDLIBV) |
| 127 | $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB) | 153 | $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) |
| 154 | |||
| 155 | minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) | ||
| 156 | $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) | ||
| 157 | |||
| 158 | example64$(EXE): example64.o $(STATICLIB) | ||
| 159 | $(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS) | ||
| 128 | 160 | ||
| 129 | minigzipsh$(EXE): minigzip.o $(LIBS) | 161 | minigzip64$(EXE): minigzip64.o $(STATICLIB) |
| 130 | $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB) | 162 | $(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS) |
| 131 | 163 | ||
| 132 | install-libs: $(LIBS) | 164 | install-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 | |||
| 168 | clean: | 200 | clean: |
| 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 | ||
| 174 | maintainer-clean: distclean | 208 | maintainer-clean: distclean |
| 175 | distclean: clean | 209 | distclean: 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 | ||
| 189 | adler32.o: zlib.h zconf.h zlibdefs.h | 223 | adler32.o gzio.o zutil.o: zutil.h zlib.h zconf.h zlibdefs.h |
| 190 | compress.o: zlib.h zconf.h zlibdefs.h | 224 | compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h zlibdefs.h |
| 191 | crc32.o: crc32.h zlib.h zconf.h zlibdefs.h | 225 | crc32.o: zutil.h zlib.h zconf.h zlibdefs.h crc32.h |
| 192 | deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h | 226 | deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h |
| 193 | example.o: zlib.h zconf.h zlibdefs.h | 227 | infback.o inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
| 194 | gzio.o: zutil.h zlib.h zconf.h zlibdefs.h | ||
| 195 | inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h | 228 | inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h |
| 196 | inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | ||
| 197 | infback.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | ||
| 198 | inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h | 229 | inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h |
| 199 | minigzip.o: zlib.h zconf.h zlibdefs.h | ||
| 200 | trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h | 230 | trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h |
| 201 | uncompr.o: zlib.h zconf.h zlibdefs.h | ||
| 202 | zutil.o: zutil.h zlib.h zconf.h zlibdefs.h | ||
| 203 | 231 | ||
| 204 | adler32.lo: zlib.h zconf.h zlibdefs.h | 232 | adler32.lo gzio.lo zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h |
| 205 | compress.lo: zlib.h zconf.h zlibdefs.h | 233 | compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h zlibdefs.h |
| 206 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h | 234 | crc32.lo: zutil.h zlib.h zconf.h zlibdefs.h crc32.h |
| 207 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h | 235 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h |
| 208 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h | 236 | infback.lo inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
| 209 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h | 237 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h |
| 210 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | ||
| 211 | infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | ||
| 212 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h | 238 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h |
| 213 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h | 239 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h |
| 214 | uncompr.lo: zlib.h zconf.h zlibdefs.h | ||
| 215 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h | ||
