makefile.so9 7.0 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 Glenn Randers-Pehrson
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# Copyright (C) 1998-2001 Greg Roelofs
# Copyright (C) 1996-1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h

# gcc 2.95 doesn't work.
CC=cc

# Where make install puts libpng.a, libpng.so*, and png.h
prefix=/usr/local

# 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
#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5
CFLAGS=-I$(ZLIBINC) -O3
31
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
32 33 34 35

#RANLIB=ranlib
RANLIB=echo

36
PNGMAJ = 0
37
PNGMIN = 1.2.5rc2
38
PNGVER = $(PNGMAJ).$(PNGMIN)
39
LIBNAME = libpng12
40 41 42

INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
43
MANPATH=$(prefix)/man
44
BINPATH=$(prefix)/bin
45 46 47 48 49 50 51

# 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
52
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
53 54
# you execute make install.
DESTDIR=
55

56 57 58 59
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
60

61 62 63 64 65 66 67 68 69 70 71
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

72
all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
73 74 75 76 77

libpng.a: $(OBJS)
	ar rc $@ $(OBJS)
	$(RANLIB) $@

78 79 80
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

81 82 83
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
84
	echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
85 86 87 88 89 90
	echo cflags=\"\"; \
	echo ldflags=\"-L$(LIBPATH) -R$(LIBPATH)\"; \
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

91 92
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
93

94 95
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
96

97
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
98 99 100 101 102 103 104 105 106 107 108 109
	@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
110 111
	$(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
112

113
libpng.so.3.$(PNGMIN): $(OBJS)
114 115
	$(LD) -G -h libpng.so.3 \
	 -o libpng.so.3.$(PNGMIN) $(OBJSDLL)
116

117
pngtest: pngtest.o $(LIBNAME).so
118 119 120 121 122
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
	./pngtest

123
install-headers: png.h pngconf.h
124 125 126
	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
	cp png.h pngconf.h $(DI)/$(LIBNAME)
127
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
128 129
	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
	-@/bin/rm -f $(DI)/libpng
130
	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
131 132

install-static: install-headers libpng.a
133 134 135 136
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
	-@/bin/rm -f $(DL)/libpng.a
137
	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
138

139 140
install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
	libpng.so.3.$(PNGMIN)
141
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
142
	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
143 144
	-@/bin/rm -f $(DL)/libpng.so
	-@/bin/rm -f $(DL)/libpng.so.3
145
	-@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
146
	cp $(LIBNAME).so.$(PNGVER) $(DL)
147
	cp libpng.so.3.$(PNGMIN) $(DL)
148
	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
149
	chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
150
	(cd $(DL); \
151
	ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
152
	ln -f -s libpng.so.3 libpng.so; \
153 154
	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
155
	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
156 157 158 159 160
	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
	(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
161 162

install-man: libpng.3 libpngpf.3 png.5
163 164 165 166 167 168 169 170 171
	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
	-@/bin/rm -f $(DM)/man3/libpng.3
	-@/bin/rm -f $(DM)/man3/libpngpf.3
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
	-@/bin/rm -f $(DM)/man5/png.5
	cp png.5 $(DM)/man5
172

173
install-config: libpng-config
174 175 176 177 178 179
	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
	-@/bin/rm -f $(DB)/libpng-config
	-@/bin/rm -f $(DB)/$(LIBNAME)-config
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
180 181

install: install-static install-shared install-man install-config
182

183 184 185 186 187 188 189 190 191 192
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location.

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) -I$(ZLIBINC) \
	   `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
	   -L$(ZLIBLIB) -R$(ZLIBLIB)
193
	./pngtesti pngtest.png
194 195

clean:
196
	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
197
	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
198 199
	libpng.so.3.$(PNGMIN) \
	libpng.pc
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223

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.

png.o png.pic.o: png.h pngconf.h
pngerror.o pngerror.pic.o: png.h pngconf.h
pngrio.o pngrio.pic.o: png.h pngconf.h
pngwio.o pngwio.pic.o: png.h pngconf.h
pngmem.o pngmem.pic.o: png.h pngconf.h
pngset.o pngset.pic.o: png.h pngconf.h
pngget.o pngget.pic.o: png.h pngconf.h
pngread.o pngread.pic.o: png.h pngconf.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h
pngpread.o pngpread.pic.o: png.h pngconf.h

pngtest.o: png.h pngconf.h