makefile.so9 8.1 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 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 = 15
LIBNAME = libpng15
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 29
LN_SF=ln -f -s
RANLIB=echo
RM_F=/bin/rm -f
30

31
# Where make install puts libpng.a, $(OLDSO)*, and png.h
32
prefix=/usr/local
33
exec_prefix=$(prefix)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

# 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
49 50
#CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
51
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng15 -lz -lm
52 53

INCPATH=$(prefix)/include
54
LIBPATH=$(exec_prefix)/lib
55
MANPATH=$(prefix)/man
56
BINPATH=$(exec_prefix)/bin
57 58 59 60 61 62 63

# 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
64
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
65 66
# you execute make install.
DESTDIR=
67

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

73 74 75 76 77 78 79 80 81 82 83
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

.c.pic.o:
	$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c

84
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
85

86
# see scripts/pnglibconf.mak for more options
87 88
pnglibconf.h: scripts/pnglibconf.h.prebuilt
	cp scripts/pnglibconf.h.prebuilt $@
89

90
libpng.a: $(OBJS)
91
	$(AR_RC) $@ $(OBJS)
92 93
	$(RANLIB) $@

94
libpng.pc:
95 96 97 98
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
	-e s!@includedir@!$(INCPATH)! \
99
	-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc
100

101 102 103
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
104 105 106
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
	echo L_opts=\"-L$(LIBPATH)\"; \
	echo R_opts=\"-R$(LIBPATH)\"; \
107
	echo libs=\"-lpng15 -lz -lm\"; \
108 109 110
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

111 112
$(LIBSO): $(LIBSOMAJ)
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
113

114
$(LIBSOMAJ): $(OBJSDLL)
115 116 117 118 119 120 121 122 123 124 125 126
	@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
127
	$(LD) -G -h $(LIBSOMAJ) \
128
	 -o $(LIBSOMAJ) $(OBJSDLL)
129

130
pngtest: pngtest.o $(LIBSO)
131 132 133 134 135
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
	./pngtest

136
install-headers: png.h pngconf.h pnglibconf.h
137 138
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
139 140 141
	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
142 143
	-@$(RM_F) $(DI)/libpng
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
144 145

install-static: install-headers libpng.a
146
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
147 148
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
149 150
	-@$(RM_F) $(DL)/libpng.a
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
151

152
install-shared: install-headers $(LIBSOMAJ) libpng.pc
153
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
154 155
	-@$(RM_F) $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOREL)
156
	-@$(RM_F) $(DL)/$(OLDSO)
157 158
	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
	chmod 755 $(DL)/$(LIBSOREL)
159
	(cd $(DL); \
160 161
	$(LN_SF) $(LIBSOREL) $(LIBSO); \
	$(LN_SF) $(LIBSO) $(OLDSO))
162
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
163 164
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
165 166
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
167
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
168 169

install-man: libpng.3 libpngpf.3 png.5
170 171
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
172 173
	-@$(RM_F) $(DM)/man3/libpng.3
	-@$(RM_F) $(DM)/man3/libpngpf.3
174 175
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
176
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
177
	-@$(RM_F) $(DM)/man5/png.5
178
	cp png.5 $(DM)/man5
179

180
install-config: libpng-config
181
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
182 183
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
184 185
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
186
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
187 188

install: install-static install-shared install-man install-config
189

190
# If you installed in $(DESTDIR), test-installed won't work until you
191 192 193 194 195 196 197
# 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).
	$(CC) -I$(DI) -I$(ZLIBINC) \
198 199
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
200 201
	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL)
	./pngtestd pngtest.png
202 203 204 205 206

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) -I$(ZLIBINC) \
207 208
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
209
	   -L$(ZLIBLIB) -R$(ZLIBLIB)
210
	./pngtesti pngtest.png
211 212

clean:
213
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
214
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
215
	libpng.pc pnglibconf.h
216 217 218 219 220 221 222

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.

223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
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

pngtest.o: png.h pngconf.h pnglibconf.h