|
1 # makefile for libpng on Solaris 2.x with cc |
|
2 # Contributed by William L. Sebok, based on makefile.linux |
|
3 # Copyright (C) 2002, 2006 Glenn Randers-Pehrson |
|
4 # Copyright (C) 1998 Greg Roelofs |
|
5 # Copyright (C) 1996, 1997 Andreas Dilger |
|
6 |
|
7 # This code is released under the libpng license. |
|
8 # For conditions of distribution and use, see the disclaimer |
|
9 # and license in png.h |
|
10 |
|
11 # Library name: |
|
12 LIBNAME=libpng12 |
|
13 PNGMAJ = 0 |
|
14 PNGMIN = 1.2.40 |
|
15 PNGVER = $(PNGMAJ).$(PNGMIN) |
|
16 |
|
17 # Shared library names: |
|
18 LIBSO=$(LIBNAME).so |
|
19 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) |
|
20 LIBSOVER=$(LIBNAME).so.$(PNGVER) |
|
21 OLDSO=libpng.so |
|
22 OLDSOMAJ=libpng.so.3 |
|
23 OLDSOVER=libpng.so.3.$(PNGMIN) |
|
24 |
|
25 # Utilities: |
|
26 CC=cc |
|
27 AR_RC=ar rc |
|
28 MKDIR_P=mkdir -p |
|
29 LN_SF=ln -f -s |
|
30 RANLIB=echo |
|
31 RM_F=/bin/rm -f |
|
32 |
|
33 SUN_CC_FLAGS=-fast -xtarget=ultra |
|
34 SUN_LD_FLAGS=-fast -xtarget=ultra |
|
35 |
|
36 # where make install puts libpng.a, libpng12.so and libpng12/png.h |
|
37 prefix=/a |
|
38 exec_prefix=$(prefix) |
|
39 |
|
40 # Where the zlib library and include files are located |
|
41 # Changing these to ../zlib poses a security risk. If you want |
|
42 # to have zlib in an adjacent directory, specify the full path instead of "..". |
|
43 #ZLIBLIB=../zlib |
|
44 #ZLIBINC=../zlib |
|
45 |
|
46 ZLIBLIB=/usr/lib |
|
47 ZLIBINC=/usr/include |
|
48 |
|
49 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ |
|
50 -Wmissing-declarations -Wtraditional -Wcast-align \ |
|
51 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion |
|
52 CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \ |
|
53 # $(WARNMORE) -g -DPNG_DEBUG=5 |
|
54 LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm |
|
55 |
|
56 INCPATH=$(prefix)/include |
|
57 LIBPATH=$(exec_prefix)/lib |
|
58 MANPATH=$(prefix)/man |
|
59 BINPATH=$(exec_prefix)/bin |
|
60 |
|
61 # override DESTDIR= on the make install command line to easily support |
|
62 # installing into a temporary location. Example: |
|
63 # |
|
64 # make install DESTDIR=/tmp/build/libpng |
|
65 # |
|
66 # If you're going to install into a temporary location |
|
67 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
|
68 # you execute make install. |
|
69 DESTDIR= |
|
70 |
|
71 DB=$(DESTDIR)$(BINPATH) |
|
72 DI=$(DESTDIR)$(INCPATH) |
|
73 DL=$(DESTDIR)$(LIBPATH) |
|
74 DM=$(DESTDIR)$(MANPATH) |
|
75 |
|
76 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
|
77 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
|
78 pngwtran.o pngmem.o pngerror.o pngpread.o |
|
79 |
|
80 OBJSDLL = $(OBJS:.o=.pic.o) |
|
81 |
|
82 .SUFFIXES: .c .o .pic.o |
|
83 |
|
84 .c.pic.o: |
|
85 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c |
|
86 |
|
87 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config |
|
88 |
|
89 libpng.a: $(OBJS) |
|
90 $(AR_RC) $@ $(OBJS) |
|
91 $(RANLIB) $@ |
|
92 |
|
93 libpng.pc: |
|
94 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \ |
|
95 -e s!@exec_prefix@!$(exec_prefix)! \ |
|
96 -e s!@libdir@!$(LIBPATH)! \ |
|
97 -e s!@includedir@!$(INCPATH)! \ |
|
98 -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc |
|
99 |
|
100 libpng-config: |
|
101 ( cat scripts/libpng-config-head.in; \ |
|
102 echo prefix=\"$(prefix)\"; \ |
|
103 echo libdir=\"$(LIBPATH)\"; \ |
|
104 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ |
|
105 echo L_opts=\"-L$(LIBPATH)\"; \ |
|
106 echo R_opts=\"-R$(LIBPATH)\"; \ |
|
107 echo ccopts=\"-xtarget=ultra\"; \ |
|
108 echo ldopts=\"-xtarget=ultra\"; \ |
|
109 echo libs=\"-lpng12 -lz -lm\"; \ |
|
110 cat scripts/libpng-config-body.in ) > libpng-config |
|
111 chmod +x libpng-config |
|
112 |
|
113 $(LIBSO): $(LIBSOMAJ) |
|
114 $(LN_SF) $(LIBSOMAJ) $(LIBSO) |
|
115 |
|
116 $(LIBSOMAJ): $(LIBSOVER) |
|
117 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ) |
|
118 |
|
119 $(LIBSOVER): $(OBJSDLL) |
|
120 @case "`type ld`" in *ucb*) \ |
|
121 echo; \ |
|
122 echo '## WARNING:'; \ |
|
123 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \ |
|
124 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \ |
|
125 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \ |
|
126 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \ |
|
127 echo '## at all. If it is, things are likely to break because of'; \ |
|
128 echo '## the libucb dependency that is created.'; \ |
|
129 echo; \ |
|
130 ;; \ |
|
131 esac |
|
132 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBSOMAJ) \ |
|
133 -o $(LIBSOVER) $(OBJSDLL) |
|
134 |
|
135 $(OLDSOVER): $(OBJSDLL) |
|
136 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(OLDSOMAJ) \ |
|
137 -o $(OLDSOVER) $(OBJSDLL) |
|
138 |
|
139 pngtest: pngtest.o $(LIBSO) |
|
140 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
|
141 |
|
142 test: pngtest |
|
143 ./pngtest |
|
144 |
|
145 install-headers: png.h pngconf.h |
|
146 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi |
|
147 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi |
|
148 cp png.h pngconf.h $(DI)/$(LIBNAME) |
|
149 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h |
|
150 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h |
|
151 -@$(RM_F) $(DI)/libpng |
|
152 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .) |
|
153 |
|
154 install-static: install-headers libpng.a |
|
155 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
|
156 cp libpng.a $(DL)/$(LIBNAME).a |
|
157 chmod 644 $(DL)/$(LIBNAME).a |
|
158 -@$(RM_F) $(DL)/libpng.a |
|
159 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a) |
|
160 |
|
161 install-shared: install-headers $(LIBSOVER) libpng.pc \ |
|
162 $(OLDSOVER) |
|
163 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi |
|
164 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO) |
|
165 -@$(RM_F) $(DL)/$(LIBSOMAJ) |
|
166 -@$(RM_F) $(DL)/$(LIBSO) |
|
167 -@$(RM_F) $(DL)/$(OLDSO) |
|
168 -@$(RM_F) $(DL)/$(OLDSOMAJ) |
|
169 -@$(RM_F) $(DL)/$(OLDSOMAJ).$(PNGVER)* |
|
170 cp $(LIBSOVER) $(DL) |
|
171 cp $(OLDSOVER) $(DL) |
|
172 chmod 755 $(DL)/$(LIBSOVER) |
|
173 chmod 755 $(DL)/$(OLDSOVER) |
|
174 (cd $(DL); \ |
|
175 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \ |
|
176 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \ |
|
177 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \ |
|
178 $(LN_SF) $(LIBSOMAJ) $(LIBSO)) |
|
179 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi |
|
180 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc |
|
181 -@$(RM_F) $(DL)/pkgconfig/libpng.pc |
|
182 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc |
|
183 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc |
|
184 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc) |
|
185 |
|
186 install-man: libpng.3 libpngpf.3 png.5 |
|
187 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi |
|
188 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi |
|
189 -@$(RM_F) $(DM)/man3/libpng.3 |
|
190 -@$(RM_F) $(DM)/man3/libpngpf.3 |
|
191 cp libpng.3 $(DM)/man3 |
|
192 cp libpngpf.3 $(DM)/man3 |
|
193 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi |
|
194 -@$(RM_F) $(DM)/man5/png.5 |
|
195 cp png.5 $(DM)/man5 |
|
196 |
|
197 install-config: libpng-config |
|
198 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi |
|
199 -@$(RM_F) $(DB)/libpng-config |
|
200 -@$(RM_F) $(DB)/$(LIBNAME)-config |
|
201 cp libpng-config $(DB)/$(LIBNAME)-config |
|
202 chmod 755 $(DB)/$(LIBNAME)-config |
|
203 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config) |
|
204 |
|
205 install: install-static install-shared install-man install-config |
|
206 |
|
207 # If you installed in $(DESTDIR), test-installed won't work until you |
|
208 # move the library to its final location. Use test-dd to test it |
|
209 # before then. |
|
210 |
|
211 test-dd: |
|
212 echo |
|
213 echo Testing installed dynamic shared library in $(DL). |
|
214 $(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \ |
|
215 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ |
|
216 -o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \ |
|
217 $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) |
|
218 ./pngtestd pngtest.png |
|
219 |
|
220 test-installed: |
|
221 echo |
|
222 echo Testing installed dynamic shared library. |
|
223 $(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \ |
|
224 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \ |
|
225 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \ |
|
226 $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) |
|
227 ./pngtesti pngtest.png |
|
228 |
|
229 clean: |
|
230 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \ |
|
231 libpng-config $(LIBSO) $(LIBSOMAJ)* \ |
|
232 $(OLDSOVER) \ |
|
233 libpng.pc |
|
234 |
|
235 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
|
236 writelock: |
|
237 chmod a-w *.[ch35] $(DOCS) scripts/* |
|
238 |
|
239 # DO NOT DELETE THIS LINE -- make depend depends on it. |
|
240 |
|
241 png.o png.pic.o: png.h pngconf.h |
|
242 pngerror.o pngerror.pic.o: png.h pngconf.h |
|
243 pngrio.o pngrio.pic.o: png.h pngconf.h |
|
244 pngwio.o pngwio.pic.o: png.h pngconf.h |
|
245 pngmem.o pngmem.pic.o: png.h pngconf.h |
|
246 pngset.o pngset.pic.o: png.h pngconf.h |
|
247 pngget.o pngget.pic.o: png.h pngconf.h |
|
248 pngread.o pngread.pic.o: png.h pngconf.h |
|
249 pngrtran.o pngrtran.pic.o: png.h pngconf.h |
|
250 pngrutil.o pngrutil.pic.o: png.h pngconf.h |
|
251 pngtrans.o pngtrans.pic.o: png.h pngconf.h |
|
252 pngwrite.o pngwrite.pic.o: png.h pngconf.h |
|
253 pngwtran.o pngwtran.pic.o: png.h pngconf.h |
|
254 pngwutil.o pngwutil.pic.o: png.h pngconf.h |
|
255 pngpread.o pngpread.pic.o: png.h pngconf.h |
|
256 |
|
257 pngtest.o: png.h pngconf.h |