diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 87 |
1 files changed, 60 insertions, 27 deletions
@@ -24,13 +24,15 @@ CFLAGS=-O | |||
24 | #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | 24 | #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ |
25 | # -Wstrict-prototypes -Wmissing-prototypes | 25 | # -Wstrict-prototypes -Wmissing-prototypes |
26 | 26 | ||
27 | SFLAGS=-O | ||
28 | |||
27 | LDFLAGS=libz.a | 29 | LDFLAGS=libz.a |
28 | LDSHARED=$(CC) | 30 | LDSHARED=$(CC) |
29 | CPP=$(CC) -E | 31 | CPP=$(CC) -E |
30 | 32 | ||
31 | LIBS=libz.a | 33 | LIBS=libz.a |
32 | SHAREDLIB=libz.so | 34 | SHAREDLIB=libz.so |
33 | SHAREDLIBV=libz.so.1.2.3.1 | 35 | SHAREDLIBV=libz.so.1.2.3.2 |
34 | SHAREDLIBM=libz.so.1 | 36 | SHAREDLIBM=libz.so.1 |
35 | 37 | ||
36 | AR=ar | 38 | AR=ar |
@@ -47,12 +49,16 @@ mandir = ${prefix}/share/man | |||
47 | man3dir = ${mandir}/man3 | 49 | man3dir = ${mandir}/man3 |
48 | pkgconfigdir = ${libdir}/pkgconfig | 50 | pkgconfigdir = ${libdir}/pkgconfig |
49 | 51 | ||
50 | OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | 52 | OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ |
51 | zutil.o inflate.o infback.o inftrees.o inffast.o | 53 | zutil.o inflate.o infback.o inftrees.o inffast.o |
52 | 54 | ||
53 | OBJA = | 55 | OBJA = |
54 | # to use the asm code: make OBJA=match.o | 56 | # to use the asm code: make OBJA=match.o |
55 | 57 | ||
58 | OBJS = $(OBJC) $(OBJA) | ||
59 | |||
60 | PIC_OBJS = $(OBJS:%.o=%.lo) | ||
61 | |||
56 | TEST_OBJS = example.o minigzip.o | 62 | TEST_OBJS = example.o minigzip.o |
57 | 63 | ||
58 | all: example$(EXE) minigzip$(EXE) | 64 | all: example$(EXE) minigzip$(EXE) |
@@ -68,8 +74,8 @@ test: all | |||
68 | echo ' *** zlib test FAILED ***'; \ | 74 | echo ' *** zlib test FAILED ***'; \ |
69 | fi | 75 | fi |
70 | 76 | ||
71 | libz.a: $(OBJS) $(OBJA) | 77 | libz.a: $(OBJS) |
72 | $(AR) $@ $(OBJS) $(OBJA) | 78 | $(AR) $@ $(OBJS) |
73 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | 79 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 |
74 | 80 | ||
75 | match.o: match.S | 81 | match.o: match.S |
@@ -78,8 +84,17 @@ match.o: match.S | |||
78 | mv _match.o match.o | 84 | mv _match.o match.o |
79 | rm -f _match.s | 85 | rm -f _match.s |
80 | 86 | ||
81 | $(SHAREDLIBV): $(OBJS) | 87 | match.lo: match.S |
82 | $(LDSHARED) -o $@ $(OBJS) | 88 | $(CPP) match.S > _match.s |
89 | $(CC) -c -fPIC _match.s | ||
90 | mv _match.o match.lo | ||
91 | rm -f _match.s | ||
92 | |||
93 | %.lo: %.c | ||
94 | $(CC) $(SFLAGS) -DPIC -c $< -o $@ | ||
95 | |||
96 | $(SHAREDLIBV): $(PIC_OBJS) | ||
97 | $(LDSHARED) -o $@ $(PIC_OBJS) -lc | ||
83 | rm -f $(SHAREDLIB) $(SHAREDLIBM) | 98 | rm -f $(SHAREDLIB) $(SHAREDLIBM) |
84 | ln -s $@ $(SHAREDLIB) | 99 | ln -s $@ $(SHAREDLIB) |
85 | ln -s $@ $(SHAREDLIBM) | 100 | ln -s $@ $(SHAREDLIBM) |
@@ -90,14 +105,11 @@ example$(EXE): example.o $(LIBS) | |||
90 | minigzip$(EXE): minigzip.o $(LIBS) | 105 | minigzip$(EXE): minigzip.o $(LIBS) |
91 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 106 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
92 | 107 | ||
93 | install: $(LIBS) | 108 | install-libs: $(LIBS) |
94 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi | 109 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi |
95 | -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi | ||
96 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi | 110 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi |
97 | -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi | 111 | -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi |
98 | -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi | 112 | -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi |
99 | cp zlib.h zconf.h $(DESTDIR)$(includedir) | ||
100 | chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h | ||
101 | cp $(LIBS) $(DESTDIR)$(libdir) | 113 | cp $(LIBS) $(DESTDIR)$(libdir) |
102 | cd $(DESTDIR)$(libdir); chmod 755 $(LIBS) | 114 | cd $(DESTDIR)$(libdir); chmod 755 $(LIBS) |
103 | -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 | 115 | -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 |
@@ -114,8 +126,13 @@ install: $(LIBS) | |||
114 | # The ranlib in install is needed on NeXTSTEP which checks file times | 126 | # The ranlib in install is needed on NeXTSTEP which checks file times |
115 | # ldconfig is for Linux | 127 | # ldconfig is for Linux |
116 | 128 | ||
129 | install: install-libs | ||
130 | -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi | ||
131 | cp zlib.h zconf.h zlibdefs.h $(DESTDIR)$(includedir) | ||
132 | chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h $(DESTDIR)$(includedir)/zlibdefs.h | ||
133 | |||
117 | uninstall: | 134 | uninstall: |
118 | cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h | 135 | cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h zlibdefs.h |
119 | cd $(DESTDIR)$(libdir); rm -f libz.a; \ | 136 | cd $(DESTDIR)$(libdir); rm -f libz.a; \ |
120 | if test -f $(SHAREDLIBV); then \ | 137 | if test -f $(SHAREDLIBV); then \ |
121 | rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ | 138 | rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ |
@@ -125,14 +142,15 @@ uninstall: | |||
125 | 142 | ||
126 | mostlyclean: clean | 143 | mostlyclean: clean |
127 | clean: | 144 | clean: |
128 | rm -f *.o *~ example$(EXE) minigzip$(EXE) \ | 145 | rm -f *.o *.lo *~ example$(EXE) minigzip$(EXE) \ |
129 | libz.* foo.gz so_locations \ | 146 | libz.* foo.gz so_locations \ |
130 | _match.s maketree contrib/infback9/*.o | 147 | _match.s maketree contrib/infback9/*.o |
131 | 148 | ||
132 | maintainer-clean: distclean | 149 | maintainer-clean: distclean |
133 | distclean: clean | 150 | distclean: clean |
134 | cp -p Makefile.in Makefile | 151 | cp -p Makefile.in Makefile |
135 | cp -p zconf.in.h zconf.h | 152 | rm zlibdefs.h |
153 | touch -r configure zlibdefs.h | ||
136 | rm -f zlib.pc .DS_Store | 154 | rm -f zlib.pc .DS_Store |
137 | 155 | ||
138 | tags: | 156 | tags: |
@@ -143,17 +161,32 @@ depend: | |||
143 | 161 | ||
144 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 162 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
145 | 163 | ||
146 | adler32.o: zlib.h zconf.h | 164 | adler32.o: zlib.h zconf.h zlibdefs.h |
147 | compress.o: zlib.h zconf.h | 165 | compress.o: zlib.h zconf.h zlibdefs.h |
148 | crc32.o: crc32.h zlib.h zconf.h | 166 | crc32.o: crc32.h zlib.h zconf.h zlibdefs.h |
149 | deflate.o: deflate.h zutil.h zlib.h zconf.h | 167 | deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h |
150 | example.o: zlib.h zconf.h | 168 | example.o: zlib.h zconf.h zlibdefs.h |
151 | gzio.o: zutil.h zlib.h zconf.h | 169 | gzio.o: zutil.h zlib.h zconf.h zlibdefs.h |
152 | inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 170 | inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h |
153 | inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 171 | inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
154 | infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 172 | infback.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
155 | inftrees.o: zutil.h zlib.h zconf.h inftrees.h | 173 | inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h |
156 | minigzip.o: zlib.h zconf.h | 174 | minigzip.o: zlib.h zconf.h zlibdefs.h |
157 | trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | 175 | trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h |
158 | uncompr.o: zlib.h zconf.h | 176 | uncompr.o: zlib.h zconf.h zlibdefs.h |
159 | zutil.o: zutil.h zlib.h zconf.h | 177 | zutil.o: zutil.h zlib.h zconf.h zlibdefs.h |
178 | |||
179 | adler32.lo: zlib.h zconf.h zlibdefs.h | ||
180 | compress.lo: zlib.h zconf.h zlibdefs.h | ||
181 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h | ||
182 | 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 | ||
185 | 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 | ||
187 | 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 | ||
189 | minigzip.lo: zlib.h zconf.h zlibdefs.h | ||
190 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h | ||
191 | uncompr.lo: zlib.h zconf.h zlibdefs.h | ||
192 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h | ||