makefile.so9 8.2 KB
Newer Older
1 2 3
# makefile for libpng on Solaris 9 (beta) with Forte cc
# Updated by Chad Schrock for Solaris 9
# Contributed by William L. Sebok, based on makefile.linux
4
# Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
5 6
# Copyright (C) 1998-2001 Greg Roelofs
# 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 14
PNGMAJ = 16
LIBNAME = libpng16
15 16 17 18

# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
19
LIBSOREL=$(LIBSOMAJ).$(RELEASE)
20 21 22
OLDSO=libpng.so

# Utilities:
23 24
# gcc 2.95 doesn't work.
CC=cc
25
AR_RC=ar rc
26
MKDIR_P=mkdir -p
27 28
LN_SF=ln -f -s
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 37 38 39 40 41 42 43 44 45 46 47 48 49

# Where the zlib library and include files are located
# Changing these to ../zlib poses a security risk.  If you want
# to have zlib in an adjacent directory, specify the full path instead of "..".
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
#Use the preinstalled zlib that comes with Solaris 9:
ZLIBLIB=/usr/lib
ZLIBINC=/usr/include

#WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
	-Wmissing-declarations -Wtraditional -Wcast-align \
	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
50 51 52
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
#CFLAGS=-W -Wall -O3 $(WARNMORE) -g
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 61 62 63 64 65

# override DESTDIR= on the make install command line to easily support
# installing into a temporary location.  Example:
#
#    make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
66
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
67 68
# you execute make install.
DESTDIR=
69

70 71 72 73
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
74

75 76 77 78
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt

79 80 81 82 83 84 85 86
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o

OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

87 88 89
.c.o:
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<

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 96
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
	$(CP) $< $@
97

98
libpng.a: $(OBJS)
99
	$(AR_RC) $@ $(OBJS)
100 101
	$(RANLIB) $@

102
libpng.pc:
103 104 105 106
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
	-e s!@includedir@!$(INCPATH)! \
107
	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
108

109 110 111
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
112 113 114
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
	echo L_opts=\"-L$(LIBPATH)\"; \
	echo R_opts=\"-R$(LIBPATH)\"; \
115
	echo libs=\"-lpng16 -lz -lm\"; \
116 117 118
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

119 120
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
121

122
$(LIBSOMAJ): $(OBJSDLL)
123 124 125 126 127 128 129 130 131 132 133 134
	@case "`type ld`" in *ucb*) \
	echo; \
	echo '## WARNING:'; \
	echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
	echo '## and /usr/ucb/ld.  If they do, you need to adjust your PATH'; \
	echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
	echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
	echo '## at all.  If it is, things are likely to break because of'; \
	echo '## the libucb dependency that is created.'; \
	echo; \
	;; \
	esac
135
	$(LD) -G -h $(LIBSOMAJ) \
136
	 -o $(LIBSOMAJ) $(OBJSDLL)
137

138
pngtest: pngtest.o $(LIBSO)
139 140 141 142 143
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
	./pngtest

144
install-headers: png.h pngconf.h pnglibconf.h
145 146
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
147 148 149
	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
150 151
	-@$(RM_F) $(DI)/libpng
	(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 156
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
157 158
	-@$(RM_F) $(DL)/libpng.a
	(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 163
	-@$(RM_F) $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOREL)
164
	-@$(RM_F) $(DL)/$(OLDSO)
165 166
	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
	chmod 755 $(DL)/$(LIBSOREL)
167
	(cd $(DL); \
168 169
	$(LN_SF) $(LIBSOREL) $(LIBSO); \
	$(LN_SF) $(LIBSO) $(OLDSO))
170
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
171 172
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
173 174
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	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 179
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
180 181
	-@$(RM_F) $(DM)/man3/libpng.3
	-@$(RM_F) $(DM)/man3/libpngpf.3
182 183
	cp libpng.3 $(DM)/man3
	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 191
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
192 193
	cp libpng-config $(DB)/$(LIBNAME)-config
	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 200 201 202 203 204
# move the library to its final location.  Use test-dd to test it
# before then.

test-dd:
	echo
	echo Testing installed dynamic shared library in $(DL).
205
	$(CC) -I$(DI) $(CPPFLAGS) \
206 207
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
208 209
	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL)
	./pngtestd pngtest.png
210 211 212 213

test-installed:
	echo
	echo Testing installed dynamic shared library.
214
	$(CC) $(CPPFLAGS) \
215 216
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -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 226 227 228 229 230

DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

# DO NOT DELETE THIS LINE -- make depend depends on it.

231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
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