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