makefile.solaris 7.5 KB
Newer Older
1
# makefile for libpng on Solaris 2.x with gcc
2
# Copyright (C) 2004, 2006-2008 Glenn Randers-Pehrson
3
# Contributed by William L. Sebok, based on makefile.linux
4
# Copyright (C) 1998 Greg Roelofs
5
# Copyright (C) 1996, 1997 Andreas Dilger
6
#
7
# This code is released under the libpng license.
8
# For conditions of distribution and use, see the disclaimer
9
# and license in png.h
G
Guy Schalnat 已提交
10

11
# Library name:
12
LIBNAME = libpng14
13
PNGMAJ = 14
14
PNGMIN = 1.4.0beta98
15 16 17 18 19 20 21
PNGVER = $(PNGMAJ).$(PNGMIN)

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

# Utilities:
26
AR_RC=ar rc
G
Guy Schalnat 已提交
27
CC=gcc
28
MKDIR_P=mkdir -p
29 30 31
LN_SF=ln -f -s
RANLIB=echo
RM_F=/bin/rm -f
A
Andreas Dilger 已提交
32

33
# Where make install puts libpng.a, libpng14.so*, and png.h
34
prefix=/usr/local
35
exec_prefix=$(prefix)
36

A
Andreas Dilger 已提交
37
# Where the zlib library and include files are located
38 39 40 41 42 43 44
# 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
45

A
Andreas Dilger 已提交
46
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
47 48
	-Wmissing-declarations -Wtraditional -Wcast-align \
	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
49
CFLAGS=-DPNG_CONFIGURE_LIBPNG -I$(ZLIBINC) -W -Wall -O \
50
	# $(WARNMORE) -g -DPNG_DEBUG=5
51
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng14 -lz -lm
G
Guy Schalnat 已提交
52

A
Andreas Dilger 已提交
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=
G
Guy Schalnat 已提交
67

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

A
Andreas Dilger 已提交
73
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
74 75
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
G
Guy Schalnat 已提交
76

77 78 79 80 81 82 83
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

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

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

G
Guy Schalnat 已提交
86
libpng.a: $(OBJS)
87
	$(AR_RC) $@ $(OBJS)
G
Guy Schalnat 已提交
88 89
	$(RANLIB) $@

90
libpng.pc:
91 92 93 94 95
	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
96

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

108
$(LIBSO): $(LIBSOMAJ)
109
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
G
Guy Schalnat 已提交
110

111
$(LIBSOMAJ): $(LIBSOVER)
112
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
G
Guy Schalnat 已提交
113

114
$(LIBSOVER): $(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 128
	$(LD) -G -h $(LIBSOMAJ) \
	 -o $(LIBSOVER) $(OBJSDLL)
G
Guy Schalnat 已提交
129

130 131 132 133
$(OLDSOVER): $(OBJS)
	$(LD) -G -h $(OLDSOMAJ) \
	 -o $(OLDSOVER) $(OBJSDLL)

134
pngtest: pngtest.o $(LIBSO)
135
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
G
Guy Schalnat 已提交
136 137 138

test: pngtest
	./pngtest
G
Guy Schalnat 已提交
139

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

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

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

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

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

install: install-static install-shared install-man install-config
G
Guy Schalnat 已提交
200

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

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

G
Guy Schalnat 已提交
223
clean:
224
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
225
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
226 227
	$(OLDSOVER) \
	libpng.pc
G
Guy Schalnat 已提交
228

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

G
Guy Schalnat 已提交
233 234
# DO NOT DELETE THIS LINE -- make depend depends on it.

235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
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

251
pngtest.o: png.h pngconf.h