blob: 70fe48f8c6e4cb333bcddcab6da5bb26aaf9cefa [file] [log] [blame]
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -05001# makefile for libpng on Solaris 9 (beta) with Forte cc
2# Updated by Chad Schrock for Solaris 9
3# Contributed by William L. Sebok, based on makefile.linux
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06004# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -05005# Copyright (C) 1998-2001 Greg Roelofs
6# Copyright (C) 1996-1997 Andreas Dilger
7# For conditions of distribution and use, see copyright notice in png.h
8
9# gcc 2.95 doesn't work.
10CC=cc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060011AR_RC=ar rc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060012MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060013LN_SF=ln -f -s
14RANLIB=echo
15RM_F=/bin/rm -f
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050016
17# Where make install puts libpng.a, libpng.so*, and png.h
18prefix=/usr/local
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060019exec_prefix=$prefix
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050020
21# Where the zlib library and include files are located
22# Changing these to ../zlib poses a security risk. If you want
23# to have zlib in an adjacent directory, specify the full path instead of "..".
24#ZLIBLIB=../zlib
25#ZLIBINC=../zlib
26#ZLIBLIB=/usr/local/lib
27#ZLIBINC=/usr/local/include
28#Use the preinstalled zlib that comes with Solaris 9:
29ZLIBLIB=/usr/lib
30ZLIBINC=/usr/include
31
32#WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
33 -Wmissing-declarations -Wtraditional -Wcast-align \
34 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
35#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5
36CFLAGS=-I$(ZLIBINC) -O3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050037LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050038
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060039PNGMAJ = 0
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -060040PNGMIN = 1.2.9beta8
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050041PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060042LIBNAME = libpng12
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050043
44INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060045LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050046MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060047BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050048
49# override DESTDIR= on the make install command line to easily support
50# installing into a temporary location. Example:
51#
52# make install DESTDIR=/tmp/build/libpng
53#
54# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050055# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050056# you execute make install.
57DESTDIR=
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050058
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050059DB=$(DESTDIR)$(BINPATH)
60DI=$(DESTDIR)$(INCPATH)
61DL=$(DESTDIR)$(LIBPATH)
62DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050063
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050064OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
65 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
66 pngwtran.o pngmem.o pngerror.o pngpread.o
67
68OBJSDLL = $(OBJS:.o=.pic.o)
69
70.SUFFIXES: .c .o .pic.o
71
72.c.pic.o:
73 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
74
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050075all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050076
77libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060078 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050079 $(RANLIB) $@
80
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050081libpng.pc:
82 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
83
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050084libpng-config:
85 ( cat scripts/libpng-config-head.in; \
86 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050087 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
88 echo L_opts=\"-L$(LIBPATH)\"; \
89 echo R_opts=\"-R$(LIBPATH)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050090 echo libs=\"-lpng12 -lz -lm\"; \
91 cat scripts/libpng-config-body.in ) > libpng-config
92 chmod +x libpng-config
93
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060094$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060095 $(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050096
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060097$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060098 $(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -050099
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600100$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500101 @case "`type ld`" in *ucb*) \
102 echo; \
103 echo '## WARNING:'; \
104 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
105 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
106 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
107 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
108 echo '## at all. If it is, things are likely to break because of'; \
109 echo '## the libucb dependency that is created.'; \
110 echo; \
111 ;; \
112 esac
Glenn Randers-Pehrson865f4f02002-09-15 20:30:38 -0500113 $(LD) -G -h $(LIBNAME).so.$(PNGMAJ) \
114 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500115
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600116libpng.so.0.$(PNGMIN): $(OBJS)
117 $(LD) -G -h libpng.so.0 \
118 -o libpng.so.0.$(PNGMIN) $(OBJSDLL)
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500119
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600120pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500121 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
122
123test: pngtest
124 ./pngtest
125
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600126install-headers: png.h pngconf.h
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600127 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
128 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500129 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500130 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600131 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
132 -@$(RM_F) $(DI)/libpng
133 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600134
135install-static: install-headers libpng.a
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600136 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500137 cp libpng.a $(DL)/$(LIBNAME).a
138 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600139 -@$(RM_F) $(DL)/libpng.a
140 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600141
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500142install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600143 libpng.so.0.$(PNGMIN)
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600144 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600145 -@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
146 -@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
147 -@$(RM_F) $(DL)/libpng.so
148 -@$(RM_F) $(DL)/libpng.so.0
149 -@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500150 cp $(LIBNAME).so.$(PNGVER) $(DL)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600151 cp libpng.so.0.$(PNGMIN) $(DL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500152 chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600153 chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500154 (cd $(DL); \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600155 $(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
156 $(LN_SF) libpng.so.0 libpng.so; \
157 $(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
158 $(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600159 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600160 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
161 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500162 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
163 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600164 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600165
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500166install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600167 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
168 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600169 -@$(RM_F) $(DM)/man3/libpng.3
170 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500171 cp libpng.3 $(DM)/man3
172 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600173 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600174 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500175 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500176
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500177install-config: libpng-config
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600178 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600179 -@$(RM_F) $(DB)/libpng-config
180 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500181 cp libpng-config $(DB)/$(LIBNAME)-config
182 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600183 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500184
185install: install-static install-shared install-man install-config
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500186
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500187# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500188# move the library to its final location. Use test-dd to test it
189# before then.
190
191test-dd:
192 echo
193 echo Testing installed dynamic shared library in $(DL).
194 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600195 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
196 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500197 -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
198 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500199
200test-installed:
201 echo
202 echo Testing installed dynamic shared library.
203 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600204 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
205 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500206 -L$(ZLIBLIB) -R$(ZLIBLIB)
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500207 ./pngtesti pngtest.png
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500208
209clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600210 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson8a7df002002-08-15 22:02:57 -0500211 libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600212 libpng.so.0.$(PNGMIN) \
Glenn Randers-Pehrson51d92502002-08-23 23:07:42 -0500213 libpng.pc
Glenn Randers-Pehrson6c97ddb2001-10-24 22:01:19 -0500214
215DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
216writelock:
217 chmod a-w *.[ch35] $(DOCS) scripts/*
218
219# DO NOT DELETE THIS LINE -- make depend depends on it.
220
221png.o png.pic.o: png.h pngconf.h
222pngerror.o pngerror.pic.o: png.h pngconf.h
223pngrio.o pngrio.pic.o: png.h pngconf.h
224pngwio.o pngwio.pic.o: png.h pngconf.h
225pngmem.o pngmem.pic.o: png.h pngconf.h
226pngset.o pngset.pic.o: png.h pngconf.h
227pngget.o pngget.pic.o: png.h pngconf.h
228pngread.o pngread.pic.o: png.h pngconf.h
229pngrtran.o pngrtran.pic.o: png.h pngconf.h
230pngrutil.o pngrutil.pic.o: png.h pngconf.h
231pngtrans.o pngtrans.pic.o: png.h pngconf.h
232pngwrite.o pngwrite.pic.o: png.h pngconf.h
233pngwtran.o pngwtran.pic.o: png.h pngconf.h
234pngwutil.o pngwutil.pic.o: png.h pngconf.h
235pngpread.o pngpread.pic.o: png.h pngconf.h
236
237pngtest.o: png.h pngconf.h