makefile.solaris 7.2 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 9 10
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
11
PNGMIN = 1.2.10rc1
12 13 14 15 16 17 18 19 20 21 22
PNGVER = $(PNGMAJ).$(PNGMIN)

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

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

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

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

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

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

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

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

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

74 75 76 77 78 79 80
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

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

81
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
G
Guy Schalnat 已提交
82 83

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

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

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

101
$(LIBSO): $(LIBSOMAJ)
102
	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
G
Guy Schalnat 已提交
103

104
$(LIBSOMAJ): $(LIBSOVER)
105
	$(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
G
Guy Schalnat 已提交
106

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

123 124 125
$(OLDSOVER): $(OBJS)
	$(LD) -G -h $(OLDSOMAJ) \
	 -o $(OLDSOVER) $(OBJSDLL)
126

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

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

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

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

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

install-man: libpng.3 libpngpf.3 png.5
174 175 176 177
	-@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
178 179
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
180 181
	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
	-@$(RM_F) $(DM)/man5/png.5
182
	cp png.5 $(DM)/man5
183

184
install-config: libpng-config
185 186 187
	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
	-@$(RM_F) $(DB)/libpng-config
	-@$(RM_F) $(DB)/$(LIBNAME)-config
188 189
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
190
	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
191 192

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

194
# If you installed in $(DESTDIR), test-installed won't work until you
195 196 197 198 199 200 201
# 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) \
202 203
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
204 205
	   -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
	./pngtestd pngtest.png
206 207 208 209 210

test-installed:
	echo
	echo Testing installed dynamic shared library.
	$(CC) -I$(ZLIBINC) \
211 212
	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
213
	   -L$(ZLIBLIB) -R$(ZLIBLIB)
214
	./pngtesti pngtest.png
215

G
Guy Schalnat 已提交
216
clean:
217
	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
218 219
	libpng-config $(LIBSO) $(LIBSOMAJ)* \
	$(OLDSOVER) \
220
	libpng.pc
G
Guy Schalnat 已提交
221

222 223 224 225
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

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

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
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

G
Guy Schalnat 已提交
244
pngtest.o: png.h pngconf.h