blob: 56004099fc3b8c648ee4d9def806828add99ff23 [file] [log] [blame]
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -06001# makefile for libpng on Solaris 2.x with gcc
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -06002# Copyright (C) 2002 Glenn Randers-Pehrson
Glenn Randers-Pehrsonbcfd15d1999-10-01 14:22:25 -05003# Contributed by William L. Sebok, based on makefile.linux
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05004# Copyright (C) 1998 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05005# Copyright (C) 1996, 1997 Andreas Dilger
Guy Schalnat4ee97b01996-01-16 01:51:56 -06006# For conditions of distribution and use, see copyright notice in png.h
7
8CC=gcc
Andreas Dilger47a0c421997-05-16 02:46:07 -05009
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060010# Where make install puts libpng.a, libpng12.so*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060011prefix=/usr/local
12
Andreas Dilger47a0c421997-05-16 02:46:07 -050013# Where the zlib library and include files are located
Glenn Randers-Pehrsonf9f2fe01998-03-15 18:20:23 -060014# Changing these to ../zlib poses a security risk. If you want
15# to have zlib in an adjacent directory, specify the full path instead of "..".
16#ZLIBLIB=../zlib
17#ZLIBINC=../zlib
18
19ZLIBLIB=/usr/local/lib
20ZLIBINC=/usr/local/include
Glenn Randers-Pehrsond12aa501998-03-13 07:39:39 -060021
Andreas Dilger47a0c421997-05-16 02:46:07 -050022WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050023 -Wmissing-declarations -Wtraditional -Wcast-align \
24 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060025CFLAGS=-I$(ZLIBINC) -Wall -O3 \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050026 # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050027LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
Guy Schalnat4ee97b01996-01-16 01:51:56 -060028
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060029#RANLIB=ranlib
30RANLIB=echo
Guy Schalnat4ee97b01996-01-16 01:51:56 -060031
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060032PNGMAJ = 0
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -050033PNGMIN = 1.2.4rc1
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060034PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060035LIBNAME = libpng12
Guy Schalnat4ee97b01996-01-16 01:51:56 -060036
Andreas Dilger47a0c421997-05-16 02:46:07 -050037INCPATH=$(prefix)/include
38LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050039MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050040BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050041
42# override DESTDIR= on the make install command line to easily support
43# installing into a temporary location. Example:
44#
45# make install DESTDIR=/tmp/build/libpng
46#
47# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050048# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050049# you execute make install.
50DESTDIR=
Guy Schalnat4ee97b01996-01-16 01:51:56 -060051
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050052DB=$(DESTDIR)$(BINPATH)
53DI=$(DESTDIR)$(INCPATH)
54DL=$(DESTDIR)$(LIBPATH)
55DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050056
Andreas Dilger47a0c421997-05-16 02:46:07 -050057OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050058 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
59 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060060
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060061OBJSDLL = $(OBJS:.o=.pic.o)
62
63.SUFFIXES: .c .o .pic.o
64
65.c.pic.o:
66 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
67
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050068all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -060069
70libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060071 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060072 $(RANLIB) $@
73
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050074libpng.pc:
75 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
76
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050077libpng-config:
78 ( cat scripts/libpng-config-head.in; \
79 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson22f28962002-05-13 18:17:09 -050080 echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050081 -DPNG_NO_ASSEMBLER_CODE\"; \
82 echo cflags=\"$(ABI)\"; \
83 echo ldflags=\"-L$(LIBPATH) -R$(LIBPATH)\"; \
84 echo libs=\"-lpng12 -lz -lm\"; \
85 cat scripts/libpng-config-body.in ) > libpng-config
86 chmod +x libpng-config
87
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060088$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
89 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060090
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060091$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
92 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060093
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060094$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060095 @case "`type ld`" in *ucb*) \
96 echo; \
97 echo '## WARNING:'; \
98 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
99 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
100 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
101 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
102 echo '## at all. If it is, things are likely to break because of'; \
103 echo '## the libucb dependency that is created.'; \
104 echo; \
105 ;; \
106 esac
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600107 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
108 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600109
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600110pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600111 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600112
113test: pngtest
114 ./pngtest
115
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600116install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500117 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
118 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
119 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500120 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500121 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
122 -@/bin/rm -f $(DI)/libpng
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500123 (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600124
125install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500126 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
127 cp libpng.a $(DL)/$(LIBNAME).a
128 chmod 644 $(DL)/$(LIBNAME).a
129 -@/bin/rm -f $(DL)/libpng.a
130 (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600131
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -0500132install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500133 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500134 -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* $(DL)/$(LIBNAME).so
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500135 -@/bin/rm -f $(DL)/libpng.so
136 -@/bin/rm -f $(DL)/libpng.so.3
137 -@/bin/rm -f $(DL)/libpng.so.3.*
138 cp $(LIBNAME).so.$(PNGVER) $(DL)
139 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
140 (cd $(DL); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600141 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
142 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
143 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
144 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
145 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
147 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
148 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
149 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
150 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
151 (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600152
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500153install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500154 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
155 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
156 -@/bin/rm -f $(DM)/man3/libpng.3
157 -@/bin/rm -f $(DM)/man3/libpngpf.3
158 cp libpng.3 $(DM)/man3
159 cp libpngpf.3 $(DM)/man3
160 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
161 -@/bin/rm -f $(DM)/man5/png.5
162 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500163
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500164install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
166 -@/bin/rm -f $(DB)/libpng-config
167 -@/bin/rm -f $(DB)/$(LIBNAME)-config
168 cp libpng-config $(DB)/$(LIBNAME)-config
169 chmod 755 $(DB)/$(LIBNAME)-config
170 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500171
172install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600173
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500174# If you installed in $(DESTDIR), test-installed won't work until you
175# move the library to its final location.
176
177test-installed:
178 echo
179 echo Testing installed dynamic shared library.
180 $(CC) -I$(ZLIBINC) \
181 `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
182 -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
183 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500184 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500185
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600186clean:
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500187 /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc \
188 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)*
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600189
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600190DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
191writelock:
192 chmod a-w *.[ch35] $(DOCS) scripts/*
193
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600194# DO NOT DELETE THIS LINE -- make depend depends on it.
195
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600196png.o png.pic.o: png.h pngconf.h
197pngerror.o pngerror.pic.o: png.h pngconf.h
198pngrio.o pngrio.pic.o: png.h pngconf.h
199pngwio.o pngwio.pic.o: png.h pngconf.h
200pngmem.o pngmem.pic.o: png.h pngconf.h
201pngset.o pngset.pic.o: png.h pngconf.h
202pngget.o pngget.pic.o: png.h pngconf.h
203pngread.o pngread.pic.o: png.h pngconf.h
204pngrtran.o pngrtran.pic.o: png.h pngconf.h
205pngrutil.o pngrutil.pic.o: png.h pngconf.h
206pngtrans.o pngtrans.pic.o: png.h pngconf.h
207pngwrite.o pngwrite.pic.o: png.h pngconf.h
208pngwtran.o pngwtran.pic.o: png.h pngconf.h
209pngwutil.o pngwutil.pic.o: png.h pngconf.h
210pngpread.o pngpread.pic.o: png.h pngconf.h
211
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600212pngtest.o: png.h pngconf.h