makefile.solaris 6.9 KB
Newer Older
1
# makefile for libpng on Solaris 2.x with gcc
2
# Copyright (C) 2004 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

G
Guy Schalnat 已提交
8
CC=gcc
A
Andreas Dilger 已提交
9

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

A
Andreas Dilger 已提交
13
# Where the zlib library and include files are located
14 15 16 17 18 19 20
# 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
21

A
Andreas Dilger 已提交
22
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
23 24
	-Wmissing-declarations -Wtraditional -Wcast-align \
	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
25
CFLAGS=-I$(ZLIBINC) -Wall -O \
26
	# $(WARNMORE) -g -DPNG_DEBUG=5
27
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
G
Guy Schalnat 已提交
28

29 30 31
#RANLIB=ranlib
RANLIB=echo

32
PNGMAJ = 0
33
PNGMIN = 1.2.6
A
Andreas Dilger 已提交
34
PNGVER = $(PNGMAJ).$(PNGMIN)
35
LIBNAME = libpng12
G
Guy Schalnat 已提交
36

A
Andreas Dilger 已提交
37 38
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib
39
MANPATH=$(prefix)/man
40
BINPATH=$(prefix)/bin
41 42 43 44 45 46 47

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

52 53 54 55
DB=$(DESTDIR)$(BINPATH)
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH)
56

A
Andreas Dilger 已提交
57
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
58 59
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
G
Guy Schalnat 已提交
60

61 62 63 64 65 66 67
OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

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

68
all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
G
Guy Schalnat 已提交
69 70

libpng.a: $(OBJS)
71
	ar rc $@ $(OBJS)
G
Guy Schalnat 已提交
72 73
	$(RANLIB) $@

74 75 76
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

77 78 79
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
80 81 82 83
	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)\"; \
84 85 86 87
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

88 89
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
G
Guy Schalnat 已提交
90

91 92
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
G
Guy Schalnat 已提交
93

94
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
95 96 97 98 99 100 101 102 103 104 105 106
	@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
107 108
	$(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
G
Guy Schalnat 已提交
109

110
libpng.so.3.$(PNGMIN): $(OBJS)
111 112
	$(LD) -G -h libpng.so.3 \
	 -o libpng.so.3.$(PNGMIN) $(OBJSDLL)
113

114
pngtest: pngtest.o $(LIBNAME).so
115
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
G
Guy Schalnat 已提交
116 117 118

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

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

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

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

install-man: libpng.3 libpngpf.3 png.5
161 162 163 164 165 166 167 168 169
	-@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
170

171
install-config: libpng-config
172 173 174 175 176
	-@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
177
	(cd $(DB); ln -s -f $(LIBNAME)-config libpng-config)
178 179

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

181 182 183 184 185 186 187
# 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) \
188 189
	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
190
	   -L$(ZLIBLIB) -R$(ZLIBLIB)
191
	./pngtesti pngtest.png
192

G
Guy Schalnat 已提交
193
clean:
194
	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
195
	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
196 197
	libpng.so.3.$(PNGMIN) \
	libpng.pc
G
Guy Schalnat 已提交
198

199 200 201 202
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

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

205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
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 已提交
221
pngtest.o: png.h pngconf.h