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, 2008, 2010 Glenn Randers-Pehrson
5 # Copyright (C) 1998-2001 Greg Roelofs
6 # Copyright (C) 1996-1997 Andreas Dilger
8 # This code is released under the libpng license.
9 # For conditions of distribution and use, see the disclaimer
10 # and license in png.h
16 # Shared library names:
18 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
19 LIBSOREL=$(LIBSOMAJ).$(RELEASE)
23 # gcc 2.95 doesn't work.
31 # Where make install puts libpng.a, $(OLDSO)*, and png.h
35 # Where the zlib library and include files are located
36 # Changing these to ../zlib poses a security risk. If you want
37 # to have zlib in an adjacent directory, specify the full path instead of "..".
40 #ZLIBLIB=/usr/local/lib
41 #ZLIBINC=/usr/local/include
42 #Use the preinstalled zlib that comes with Solaris 9:
46 #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
47 -Wmissing-declarations -Wtraditional -Wcast-align \
48 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
49 #CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
50 CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
51 LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng14 -lz -lm
53 INCPATH=$(prefix)/include
54 LIBPATH=$(exec_prefix)/lib
56 BINPATH=$(exec_prefix)/bin
58 # override DESTDIR= on the make install command line to easily support
59 # installing into a temporary location. Example:
61 # make install DESTDIR=/tmp/build/libpng
63 # If you're going to install into a temporary location
64 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
65 # you execute make install.
68 DB=$(DESTDIR)$(BINPATH)
69 DI=$(DESTDIR)$(INCPATH)
70 DL=$(DESTDIR)$(LIBPATH)
71 DM=$(DESTDIR)$(MANPATH)
73 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
74 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
75 pngwtran.o pngmem.o pngerror.o pngpread.o
77 OBJSDLL = $(OBJS:.o=.pic.o)
79 .SUFFIXES: .c .o .pic.o
82 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
84 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
91 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
92 -e s!@exec_prefix@!$(exec_prefix)! \
93 -e s!@libdir@!$(LIBPATH)! \
94 -e s!@includedir@!$(INCPATH)! \
95 -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
98 ( cat scripts/libpng-config-head.in; \
99 echo prefix=\"$(prefix)\"; \
100 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
101 echo L_opts=\"-L$(LIBPATH)\"; \
102 echo R_opts=\"-R$(LIBPATH)\"; \
103 echo libs=\"-lpng14 -lz -lm\"; \
104 cat scripts/libpng-config-body.in ) > libpng-config
105 chmod +x libpng-config
107 $(LIBSO): $(LIBSOMAJ)
108 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
110 $(LIBSOMAJ): $(OBJSDLL)
111 @case "`type ld`" in *ucb*) \
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.'; \
123 $(LD) -G -h $(LIBSOMAJ) \
124 -o $(LIBSOMAJ) $(OBJSDLL)
126 pngtest: pngtest.o $(LIBSO)
127 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
132 install-headers: png.h pngconf.h
133 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
134 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
135 cp png.h pngconf.h $(DI)/$(LIBNAME)
136 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
137 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
138 -@$(RM_F) $(DI)/libpng
139 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
141 install-static: install-headers libpng.a
142 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
143 cp libpng.a $(DL)/$(LIBNAME).a
144 chmod 644 $(DL)/$(LIBNAME).a
145 -@$(RM_F) $(DL)/libpng.a
146 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
148 install-shared: install-headers $(LIBSOMAJ) libpng.pc
149 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
150 -@$(RM_F) $(DL)/$(LIBSO)
151 -@$(RM_F) $(DL)/$(LIBSOREL)
152 -@$(RM_F) $(DL)/$(OLDSO)
153 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
154 chmod 755 $(DL)/$(LIBSOREL)
156 $(LN_SF) $(LIBSOREL) $(LIBSO); \
157 $(LN_SF) $(LIBSO) $(OLDSO))
158 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
159 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
160 -@$(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_SF) $(LIBNAME).pc libpng.pc)
165 install-man: libpng.3 libpngpf.3 png.5
166 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
167 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
168 -@$(RM_F) $(DM)/man3/libpng.3
169 -@$(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_P) $(DM)/man5; fi
173 -@$(RM_F) $(DM)/man5/png.5
176 install-config: libpng-config
177 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
178 -@$(RM_F) $(DB)/libpng-config
179 -@$(RM_F) $(DB)/$(LIBNAME)-config
180 cp libpng-config $(DB)/$(LIBNAME)-config
181 chmod 755 $(DB)/$(LIBNAME)-config
182 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
184 install: install-static install-shared install-man install-config
186 # If you installed in $(DESTDIR), test-installed won't work until you
187 # move the library to its final location. Use test-dd to test it
192 echo Testing installed dynamic shared library in $(DL).
193 $(CC) -I$(DI) -I$(ZLIBINC) \
194 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
195 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
196 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
197 ./pngtestd pngtest.png
201 echo Testing installed dynamic shared library.
203 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
204 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
205 -L$(ZLIBLIB) -R$(ZLIBLIB)
206 ./pngtesti pngtest.png
209 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
210 libpng-config $(LIBSO) $(LIBSOMAJ)* \
213 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
215 chmod a-w *.[ch35] $(DOCS) scripts/*
217 # DO NOT DELETE THIS LINE -- make depend depends on it.
219 png.o png.pic.o: png.h pngconf.h pngpriv.h
220 pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h
221 pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h
222 pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h
223 pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h
224 pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h
225 pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h
226 pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h
227 pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h
228 pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h
229 pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h
230 pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h
231 pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h
232 pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h
233 pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h
235 pngtest.o: png.h pngconf.h