]>
Commit | Line | Data |
---|---|---|
c6b71bff GD |
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.4 | |
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 cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \ | |
85 | echo cflags=\"\"; \ | |
86 | echo ldflags=\"-L$(LIBPATH) -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 -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \ | |
111 | -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz | |
112 | ||
113 | pngtest: pngtest.o $(LIBNAME).so | |
114 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) | |
115 | ||
116 | test: pngtest | |
117 | ./pngtest | |
118 | ||
119 | install-headers: png.h pngconf.h | |
120 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi | |
121 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi | |
122 | cp png.h pngconf.h $(DI)/$(LIBNAME) | |
123 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h | |
124 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h | |
125 | -@/bin/rm -f $(DI)/libpng | |
126 | (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .) | |
127 | ||
128 | install-static: install-headers libpng.a | |
129 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
130 | cp libpng.a $(DL)/$(LIBNAME).a | |
131 | chmod 644 $(DL)/$(LIBNAME).a | |
132 | -@/bin/rm -f $(DL)/libpng.a | |
133 | (cd $(DL); ln -f -s $(LIBNAME).a libpng.a) | |
134 | ||
135 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc | |
136 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi | |
137 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so | |
138 | -@/bin/rm -f $(DL)/libpng.so | |
139 | -@/bin/rm -f $(DL)/libpng.so.3 | |
140 | -@/bin/rm -f $(DL)/libpng.so.3.* | |
141 | cp $(LIBNAME).so.$(PNGVER) $(DL) | |
142 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) | |
143 | (cd $(DL); \ | |
144 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ | |
145 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \ | |
146 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \ | |
147 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ | |
148 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) | |
149 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi | |
150 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc | |
151 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc | |
152 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc | |
153 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc | |
154 | (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc) | |
155 | ||
156 | install-man: libpng.3 libpngpf.3 png.5 | |
157 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi | |
158 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi | |
159 | -@/bin/rm -f $(DM)/man3/libpng.3 | |
160 | -@/bin/rm -f $(DM)/man3/libpngpf.3 | |
161 | cp libpng.3 $(DM)/man3 | |
162 | cp libpngpf.3 $(DM)/man3 | |
163 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi | |
164 | -@/bin/rm -f $(DM)/man5/png.5 | |
165 | cp png.5 $(DM)/man5 | |
166 | ||
167 | install-config: libpng-config | |
168 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi | |
169 | -@/bin/rm -f $(DB)/libpng-config | |
170 | -@/bin/rm -f $(DB)/$(LIBNAME)-config | |
171 | cp libpng-config $(DB)/$(LIBNAME)-config | |
172 | chmod 755 $(DB)/$(LIBNAME)-config | |
173 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) | |
174 | ||
175 | install: install-static install-shared install-man install-config | |
176 | ||
177 | # If you installed in $(DESTDIR), test-installed won't work until you | |
178 | # move the library to its final location. | |
179 | ||
180 | test-installed: | |
181 | echo | |
182 | echo Testing installed dynamic shared library. | |
183 | $(CC) -I$(ZLIBINC) \ | |
184 | `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \ | |
185 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \ | |
186 | -L$(ZLIBLIB) -R$(ZLIBLIB) | |
187 | ./pngtesti pngtest.png | |
188 | ||
189 | clean: | |
190 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \ | |
191 | libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* | |
192 | ||
193 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO | |
194 | writelock: | |
195 | chmod a-w *.[ch35] $(DOCS) scripts/* | |
196 | ||
197 | # DO NOT DELETE THIS LINE -- make depend depends on it. | |
198 | ||
199 | png.o png.pic.o: png.h pngconf.h | |
200 | pngerror.o pngerror.pic.o: png.h pngconf.h | |
201 | pngrio.o pngrio.pic.o: png.h pngconf.h | |
202 | pngwio.o pngwio.pic.o: png.h pngconf.h | |
203 | pngmem.o pngmem.pic.o: png.h pngconf.h | |
204 | pngset.o pngset.pic.o: png.h pngconf.h | |
205 | pngget.o pngget.pic.o: png.h pngconf.h | |
206 | pngread.o pngread.pic.o: png.h pngconf.h | |
207 | pngrtran.o pngrtran.pic.o: png.h pngconf.h | |
208 | pngrutil.o pngrutil.pic.o: png.h pngconf.h | |
209 | pngtrans.o pngtrans.pic.o: png.h pngconf.h | |
210 | pngwrite.o pngwrite.pic.o: png.h pngconf.h | |
211 | pngwtran.o pngwtran.pic.o: png.h pngconf.h | |
212 | pngwutil.o pngwutil.pic.o: png.h pngconf.h | |
213 | pngpread.o pngpread.pic.o: png.h pngconf.h | |
214 | ||
215 | pngtest.o: png.h pngconf.h |