makefile.solaris 7.4 KB
Newer Older
1
# makefile for libpng on Solaris 2.x with gcc
2
# Copyright (C) 2004, 2006 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
G
Guy Schalnat 已提交
6 7
# For conditions of distribution and use, see copyright notice in png.h

8
# Library name:
9
LIBNAME = libpng14
10
PNGMAJ = 1
11
PNGMIN = 1.4.0beta7
12 13 14 15 16 17 18 19 20
PNGVER = $(PNGMAJ).$(PNGMIN)

# Shared library names:
LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOVER=$(LIBNAME).so.$(PNGVER)
OLDSO=libpng.so

# Utilities:
21
AR_RC=ar rc
G
Guy Schalnat 已提交
22
CC=gcc
23
MKDIR_P=mkdir -p
24 25 26
LN_SF=ln -f -s
RANLIB=echo
RM_F=/bin/rm -f
A
Andreas Dilger 已提交
27

28
# Where make install puts libpng.a, libpng14.so*, and png.h
29
prefix=/usr/local
30
exec_prefix=$(prefix)
31

A
Andreas Dilger 已提交
32
# Where the zlib library and include files are located
33 34 35 36 37 38 39
# 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
40

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

A
Andreas Dilger 已提交
48
INCPATH=$(prefix)/include
49
LIBPATH=$(exec_prefix)/lib
50
MANPATH=$(prefix)/man
51
BINPATH=$(exec_prefix)/bin
52 53 54 55 56 57 58

# 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
59
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
60 61
# you execute make install.
DESTDIR=
G
Guy Schalnat 已提交
62

63 64 65 66
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
67

A
Andreas Dilger 已提交
68
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
69 70
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
G
Guy Schalnat 已提交
71

72 73 74 75 76 77 78
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

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

79
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
G
Guy Schalnat 已提交
80

81 82 83 84 85 86 87 88
pngconf.h.in:
	cat pngconf.h > pngconf.h.in

pngconf.h:	pngconf.h.in
	sed "/Makefile-supplied defines go here:/q" pngconf.h.in > pngconf.h
	echo "#define PNG_NO_MMX_CODE" >> pngconf.h
	sed "1,/Makefile-supplied defines go here:/d" pngconf.h.in >> pngconf.h

G
Guy Schalnat 已提交
89
libpng.a: $(OBJS)
90
	$(AR_RC) $@ $(OBJS)
G
Guy Schalnat 已提交
91 92
	$(RANLIB) $@

93 94 95
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

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

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

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

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

129
pngtest: pngtest.o $(LIBSO)
130
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
G
Guy Schalnat 已提交
131 132 133

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

135
install-headers: png.h pngconf.h
136 137
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
138
	cp png.h pngconf.h $(DI)/$(LIBNAME)
139
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
140 141
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
	-@$(RM_F) $(DI)/libpng
142
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
143 144

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

151
install-shared: install-headers $(LIBSOVER) libpng.pc
152
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
153 154 155 156 157
	-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSO)
	cp $(LIBSOVER) $(DL)
	chmod 755 $(DL)/$(LIBSOVER)
158
	(cd $(DL); \
159 160 161
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
	$(LN_SF) $(LIBSOMAJ) $(LIBSO); \
	$(LN_SF) $(OLDSO) $(LIBSO))
162 163 164
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
	-@$(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 172 173
	-@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
174 175
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
176 177
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
	-@$(RM_F) $(DM)/man5/png.5
178
	cp png.5 $(DM)/man5
179

180
install-config: libpng-config
181 182 183
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(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
G
Guy Schalnat 已提交
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

G
Guy Schalnat 已提交
212
clean:
213
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
214
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
215
	libpng.pc
G
Guy Schalnat 已提交
216

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

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

223 224 225 226 227 228
png.o png.pic.o: png.h pngconf.h pngintrn.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngintrn.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngintrn.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngintrn.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngintrn.h
pngset.o pngset.pic.o: png.h pngconf.h pngintrn.h
229
pnggccrd.o pnggccrd.pic.o: png.h pngconf.h pngintrn.h
230
pngget.o pngget.pic.o: png.h pngconf.h pngintrn.h
231
pnggccrd.o pngget.pic.o: png.h pngconf.h pngintrn.h
232 233 234 235 236 237 238 239 240 241
pngread.o pngread.pic.o: png.h pngconf.h pngintrn.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngintrn.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngintrn.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngintrn.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngintrn.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngintrn.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngintrn.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngintrn.h

pngtest.o: png.h pngconf.h pngintrn.h