]> git.saurik.com Git - wxWidgets.git/blob - src/png/scripts/makefile.solaris-x86
Add a system option to exit immediately on assert failure.
[wxWidgets.git] / src / png / scripts / makefile.solaris-x86
1 # makefile for libpng on Solaris 2.x with gcc
2 # Copyright (C) 2004, 2006-2008 Glenn Randers-Pehrson
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:
9 LIBNAME = libpng12
10 PNGMAJ = 0
11 PNGMIN = 1.2.34
12 PNGVER = $(PNGMAJ).$(PNGMIN)
13
14 # Shared library names:
15 LIBSO=$(LIBNAME).so
16 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
17 LIBSOVER=$(LIBNAME).so.$(PNGVER)
18 OLDSO=libpng.so
19 OLDSOMAJ=libpng.so.3
20 OLDSOVER=libpng.so.3.$(PNGMIN)
21
22 # Utilities:
23 AR_RC=ar rc
24 CC=gcc
25 MKDIR_P=mkdir -p
26 LN_SF=ln -f -s
27 RANLIB=echo
28 RM_F=/bin/rm -f
29
30 # Where make install puts libpng.a, libpng12.so*, and png.h
31 prefix=/usr/local
32 exec_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
40 ZLIBLIB=/usr/local/lib
41 ZLIBINC=/usr/local/include
42
43 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
44 -Wmissing-declarations -Wtraditional -Wcast-align \
45 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
46 CFLAGS=-I$(ZLIBINC) -W -Wall -O \
47 # $(WARNMORE) -g -DPNG_DEBUG=5
48 LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
49
50 INCPATH=$(prefix)/include
51 LIBPATH=$(exec_prefix)/lib
52 MANPATH=$(prefix)/man
53 BINPATH=$(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.
63 DESTDIR=
64
65 DB=$(DESTDIR)$(BINPATH)
66 DI=$(DESTDIR)$(INCPATH)
67 DL=$(DESTDIR)$(LIBPATH)
68 DM=$(DESTDIR)$(MANPATH)
69
70 OBJS = 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
74 OBJSDLL = $(OBJS:.o=.pic.o)
75
76 .SUFFIXES: .c .o .pic.o
77
78 .c.pic.o:
79 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
80
81 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
82
83 libpng.a: $(OBJS)
84 $(AR_RC) $@ $(OBJS)
85 $(RANLIB) $@
86
87 libpng.pc:
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
93
94 libpng-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
131 pngtest: pngtest.o $(LIBSO)
132 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
133
134 test: pngtest
135 ./pngtest
136
137 install-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
146 install-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
153 install-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
177 install-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
188 install-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
196 install: 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
202 test-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
211 test-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
220 clean:
221 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
222 libpng-config $(LIBSO) $(LIBSOMAJ)* \
223 $(OLDSOVER) \
224 libpng.pc
225
226 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
227 writelock:
228 chmod a-w *.[ch35] $(DOCS) scripts/*
229
230 # DO NOT DELETE THIS LINE -- make depend depends on it.
231
232 png.o png.pic.o: png.h pngconf.h
233 pngerror.o pngerror.pic.o: png.h pngconf.h
234 pngrio.o pngrio.pic.o: png.h pngconf.h
235 pngwio.o pngwio.pic.o: png.h pngconf.h
236 pngmem.o pngmem.pic.o: png.h pngconf.h
237 pngset.o pngset.pic.o: png.h pngconf.h
238 pngget.o pngget.pic.o: png.h pngconf.h
239 pngread.o pngread.pic.o: png.h pngconf.h
240 pngrtran.o pngrtran.pic.o: png.h pngconf.h
241 pngrutil.o pngrutil.pic.o: png.h pngconf.h
242 pngtrans.o pngtrans.pic.o: png.h pngconf.h
243 pngwrite.o pngwrite.pic.o: png.h pngconf.h
244 pngwtran.o pngwtran.pic.o: png.h pngconf.h
245 pngwutil.o pngwutil.pic.o: png.h pngconf.h
246 pngpread.o pngpread.pic.o: png.h pngconf.h
247
248 pngtest.o: png.h pngconf.h