makefile.so9 7.7 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 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
PNGMAJ = 14
14
PNGMIN = 1.4.0beta90
15
PNGVER = $(PNGMAJ).$(PNGMIN)
16
LIBNAME = libpng14
17 18 19 20 21 22

# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOVER=$(LIBNAME).so.$(PNGVER)
OLDSO=libpng.so
23 24
OLDSOMAJ=libpng.so.14
OLDSOVER=libpng.so.14.$(PNGMIN)
25 26

# Utilities:
27 28
# gcc 2.95 doesn't work.
CC=cc
29
AR_RC=ar rc
30
MKDIR_P=mkdir -p
31 32 33
LN_SF=ln -f -s
RANLIB=echo
RM_F=/bin/rm -f
34

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

# 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
53 54
#CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
55
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng14 -lz -lm
56 57

INCPATH=$(prefix)/include
58
LIBPATH=$(exec_prefix)/lib
59
MANPATH=$(prefix)/man
60
BINPATH=$(exec_prefix)/bin
61 62 63 64 65 66 67

# 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
68
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
69 70
# you execute make install.
DESTDIR=
71

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

77 78 79 80 81 82 83 84 85 86 87
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

88
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
89 90

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

94
libpng.pc:
95 96 97 98 99
	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
	-e s!@exec_prefix@!$(exec_prefix)! \
	-e s!@libdir@!$(LIBPATH)! \
	-e s!@includedir@!$(INCPATH)! \
	-e s!-lpng14!-lpng14\ -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=\"-lpng14 -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 115
$(LIBSOMAJ): $(LIBSOVER)
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
116

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

133 134 135 136
$(OLDSOVER): $(OBJS)
	$(LD) -G -h $(OLDSOMAJ) \
	 -o $(OLDSOVER) $(OBJSDLL)

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

test: pngtest
	./pngtest

143
install-headers: png.h pngconf.h
144 145
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
146
	cp png.h pngconf.h $(DI)/$(LIBNAME)
147
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
148
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
149 150
	-@$(RM_F) $(DI)/libpng
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
151 152

install-static: install-headers libpng.a
153
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
154 155
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
156 157
	-@$(RM_F) $(DL)/libpng.a
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
158

159 160
install-shared: install-headers $(LIBSOVER) libpng.pc \
	$(OLDSOVER)
161
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
162 163 164
	-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSO)
165 166
	-@$(RM_F) $(DL)/$(OLDSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSOVER)*
167
	cp $(LIBSOVER) $(DL)
168
	cp $(OLDSOVER) $(DL)
169
	chmod 755 $(DL)/$(LIBSOVER)
170
	chmod 755 $(DL)/$(OLDSOVER)
171
	(cd $(DL); \
172 173
	$(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
	$(LN_SF) $(OLDSOMAJ) $(OLDSO); \
174
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
175
	$(LN_SF) $(LIBSOMAJ) $(LIBSO))
176
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
177 178
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
179 180
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
181
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
182 183

install-man: libpng.3 libpngpf.3 png.5
184 185
	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
186 187
	-@$(RM_F) $(DM)/man3/libpng.3
	-@$(RM_F) $(DM)/man3/libpngpf.3
188 189
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
190
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
191
	-@$(RM_F) $(DM)/man5/png.5
192
	cp png.5 $(DM)/man5
193

194
install-config: libpng-config
195
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
196 197
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
198 199
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
200
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
201 202

install: install-static install-shared install-man install-config
203

204
# If you installed in $(DESTDIR), test-installed won't work until you
205 206 207 208 209 210 211
# 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) \
212 213
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
214 215
	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL)
	./pngtestd pngtest.png
216 217 218 219 220

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) -I$(ZLIBINC) \
221 222
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
223
	   -L$(ZLIBLIB) -R$(ZLIBLIB)
224
	./pngtesti pngtest.png
225 226

clean:
227
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
228
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
229 230
	$(OLDSOVER) \
	libpng.pc
231 232 233 234 235 236 237

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.

238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
png.o png.pic.o: png.h pngconf.h pngpriv.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h

pngtest.o: png.h pngconf.h pngpriv.h