diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 41 |
1 files changed, 32 insertions, 9 deletions
@@ -32,7 +32,7 @@ CPP=$(CC) -E | |||
32 | 32 | ||
33 | LIBS=libz.a | 33 | LIBS=libz.a |
34 | SHAREDLIB=libz.so | 34 | SHAREDLIB=libz.so |
35 | SHAREDLIBV=libz.so.1.2.3.2 | 35 | SHAREDLIBV=libz.so.1.2.3.3 |
36 | SHAREDLIBM=libz.so.1 | 36 | SHAREDLIBM=libz.so.1 |
37 | 37 | ||
38 | AR=ar | 38 | AR=ar |
@@ -61,12 +61,14 @@ PIC_OBJS = $(OBJS:%.o=%.lo) | |||
61 | 61 | ||
62 | TEST_OBJS = example.o minigzip.o | 62 | TEST_OBJS = example.o minigzip.o |
63 | 63 | ||
64 | all: example$(EXE) minigzip$(EXE) | 64 | allstatic: example$(EXE) minigzip$(EXE) |
65 | 65 | ||
66 | check: test | 66 | allshared: examplesh$(EXE) minigzipsh$(EXE) |
67 | test: all | 67 | |
68 | @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | 68 | all: allstatic allshared |
69 | echo hello world | ./minigzip | ./minigzip -d || \ | 69 | |
70 | teststatic: allstatic | ||
71 | @echo hello world | ./minigzip | ./minigzip -d || \ | ||
70 | echo ' *** minigzip test FAILED ***' ; \ | 72 | echo ' *** minigzip test FAILED ***' ; \ |
71 | if ./example; then \ | 73 | if ./example; then \ |
72 | echo ' *** zlib test OK ***'; \ | 74 | echo ' *** zlib test OK ***'; \ |
@@ -74,6 +76,22 @@ test: all | |||
74 | echo ' *** zlib test FAILED ***'; \ | 76 | echo ' *** zlib test FAILED ***'; \ |
75 | fi | 77 | fi |
76 | 78 | ||
79 | testshared: allshared | ||
80 | @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||
81 | DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ | ||
82 | SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ | ||
83 | echo hello world | ./minigzipsh | ./minigzipsh -d || \ | ||
84 | echo ' *** minigzip shared test FAILED ***' ; \ | ||
85 | if ./examplesh; then \ | ||
86 | echo ' *** zlib shared test OK ***'; \ | ||
87 | else \ | ||
88 | echo ' *** zlib shared test FAILED ***'; \ | ||
89 | fi | ||
90 | |||
91 | test: teststatic testshared | ||
92 | |||
93 | check: test | ||
94 | |||
77 | libz.a: $(OBJS) | 95 | libz.a: $(OBJS) |
78 | $(AR) $@ $(OBJS) | 96 | $(AR) $@ $(OBJS) |
79 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | 97 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 |
@@ -105,6 +123,12 @@ example$(EXE): example.o $(LIBS) | |||
105 | minigzip$(EXE): minigzip.o $(LIBS) | 123 | minigzip$(EXE): minigzip.o $(LIBS) |
106 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 124 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
107 | 125 | ||
126 | examplesh$(EXE): example.o $(LIBS) | ||
127 | $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB) | ||
128 | |||
129 | minigzipsh$(EXE): minigzip.o $(LIBS) | ||
130 | $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB) | ||
131 | |||
108 | install-libs: $(LIBS) | 132 | install-libs: $(LIBS) |
109 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi | 133 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi |
110 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi | 134 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi |
@@ -142,7 +166,8 @@ uninstall: | |||
142 | 166 | ||
143 | mostlyclean: clean | 167 | mostlyclean: clean |
144 | clean: | 168 | clean: |
145 | rm -f *.o *.lo *~ example$(EXE) minigzip$(EXE) \ | 169 | rm -f *.o *.lo *~ \ |
170 | example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ | ||
146 | libz.* foo.gz so_locations \ | 171 | libz.* foo.gz so_locations \ |
147 | _match.s maketree contrib/infback9/*.o | 172 | _match.s maketree contrib/infback9/*.o |
148 | 173 | ||
@@ -180,13 +205,11 @@ adler32.lo: zlib.h zconf.h zlibdefs.h | |||
180 | compress.lo: zlib.h zconf.h zlibdefs.h | 205 | compress.lo: zlib.h zconf.h zlibdefs.h |
181 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h | 206 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h |
182 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h | 207 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h |
183 | example.lo: zlib.h zconf.h zlibdefs.h | ||
184 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h | 208 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h |
185 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h | 209 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h |
186 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | 210 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
187 | infback.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 |
188 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h | 212 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h |
189 | minigzip.lo: zlib.h zconf.h zlibdefs.h | ||
190 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h | 213 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h |
191 | uncompr.lo: zlib.h zconf.h zlibdefs.h | 214 | uncompr.lo: zlib.h zconf.h zlibdefs.h |
192 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h | 215 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h |