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