]>
Commit | Line | Data |
---|---|---|
0272a10d | 1 | # makefile for libpng on DEC Alpha Unix |
9c0d9ce3 | 2 | # Copyright (C) 2000-2002, 2006, 2010-2011 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: | |
9c0d9ce3 DS |
10 | PNGMAJ = 15 |
11 | LIBNAME = libpng15 | |
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 | ||
9c0d9ce3 DS |
65 | # see scripts/pnglibconf.mak for more options |
66 | pnglibconf.h: scripts/pnglibconf.h.prebuilt | |
67 | cp scripts/pnglibconf.h.prebuilt $@ | |
68 | ||
0272a10d VZ |
69 | libpng.a: $(OBJS) |
70 | $(AR_RC) $@ $(OBJS) | |
71 | $(RANLIB) $@ | |
72 | ||
73 | libpng.pc: | |
970f6abe VZ |
74 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ |
75 | -e s!@exec_prefix@!$(exec_prefix)! \ | |
76 | -e s!@libdir@!$(LIBPATH)! \ | |
77 | -e s!@includedir@!$(INCPATH)! \ | |
9c0d9ce3 | 78 | -e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc |
0272a10d VZ |
79 | |
80 | libpng-config: | |
81 | ( cat scripts/libpng-config-head.in; \ | |
82 | echo prefix=\"$(prefix)\"; \ | |
83 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
84 | echo ccopts=\"-std\"; \ | |
85 | echo L_opts=\"-L$(LIBPATH)\"; \ | |
9c0d9ce3 | 86 | echo libs=\"-lpng15 -lz -lm\"; \ |
0272a10d VZ |
87 | cat scripts/libpng-config-body.in ) > libpng-config |
88 | chmod +x libpng-config | |
89 | ||
90 | $(LIBSO): $(LIBSOMAJ) | |
91 | $(LN_SF) $(LIBSOMAJ) $(LIBSO) | |
92 | ||
b61cc19c | 93 | $(LIBSOMAJ): $(OBJS) |
0272a10d VZ |
94 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \ |
95 | -soname $(LIBSOMAJ) | |
96 | ||
0272a10d VZ |
97 | pngtest: pngtest.o libpng.a |
98 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
99 | ||
100 | test: pngtest | |
101 | ./pngtest | |
102 | ||
9c0d9ce3 | 103 | install-headers: png.h pngconf.h pnglibconf.h |
0272a10d VZ |
104 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi |
105 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi | |
9c0d9ce3 DS |
106 | cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME) |
107 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h | |
108 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h | |
0272a10d VZ |
109 | -@/bin/rm -f $(DI)/libpng |
110 | (cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .) | |
111 | ||
112 | install-static: install-headers libpng.a | |
113 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi | |
114 | cp libpng.a $(DL)/$(LIBNAME).a | |
115 | chmod 644 $(DL)/$(LIBNAME).a | |
116 | -@/bin/rm -f $(DL)/libpng.a | |
117 | (cd $(DL); $(LN_SF)(LIBNAME).a libpng.a) | |
118 | ||
b61cc19c | 119 | install-shared: install-headers $(LIBSOMAJ) libpng.pc |
0272a10d | 120 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
b61cc19c PC |
121 | -@$(RM_F) $(DL)/$(LIBSO) |
122 | -@$(RM_F) $(DL)/$(LIBSOREL) | |
123 | -@$(RM_F) $(DL)/$(OLDSO) | |
124 | cp $(LIBSOMAJ) $(DL)/$(LIBSOREL) | |
125 | chmod 755 $(DL)/$(LIBSOREL) | |
0272a10d | 126 | (cd $(DL); \ |
b61cc19c PC |
127 | $(LN_SF) $(LIBSOREL) $(LIBSO); \ |
128 | $(LN_SF) $(LIBSO) $(OLDSO)) | |
0272a10d | 129 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi |
b61cc19c PC |
130 | -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc |
131 | -@$(RM_F) $(DL)/pkgconfig/libpng.pc | |
0272a10d VZ |
132 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc |
133 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
b61cc19c | 134 | (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) |
0272a10d VZ |
135 | |
136 | install-man: libpng.3 libpngpf.3 png.5 | |
137 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi | |
138 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi | |
139 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
140 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
141 | cp libpng.3 $(DM)/man3 | |
142 | cp libpngpf.3 $(DM)/man3 | |
143 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi | |
144 | -@/bin/rm -f $(DM)/man5/png.5 | |
145 | cp png.5 $(DM)/man5 | |
146 | ||
147 | install-config: libpng-config | |
148 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi | |
149 | -@/bin/rm -f $(DB)/libpng-config | |
150 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
151 | cp libpng-config $(DB)/$(LIBNAME)-config | |
152 | chmod 755 $(DB)/$(LIBNAME)-config | |
153 | (cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config) | |
154 | ||
155 | install: install-static install-shared install-man install-config | |
156 | ||
157 | # If you installed in $(DESTDIR), test-installed won't work until you | |
158 | # move the library to its final location. Use test-dd to test it | |
159 | # before then. | |
160 | ||
161 | test-dd: | |
162 | echo | |
163 | echo Testing installed dynamic shared library in $(DL). | |
164 | $(CC) -w1 -I$(DI) -I$(ZLIBINC) \ | |
165 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
166 | -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \ | |
167 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
168 | ./pngtestd pngtest.png | |
169 | ||
170 | test-installed: | |
171 | echo | |
172 | echo Testing installed dynamic shared library. | |
173 | $(CC) -w1 -I$(ZLIBINC) \ | |
174 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ | |
175 | -L$(ZLIBLIB) -R$(ZLIBLIB) \ | |
176 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` | |
177 | ./pngtesti pngtest.png | |
178 | ||
179 | clean: | |
180 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \ | |
181 | libpng-config $(LIBSO) $(LIBSOMAJ)* \ | |
9c0d9ce3 | 182 | libpng.pc pnglibconf.h |
0272a10d VZ |
183 | |
184 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
185 | ||
9c0d9ce3 DS |
186 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h |
187 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
188 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
189 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
190 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
191 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
192 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
193 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
194 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
195 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
196 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
197 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
198 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
199 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
200 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h | |
201 | ||
202 | pngtest.o: png.h pngconf.h pnglibconf.h |