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