makefile.solaris 7.0 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 = 0
11
PNGMIN = 1.4.0beta3
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

libpng.a: $(OBJS)
82
	$(AR_RC) $@ $(OBJS)
G
Guy Schalnat 已提交
83 84
	$(RANLIB) $@

85 86 87
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

88 89 90
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
91
	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
92
	echo cppflags=\"-DPNG_USE_PNGGCCRD -DPNG_NO_MMX_CODE\"; \
93 94
	echo L_opts=\"-L$(LIBPATH)\"; \
	echo R_opts=\"-R$(LIBPATH)\"; \
95
	echo libs=\"-lpng14 -lz -lm\"; \
96 97 98
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

99
$(LIBSO): $(LIBSOMAJ)
100
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
G
Guy Schalnat 已提交
101

102
$(LIBSOMAJ): $(LIBSOVER)
103
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
G
Guy Schalnat 已提交
104

105
$(LIBSOVER): $(OBJSDLL)
106 107 108 109 110 111 112 113 114 115 116 117
	@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
118 119
	$(LD) -G -h $(LIBSOMAJ) \
	 -o $(LIBSOVER) $(OBJSDLL)
G
Guy Schalnat 已提交
120

121
pngtest: pngtest.o $(LIBSO)
122
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
G
Guy Schalnat 已提交
123 124 125

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

127
install-headers: png.h pngconf.h
128 129
	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
130
	cp png.h pngconf.h $(DI)/$(LIBNAME)
131
	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
132 133
	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
	-@$(RM_F) $(DI)/libpng
134
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
135 136

install-static: install-headers libpng.a
137
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
138 139
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
140
	-@$(RM_F) $(DL)/libpng.a
141
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
142

143
install-shared: install-headers $(LIBSOVER) libpng.pc
144
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
145 146 147 148 149
	-@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
	-@$(RM_F) $(DL)/$(LIBSOMAJ)
	-@$(RM_F) $(DL)/$(OLDSO)
	cp $(LIBSOVER) $(DL)
	chmod 755 $(DL)/$(LIBSOVER)
150
	(cd $(DL); \
151 152 153
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
	$(LN_SF) $(LIBSOMAJ) $(LIBSO); \
	$(LN_SF) $(OLDSO) $(LIBSO))
154 155 156
	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
157 158
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
159
	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
160 161

install-man: libpng.3 libpngpf.3 png.5
162 163 164 165
	-@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
166 167
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
168 169
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
	-@$(RM_F) $(DM)/man5/png.5
170
	cp png.5 $(DM)/man5
171

172
install-config: libpng-config
173 174 175
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
176 177
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
178
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
179 180

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

182
# If you installed in $(DESTDIR), test-installed won't work until you
183 184 185 186 187 188 189
# 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) \
190 191
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
192 193
	   -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
	./pngtestd pngtest.png
194 195 196 197 198

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) -I$(ZLIBINC) \
199 200
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
201
	   -L$(ZLIBLIB) -R$(ZLIBLIB)
202
	./pngtesti pngtest.png
203

G
Guy Schalnat 已提交
204
clean:
205
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
206
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
207
	libpng.pc
G
Guy Schalnat 已提交
208

209 210 211 212
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

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

215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
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
pngget.o pngget.pic.o: png.h pngconf.h pngintrn.h
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