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-2014 Glenn Randers-Pehrson
|
---|
5 | # Copyright (C) 1998-2001 Greg Roelofs
|
---|
6 | # Copyright (C) 1996-1997 Andreas Dilger
|
---|
7 | #
|
---|
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
|
---|
11 |
|
---|
12 | # Library name:
|
---|
13 | PNGMAJ = 16
|
---|
14 | LIBNAME = libpng16
|
---|
15 |
|
---|
16 | # Shared library names:
|
---|
17 | LIBSO=$(LIBNAME).so
|
---|
18 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
---|
19 | LIBSOREL=$(LIBSOMAJ).$(RELEASE)
|
---|
20 | OLDSO=libpng.so
|
---|
21 |
|
---|
22 | # Utilities:
|
---|
23 | # gcc 2.95 doesn't work.
|
---|
24 | CC=cc
|
---|
25 | AR_RC=ar rc
|
---|
26 | MKDIR_P=mkdir -p
|
---|
27 | LN_SF=ln -f -s
|
---|
28 | RANLIB=echo
|
---|
29 | CP=cp
|
---|
30 | RM_F=/bin/rm -f
|
---|
31 |
|
---|
32 | # Where make install puts libpng.a, $(OLDSO)*, and png.h
|
---|
33 | prefix=/usr/local
|
---|
34 | exec_prefix=$(prefix)
|
---|
35 |
|
---|
36 | # Where the zlib library and include files are located
|
---|
37 | # Changing these to ../zlib poses a security risk. If you want
|
---|
38 | # to have zlib in an adjacent directory, specify the full path instead of "..".
|
---|
39 | #ZLIBLIB=../zlib
|
---|
40 | #ZLIBINC=../zlib
|
---|
41 | #ZLIBLIB=/usr/local/lib
|
---|
42 | #ZLIBINC=/usr/local/include
|
---|
43 | #Use the preinstalled zlib that comes with Solaris 9:
|
---|
44 | ZLIBLIB=/usr/lib
|
---|
45 | ZLIBINC=/usr/include
|
---|
46 |
|
---|
47 | #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
---|
48 | -Wmissing-declarations -Wtraditional -Wcast-align \
|
---|
49 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
---|
50 | CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
---|
51 | #CFLAGS=-W -Wall -O3 $(WARNMORE) -g
|
---|
52 | CFLAGS=-O3
|
---|
53 | LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
---|
54 |
|
---|
55 | INCPATH=$(prefix)/include
|
---|
56 | LIBPATH=$(exec_prefix)/lib
|
---|
57 | MANPATH=$(prefix)/man
|
---|
58 | BINPATH=$(exec_prefix)/bin
|
---|
59 |
|
---|
60 | # override DESTDIR= on the make install command line to easily support
|
---|
61 | # installing into a temporary location. Example:
|
---|
62 | #
|
---|
63 | # make install DESTDIR=/tmp/build/libpng
|
---|
64 | #
|
---|
65 | # If you're going to install into a temporary location
|
---|
66 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
---|
67 | # you execute make install.
|
---|
68 | DESTDIR=
|
---|
69 |
|
---|
70 | DB=$(DESTDIR)$(BINPATH)
|
---|
71 | DI=$(DESTDIR)$(INCPATH)
|
---|
72 | DL=$(DESTDIR)$(LIBPATH)
|
---|
73 | DM=$(DESTDIR)$(MANPATH)
|
---|
74 |
|
---|
75 | # Pre-built configuration
|
---|
76 | # See scripts/pnglibconf.mak for more options
|
---|
77 | PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
---|
78 |
|
---|
79 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
---|
80 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
---|
81 | pngwtran.o pngmem.o pngerror.o pngpread.o
|
---|
82 |
|
---|
83 | OBJSDLL = $(OBJS:.o=.pic.o)
|
---|
84 |
|
---|
85 | .SUFFIXES: .c .o .pic.o
|
---|
86 |
|
---|
87 | .c.o:
|
---|
88 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
---|
89 |
|
---|
90 | .c.pic.o:
|
---|
91 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
---|
92 |
|
---|
93 | all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
---|
94 |
|
---|
95 | pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
---|
96 | $(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
---|
97 |
|
---|
98 | libpng.a: $(OBJS)
|
---|
99 | $(AR_RC) $@ $(OBJS)
|
---|
100 | $(RANLIB) $@
|
---|
101 |
|
---|
102 | libpng.pc:
|
---|
103 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
|
---|
104 | -e s!@exec_prefix@!$(exec_prefix)! \
|
---|
105 | -e s!@libdir@!$(LIBPATH)! \
|
---|
106 | -e s!@includedir@!$(INCPATH)! \
|
---|
107 | -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
|
---|
108 |
|
---|
109 | libpng-config:
|
---|
110 | ( cat scripts/libpng-config-head.in; \
|
---|
111 | echo prefix=\"$(prefix)\"; \
|
---|
112 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
---|
113 | echo L_opts=\"-L$(LIBPATH)\"; \
|
---|
114 | echo R_opts=\"-R$(LIBPATH)\"; \
|
---|
115 | echo libs=\"-lpng16 -lz -lm\"; \
|
---|
116 | cat scripts/libpng-config-body.in ) > libpng-config
|
---|
117 | chmod +x libpng-config
|
---|
118 |
|
---|
119 | $(LIBSO): $(LIBSOMAJ)
|
---|
120 | $(LN_SF) $(LIBSOMAJ) $(LIBSO)
|
---|
121 |
|
---|
122 | $(LIBSOMAJ): $(OBJSDLL)
|
---|
123 | @case "`type ld`" in *ucb*) \
|
---|
124 | echo; \
|
---|
125 | echo '## WARNING:'; \
|
---|
126 | echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
|
---|
127 | echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
|
---|
128 | echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
|
---|
129 | echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
|
---|
130 | echo '## at all. If it is, things are likely to break because of'; \
|
---|
131 | echo '## the libucb dependency that is created.'; \
|
---|
132 | echo; \
|
---|
133 | ;; \
|
---|
134 | esac
|
---|
135 | $(LD) -G -h $(LIBSOMAJ) \
|
---|
136 | -o $(LIBSOMAJ) $(OBJSDLL)
|
---|
137 |
|
---|
138 | pngtest: pngtest.o $(LIBSO)
|
---|
139 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
---|
140 |
|
---|
141 | test: pngtest
|
---|
142 | ./pngtest
|
---|
143 |
|
---|
144 | install-headers: png.h pngconf.h pnglibconf.h
|
---|
145 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
---|
146 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
---|
147 | cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
|
---|
148 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
|
---|
149 | -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
|
---|
150 | -@$(RM_F) $(DI)/libpng
|
---|
151 | (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
---|
152 |
|
---|
153 | install-static: install-headers libpng.a
|
---|
154 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
---|
155 | cp libpng.a $(DL)/$(LIBNAME).a
|
---|
156 | chmod 644 $(DL)/$(LIBNAME).a
|
---|
157 | -@$(RM_F) $(DL)/libpng.a
|
---|
158 | (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
---|
159 |
|
---|
160 | install-shared: install-headers $(LIBSOMAJ) libpng.pc
|
---|
161 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
---|
162 | -@$(RM_F) $(DL)/$(LIBSO)
|
---|
163 | -@$(RM_F) $(DL)/$(LIBSOREL)
|
---|
164 | -@$(RM_F) $(DL)/$(OLDSO)
|
---|
165 | cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
|
---|
166 | chmod 755 $(DL)/$(LIBSOREL)
|
---|
167 | (cd $(DL); \
|
---|
168 | $(LN_SF) $(LIBSOREL) $(LIBSO); \
|
---|
169 | $(LN_SF) $(LIBSO) $(OLDSO))
|
---|
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) $(CPPFLAGS) \
|
---|
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) $(CPPFLAGS) \
|
---|
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 | libpng.pc pnglibconf.h
|
---|
224 |
|
---|
225 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO
|
---|
226 | writelock:
|
---|
227 | chmod a-w *.[ch35] $(DOCS) scripts/*
|
---|
228 |
|
---|
229 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
---|
230 |
|
---|
231 | png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
232 | pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
233 | pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
234 | pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
235 | pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
236 | pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
237 | pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
238 | pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
239 | pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
240 | pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
241 | pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
242 | pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
243 | pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
244 | pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
245 | pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
246 |
|
---|
247 | pngtest.o: png.h pngconf.h pnglibconf.h
|
---|