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
9 # gcc 2.95 doesn't work.
12 # Where make install puts libpng.a, libpng.so*, and png.h
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 "..".
20 #ZLIBLIB=/usr/local/lib
21 #ZLIBINC=/usr/local/include
22 #Use the preinstalled zlib that comes with Solaris 9:
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
38 PNGVER = $(PNGMAJ).$(PNGMIN)
41 INCPATH=$(prefix)/include
46 # override DESTDIR= on the make install command line to easily support
47 # installing into a temporary location. Example:
49 # make install DESTDIR=/tmp/build/libpng
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.
56 DB=$(DESTDIR)$(BINPATH)
57 DI=$(DESTDIR)$(INCPATH)
58 DL=$(DESTDIR)$(LIBPATH)
59 DM=$(DESTDIR)$(MANPATH)
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
65 OBJSDLL = $(OBJS:.o=.pic.o)
67 .SUFFIXES: .c .o .pic.o
70 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
72 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
79 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
82 ( cat scripts/libpng-config-head.in; \
83 echo prefix=\"$(prefix)\"; \
84 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
85 echo L_opts=\"-L$(LIBPATH)\"; \
86 echo R_opts=\"-R$(LIBPATH)\"; \
87 echo libs=\"-lpng12 -lz -lm\"; \
88 cat scripts/libpng-config-body.in ) > libpng-config
89 chmod +x libpng-config
91 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
92 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
94 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
95 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
97 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
98 @case "`type ld`" in *ucb*) \
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.'; \
110 $(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
111 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
113 libpng.so.3.$(PNGMIN): $(OBJS)
114 $(LD) -G -h libpng.so.3 \
115 -o libpng.so.3.$(PNGMIN) $(OBJSDLL)
117 pngtest: pngtest.o $(LIBNAME).so
118 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
123 install-headers: png.h pngconf.h
124 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
125 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
126 cp png.h pngconf.h $(DI)/$(LIBNAME)
127 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
128 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
129 -@/bin/rm -f $(DI)/libpng
130 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
132 install-static: install-headers libpng.a
133 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
134 cp libpng.a $(DL)/$(LIBNAME).a
135 chmod 644 $(DL)/$(LIBNAME).a
136 -@/bin/rm -f $(DL)/libpng.a
137 (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
139 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
140 libpng.so.3.$(PNGMIN)
141 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
142 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
143 -@/bin/rm -f $(DL)/libpng.so
144 -@/bin/rm -f $(DL)/libpng.so.3
145 -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
146 cp $(LIBNAME).so.$(PNGVER) $(DL)
147 cp libpng.so.3.$(PNGMIN) $(DL)
148 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
149 chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
151 ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
152 ln -f -s libpng.so.3 libpng.so; \
153 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
154 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
155 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
156 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
157 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
158 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
159 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
160 (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
162 install-man: libpng.3 libpngpf.3 png.5
163 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
164 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
165 -@/bin/rm -f $(DM)/man3/libpng.3
166 -@/bin/rm -f $(DM)/man3/libpngpf.3
167 cp libpng.3 $(DM)/man3
168 cp libpngpf.3 $(DM)/man3
169 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
170 -@/bin/rm -f $(DM)/man5/png.5
173 install-config: libpng-config
174 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
175 -@/bin/rm -f $(DB)/libpng-config
176 -@/bin/rm -f $(DB)/$(LIBNAME)-config
177 cp libpng-config $(DB)/$(LIBNAME)-config
178 chmod 755 $(DB)/$(LIBNAME)-config
179 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
181 install: install-static install-shared install-man install-config
183 # If you installed in $(DESTDIR), test-installed won't work until you
184 # move the library to its final location.
188 echo Testing installed dynamic shared library.
190 `$(BINPATH)/libpng12-config --cflags` pngtest.c \
191 -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
192 -L$(ZLIBLIB) -R$(ZLIBLIB)
193 ./pngtesti pngtest.png
196 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
197 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
198 libpng.so.3.$(PNGMIN) \
201 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
203 chmod a-w *.[ch35] $(DOCS) scripts/*
205 # DO NOT DELETE THIS LINE -- make depend depends on it.
207 png.o png.pic.o: png.h pngconf.h
208 pngerror.o pngerror.pic.o: png.h pngconf.h
209 pngrio.o pngrio.pic.o: png.h pngconf.h
210 pngwio.o pngwio.pic.o: png.h pngconf.h
211 pngmem.o pngmem.pic.o: png.h pngconf.h
212 pngset.o pngset.pic.o: png.h pngconf.h
213 pngget.o pngget.pic.o: png.h pngconf.h
214 pngread.o pngread.pic.o: png.h pngconf.h
215 pngrtran.o pngrtran.pic.o: png.h pngconf.h
216 pngrutil.o pngrutil.pic.o: png.h pngconf.h
217 pngtrans.o pngtrans.pic.o: png.h pngconf.h
218 pngwrite.o pngwrite.pic.o: png.h pngconf.h
219 pngwtran.o pngwtran.pic.o: png.h pngconf.h
220 pngwutil.o pngwutil.pic.o: png.h pngconf.h
221 pngpread.o pngpread.pic.o: png.h pngconf.h
223 pngtest.o: png.h pngconf.h