]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | # makefile for libpng on DEC Alpha Unix |
9dfaa473 | 2 | # Copyright (C) 2000-2002 Glenn Randers-Pehrson |
c801d85f KB |
3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. |
4 | # For conditions of distribution and use, see copyright notice in png.h | |
5 | ||
9dfaa473 GD |
6 | # where make install puts libpng.a and png.h |
7 | prefix=/usr/local | |
8 | INCPATH=$(prefix)/include | |
9 | LIBPATH=$(prefix)/lib | |
10 | MANPATH=$(prefix)/man | |
11 | BINPATH=$(prefix)/bin | |
12 | ||
13 | # override DESTDIR= on the make install command line to easily support | |
14 | # installing into a temporary location. Example: | |
15 | # | |
16 | # make install DESTDIR=/tmp/build/libpng | |
17 | # | |
18 | # If you're going to install into a temporary location | |
19 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before | |
20 | # you execute make install. | |
21 | DESTDIR= | |
22 | ||
23 | DB=$(DESTDIR)$(BINPATH) | |
24 | DI=$(DESTDIR)$(INCPATH) | |
25 | DL=$(DESTDIR)$(LIBPATH) | |
26 | DM=$(DESTDIR)$(MANPATH) | |
27 | ||
c801d85f KB |
28 | # Where the zlib library and include files are located |
29 | #ZLIBLIB=/usr/local/lib | |
30 | #ZLIBINC=/usr/local/include | |
31 | ZLIBLIB=../zlib | |
32 | ZLIBINC=../zlib | |
33 | ||
9dfaa473 | 34 | PNGMAJ = 0 |
880c38ba | 35 | PNGMIN = 1.2.7 |
9dfaa473 GD |
36 | PNGVER = $(PNGMAJ).$(PNGMIN) |
37 | LIBNAME = libpng12 | |
38 | ||
c801d85f KB |
39 | CC=cc |
40 | CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1 | |
3d11a79a | 41 | LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm |
c801d85f KB |
42 | |
43 | #RANLIB=echo | |
44 | RANLIB=ranlib | |
45 | ||
c801d85f KB |
46 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
47 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ | |
48 | pngwtran.o pngmem.o pngerror.o pngpread.o | |
49 | ||
9dfaa473 | 50 | all: $(LIBNAME).so libpng.a pngtest libpng.pc libpng-config |
c801d85f KB |
51 | |
52 | libpng.a: $(OBJS) | |
53 | ar rc $@ $(OBJS) | |
54 | $(RANLIB) $@ | |
55 | ||
9dfaa473 GD |
56 | libpng.pc: |
57 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc | |
58 | ||
59 | libpng-config: | |
60 | ( cat scripts/libpng-config-head.in; \ | |
61 | echo prefix=\"$(prefix)\"; \ | |
3d11a79a VS |
62 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ |
63 | echo ccopts=\"-std\"; \ | |
64 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
9dfaa473 GD |
65 | echo libs=\"-lpng12 -lz -lm\"; \ |
66 | cat scripts/libpng-config-body.in ) > libpng-config | |
67 | chmod +x libpng-config | |
68 | ||
69 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) | |
70 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so | |
71 | ||
72 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) | |
73 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) | |
74 | ||
75 | $(LIBNAME).so.$(PNGVER): $(OBJS) | |
3d11a79a VS |
76 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \ |
77 | -soname $(LIBNAME).so.$(PNGMAJ) | |
78 | ||
79 | libpng.so.3.$(PNGMIN): $(OBJS) | |
80 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \ | |
81 | -soname libpng.so.3 | |
9dfaa473 | 82 | |
c801d85f KB |
83 | pngtest: pngtest.o libpng.a |
84 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
85 | ||
86 | test: pngtest | |
87 | ./pngtest | |
88 | ||
9dfaa473 GD |
89 | install-headers: png.h pngconf.h |
90 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi | |
91 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi | |
92 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
93 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
94 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h | |
95 | -@/bin/rm -f $(DI)/libpng | |
96 | (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .) | |
97 | ||
98 | install-static: install-headers libpng.a | |
99 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
100 | cp libpng.a $(DL)/$(LIBNAME).a | |
101 | chmod 644 $(DL)/$(LIBNAME).a | |
102 | -@/bin/rm -f $(DL)/libpng.a | |
103 | (cd $(DL); ln -sf $(LIBNAME).a libpng.a) | |
104 | ||
3d11a79a VS |
105 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \ |
106 | libpng.so.3.$(PNGMIN) | |
9dfaa473 | 107 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
3d11a79a VS |
108 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so |
109 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ) | |
9dfaa473 GD |
110 | -@/bin/rm -f $(DL)/libpng.so |
111 | -@/bin/rm -f $(DL)/libpng.so.3 | |
3d11a79a | 112 | -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)* |
9dfaa473 | 113 | cp $(LIBNAME).so.$(PNGVER) $(DL) |
3d11a79a | 114 | cp libpng.so.3.$(PNGMIN) $(DL) |
9dfaa473 | 115 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) |
3d11a79a | 116 | chmod 755 $(DL)/libpng.so.3.$(PNGMIN) |
9dfaa473 | 117 | (cd $(DL); \ |
3d11a79a VS |
118 | ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \ |
119 | ln -f -s libpng.so.3 libpng.so; \ | |
9dfaa473 GD |
120 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ |
121 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) | |
122 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi | |
123 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc | |
124 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc | |
125 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
126 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
127 | (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) | |
128 | ||
129 | install-man: libpng.3 libpngpf.3 png.5 | |
130 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi | |
131 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi | |
132 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
133 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
134 | cp libpng.3 $(DM)/man3 | |
135 | cp libpngpf.3 $(DM)/man3 | |
136 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi | |
137 | -@/bin/rm -f $(DM)/man5/png.5 | |
138 | cp png.5 $(DM)/man5 | |
139 | ||
140 | install-config: libpng-config | |
141 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi | |
142 | -@/bin/rm -f $(DB)/libpng-config | |
143 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
144 | cp libpng-config $(DB)/$(LIBNAME)-config | |
145 | chmod 755 $(DB)/$(LIBNAME)-config | |
146 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) | |
147 | ||
148 | install: install-static install-shared install-man install-config | |
149 | ||
150 | # If you installed in $(DESTDIR), test-installed won't work until you | |
880c38ba VS |
151 | # move the library to its final location. Use test-dd to test it |
152 | # before then. | |
153 | ||
154 | test-dd: | |
155 | echo | |
156 | echo Testing installed dynamic shared library in $(DL). | |
157 | $(CC) -w1 -I$(DI) -I$(ZLIBINC) \ | |
158 | `$(BINPATH)/libpng12-config --cflags` pngtest.c \ | |
159 | -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \ | |
160 | -o pngtestd `$(BINPATH)/libpng12-config --ldflags` | |
161 | ./pngtestd pngtest.png | |
9dfaa473 GD |
162 | |
163 | test-installed: | |
164 | echo | |
165 | echo Testing installed dynamic shared library. | |
3d11a79a VS |
166 | $(CC) -w1 -I$(ZLIBINC) \ |
167 | `$(BINPATH)/libpng12-config --cflags` pngtest.c \ | |
9dfaa473 | 168 | -L$(ZLIBLIB) -R$(ZLIBLIB) \ |
3d11a79a | 169 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags` |
9dfaa473 | 170 | ./pngtesti pngtest.png |
c801d85f KB |
171 | |
172 | clean: | |
3d11a79a VS |
173 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \ |
174 | libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ | |
175 | libpng.so.3.$(PNGMIN) \ | |
176 | libpng.pc | |
c801d85f KB |
177 | |
178 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
179 | ||
180 | png.o: png.h pngconf.h | |
181 | pngerror.o: png.h pngconf.h | |
182 | pngrio.o: png.h pngconf.h | |
183 | pngwio.o: png.h pngconf.h | |
184 | pngmem.o: png.h pngconf.h | |
185 | pngset.o: png.h pngconf.h | |
186 | pngget.o: png.h pngconf.h | |
187 | pngread.o: png.h pngconf.h | |
188 | pngrtran.o: png.h pngconf.h | |
189 | pngrutil.o: png.h pngconf.h | |
190 | pngtest.o: png.h pngconf.h | |
191 | pngtrans.o: png.h pngconf.h | |
192 | pngwrite.o: png.h pngconf.h | |
193 | pngwtran.o: png.h pngconf.h | |
194 | pngwutil.o: png.h pngconf.h | |
195 | pngpread.o: png.h pngconf.h | |
196 |