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