blob: aba2485eb91675c6b4fdf65f12aae125ac77b02a [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-Pehrson08a33431998-03-07 06:06:55 -060027LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -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 -060032# read libpng.txt or png.h to see why PNGMAJ is 0. You should not
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060033# have to change it.
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060034PNGMAJ = 0
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050035PNGMIN = 1.2.3rc5
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060036PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060037LIBNAME = libpng12
Guy Schalnat4ee97b01996-01-16 01:51:56 -060038
Andreas Dilger47a0c421997-05-16 02:46:07 -050039INCPATH=$(prefix)/include
40LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050041MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050042BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050043
44# override DESTDIR= on the make install command line to easily support
45# installing into a temporary location. Example:
46#
47# make install DESTDIR=/tmp/build/libpng
48#
49# If you're going to install into a temporary location
50# via DESTDIR, that location must already exist before
51# you execute make install.
52DESTDIR=
Guy Schalnat4ee97b01996-01-16 01:51:56 -060053
Andreas Dilger47a0c421997-05-16 02:46:07 -050054OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050055 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
56 pngwtran.o pngmem.o pngerror.o pngpread.o
Guy Schalnat4ee97b01996-01-16 01:51:56 -060057
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060058OBJSDLL = $(OBJS:.o=.pic.o)
59
60.SUFFIXES: .c .o .pic.o
61
62.c.pic.o:
63 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
64
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050065all: libpng.a $(LIBNAME).so pngtest
Guy Schalnat4ee97b01996-01-16 01:51:56 -060066
67libpng.a: $(OBJS)
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060068 ar rc $@ $(OBJS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060069 $(RANLIB) $@
70
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050071libpng.pc:
72 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
73
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050074libpng-config:
75 ( cat scripts/libpng-config-head.in; \
76 echo prefix=\"$(prefix)\"; \
77 echo cppflags=\"-I$(INCPATH)/libpng12 -DPNG_USE_PNGGCCRD \
78 -DPNG_NO_ASSEMBLER_CODE\"; \
79 echo cflags=\"$(ABI)\"; \
80 echo ldflags=\"-L$(LIBPATH) -R$(LIBPATH)\"; \
81 echo libs=\"-lpng12 -lz -lm\"; \
82 cat scripts/libpng-config-body.in ) > libpng-config
83 chmod +x libpng-config
84
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060085$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
86 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060087
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060088$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
89 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060090
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060091$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060092 @case "`type ld`" in *ucb*) \
93 echo; \
94 echo '## WARNING:'; \
95 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
96 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
97 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
98 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
99 echo '## at all. If it is, things are likely to break because of'; \
100 echo '## the libucb dependency that is created.'; \
101 echo; \
102 ;; \
103 esac
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600104 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
105 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600106
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600107pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600108 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600109
110test: pngtest
111 ./pngtest
112
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600113install-headers: png.h pngconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500114 -@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
115 -@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
116 mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
117 cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
118 chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
119 $(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
120 -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
121 -@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
122 (cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
123 ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600124
125install-static: install-headers libpng.a
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500126 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
127 cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
128 chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
129 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
130 (cd $(DESTDIR)$(LIBPATH); 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-Pehrson03008a02002-04-27 10:11:25 -0500133 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
134 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
135 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so
136 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
137 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
138 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
139 cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
140 chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
141 (cd $(DESTDIR)$(LIBPATH); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600142 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
143 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
144 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
145 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
146 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500147 -@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
148 mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500149 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500150 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.pc
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500151 cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/$(LIBNAME).pc
152 chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/$(LIBNAME).pc
153 (cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600154
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500155install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500156 -@if [ ! -d $(DESTDIR)$(MANPATH) ]; then mkdir $(DESTDIR)$(MANPATH); fi
157 -@if [ ! -d $(DESTDIR)$(MANPATH)/man3 ]; then \
158 mkdir $(DESTDIR)$(MANPATH)/man3; fi
159 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man3/libpng.3
160 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man3/libpngpf.3
161 cp libpng.3 $(DESTDIR)$(MANPATH)/man3
162 cp libpngpf.3 $(DESTDIR)$(MANPATH)/man3
163 -@if [ ! -d $(DESTDIR)$(MANPATH)/man5 ]; then \
164 mkdir $(DESTDIR)$(MANPATH)/man5; fi
165 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man5/png.5
166 cp png.5 $(DESTDIR)$(MANPATH)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500167
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500168install-config: libpng-config
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500169 -@if [ ! -d $(DESTDIR)$(BINPATH) ]; then \
170 mkdir $(DESTDIR)$(BINPATH); fi
171 -@/bin/rm -f $(DESTDIR)$(BINPATH)/libpng-config
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500172 -@/bin/rm -f $(DESTDIR)$(BINPATH)/$(LIBNAME)-config
173 cp libpng-config $(DESTDIR)$(BINPATH)/$(LIBNAME)-config
174 chmod 755 $(DESTDIR)$(BINPATH)/$(LIBNAME)-config
175 (cd $(DESTDIR)$(BINPATH); ln -sf $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500176
177install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600178
179clean:
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600180 /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600181 pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600182
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600183DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
184writelock:
185 chmod a-w *.[ch35] $(DOCS) scripts/*
186
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600187# DO NOT DELETE THIS LINE -- make depend depends on it.
188
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600189png.o png.pic.o: png.h pngconf.h
190pngerror.o pngerror.pic.o: png.h pngconf.h
191pngrio.o pngrio.pic.o: png.h pngconf.h
192pngwio.o pngwio.pic.o: png.h pngconf.h
193pngmem.o pngmem.pic.o: png.h pngconf.h
194pngset.o pngset.pic.o: png.h pngconf.h
195pngget.o pngget.pic.o: png.h pngconf.h
196pngread.o pngread.pic.o: png.h pngconf.h
197pngrtran.o pngrtran.pic.o: png.h pngconf.h
198pngrutil.o pngrutil.pic.o: png.h pngconf.h
199pngtrans.o pngtrans.pic.o: png.h pngconf.h
200pngwrite.o pngwrite.pic.o: png.h pngconf.h
201pngwtran.o pngwtran.pic.o: png.h pngconf.h
202pngwutil.o pngwutil.pic.o: png.h pngconf.h
203pngpread.o pngpread.pic.o: png.h pngconf.h
204
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600205pngtest.o: png.h pngconf.h