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