source: rtems/cpukit/zlib/Makefile.in @ 4b06f71a

4.115
Last change on this file since 4b06f71a was f82036a5, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/18/11 at 10:11:26

Import from zlib-1.2.4

  • Property mode set to 100644
File size: 7.4 KB
Line 
1# Makefile for zlib
2# Copyright (C) 1995-2010 Jean-loup Gailly.
3# For conditions of distribution and use, see copyright notice in zlib.h
4
5# To compile and test, type:
6#    ./configure; make test
7# Normally configure builds both a static and a shared library.
8# If you want to build just a static library, use: ./configure --static
9
10# To use the asm code, type:
11#    cp contrib/asm?86/match.S ./match.S
12#    make LOC=-DASMV OBJA=match.o
13
14# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
15#    make install
16# To install in $HOME instead of /usr/local, use:
17#    make install prefix=$HOME
18
19CC=cc
20
21CFLAGS=-O
22#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
23#CFLAGS=-g -DDEBUG
24#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25#           -Wstrict-prototypes -Wmissing-prototypes
26
27SFLAGS=-O
28
29LDFLAGS=-L. libz.a
30LDSHARED=$(CC)
31CPP=$(CC) -E
32
33STATICLIB=libz.a
34SHAREDLIB=libz.so
35SHAREDLIBV=libz.so.1.2.4
36SHAREDLIBM=libz.so.1
37LIBS=$(STATICLIB) $(SHAREDLIB) $(SHAREDLIBV)
38
39AR=ar rc
40RANLIB=ranlib
41TAR=tar
42SHELL=/bin/sh
43EXE=
44
45prefix = /usr/local
46exec_prefix = ${prefix}
47libdir = ${exec_prefix}/lib
48includedir = ${prefix}/include
49mandir = ${prefix}/share/man
50man3dir = ${mandir}/man3
51pkgconfigdir = ${libdir}/pkgconfig
52
53OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
54        gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
55
56PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo \
57        gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo
58
59# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
60OBJA =
61PIC_OBJA =
62
63OBJS = $(OBJC) $(OBJA)
64
65PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
66
67all: static shared
68
69static: example$(EXE) minigzip$(EXE)
70
71shared: examplesh$(EXE) minigzipsh$(EXE)
72
73all64: example64$(EXE) minigzip64$(EXE)
74
75check: test
76
77test: all teststatic testshared
78
79teststatic: static
80        @if echo hello world | ./minigzip | ./minigzip -d && ./example; then \
81          echo '                *** zlib test OK ***'; \
82        else \
83          echo '                *** zlib test FAILED ***'; false; \
84        fi
85        -@rm -f foo.gz
86
87testshared: shared
88        @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
89        LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
90        DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
91        SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
92        if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \
93          echo '                *** zlib shared test OK ***'; \
94        else \
95          echo '                *** zlib shared test FAILED ***'; false; \
96        fi
97        -@rm -f foo.gz
98
99test64: all64
100        @if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \
101          echo '                *** zlib 64-bit test OK ***'; \
102        else \
103          echo '                *** zlib 64-bit test FAILED ***'; false; \
104        fi
105        -@rm -f foo.gz
106
107libz.a: $(OBJS)
108        $(AR) $@ $(OBJS)
109        -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
110
111match.o: match.S
112        $(CPP) match.S > _match.s
113        $(CC) -c _match.s
114        mv _match.o match.o
115        rm -f _match.s
116
117match.lo: match.S
118        $(CPP) match.S > _match.s
119        $(CC) -c -fPIC _match.s
120        mv _match.o match.lo
121        rm -f _match.s
122
123example64.o: example.c zlib.h zconf.h
124        $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c
125
126minigzip64.o: minigzip.c zlib.h zconf.h
127        $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c
128
129.SUFFIXES: .lo
130
131.c.lo:
132        -@if [ ! -d objs ]; then mkdir objs; fi
133        $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
134        -@mv objs/$*.o $@
135
136$(SHAREDLIBV): $(PIC_OBJS)
137        $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) -lc
138        rm -f $(SHAREDLIB) $(SHAREDLIBM)
139        ln -s $@ $(SHAREDLIB)
140        ln -s $@ $(SHAREDLIBM)
141        -@rmdir objs
142
143example$(EXE): example.o $(STATICLIB)
144        $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
145
146minigzip$(EXE): minigzip.o $(STATICLIB)
147        $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
148
149examplesh$(EXE): example.o $(SHAREDLIBV)
150        $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
151
152minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
153        $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
154
155example64$(EXE): example64.o $(STATICLIB)
156        $(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS)
157
158minigzip64$(EXE): minigzip64.o $(STATICLIB)
159        $(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS)
160
161install-libs: $(LIBS)
162        -@if [ ! -d $(DESTDIR)$(exec_prefix)  ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
163        -@if [ ! -d $(DESTDIR)$(libdir)       ]; then mkdir -p $(DESTDIR)$(libdir); fi
164        -@if [ ! -d $(DESTDIR)$(man3dir)      ]; then mkdir -p $(DESTDIR)$(man3dir); fi
165        -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
166        cp $(LIBS) $(DESTDIR)$(libdir)
167        cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
168        -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
169        -@cd $(DESTDIR)$(libdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
170          chmod 755 $(SHAREDLIBV); \
171          rm -f $(SHAREDLIB) $(SHAREDLIBM); \
172          ln -s $(SHAREDLIBV) $(SHAREDLIB); \
173          ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
174          (ldconfig || true)  >/dev/null 2>&1; \
175        fi
176        cp zlib.3 $(DESTDIR)$(man3dir)
177        chmod 644 $(DESTDIR)$(man3dir)/zlib.3
178        cp zlib.pc $(DESTDIR)$(pkgconfigdir)
179        chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
180# The ranlib in install is needed on NeXTSTEP which checks file times
181# ldconfig is for Linux
182
183install: install-libs
184        -@if [ ! -d $(DESTDIR)$(includedir)   ]; then mkdir -p $(DESTDIR)$(includedir); fi
185        cp zlib.h zconf.h $(DESTDIR)$(includedir)
186        chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
187
188uninstall:
189        cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
190        cd $(DESTDIR)$(libdir); rm -f libz.a; \
191        if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
192          rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
193        fi
194        cd $(DESTDIR)$(man3dir); rm -f zlib.3
195        cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
196
197docs: zlib.3.pdf
198
199zlib.3.pdf: zlib.3
200        groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
201
202zconf.h.in: zconf.h.cmakein
203        sed "/^#cmakedefine/D" < zconf.h.cmakein > zconf.h.in
204        touch -r zconf.h.cmakein zconf.h.in
205
206zconf: zconf.h.in
207        cp -p zconf.h.in zconf.h
208
209mostlyclean: clean
210clean:
211        rm -f *.o *.lo *~ \
212           example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
213           example64$(EXE) minigzip64$(EXE) \
214           libz.* foo.gz so_locations \
215           _match.s maketree contrib/infback9/*.o
216        rm -rf objs
217
218maintainer-clean: distclean
219distclean: clean zconf docs
220        rm -f Makefile zlib.pc
221        -@rm -f .DS_Store
222        -@printf 'all:\n\t-@echo "Please use ./configure first.  Thank you."\n' > Makefile
223        -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
224        -@touch -r Makefile.in Makefile
225
226tags:
227        etags *.[ch]
228
229depend:
230        makedepend -- $(CFLAGS) -- *.[ch]
231
232# DO NOT DELETE THIS LINE -- make depend depends on it.
233
234adler32.o zutil.o: zutil.h zlib.h zconf.h
235gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
236compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
237crc32.o: zutil.h zlib.h zconf.h crc32.h
238deflate.o: deflate.h zutil.h zlib.h zconf.h
239infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
240inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
241inftrees.o: zutil.h zlib.h zconf.h inftrees.h
242trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
243
244adler32.lo zutil.lo: zutil.h zlib.h zconf.h
245gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
246compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
247crc32.lo: zutil.h zlib.h zconf.h crc32.h
248deflate.lo: deflate.h zutil.h zlib.h zconf.h
249infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
250inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
251inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
252trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h
Note: See TracBrowser for help on using the repository browser.