blob: 1ed99225cad183ef904c1be5ffa73c6f0efa74ad [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-Pehrson704228f2002-05-02 20:49:40 -050035PNGMIN = 1.2.3rc4
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-Pehrson03008a02002-04-27 10:11:25 -050065all: libpng.a $(LIBNAME).so pngtest libpng.pc
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-Pehrsonc6de22d2002-02-23 18:55:25 -060074$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
75 ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
Guy Schalnat4ee97b01996-01-16 01:51:56 -060076
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060077$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
78 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060079
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060080$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060081 @case "`type ld`" in *ucb*) \
82 echo; \
83 echo '## WARNING:'; \
84 echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
85 echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
86 echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
87 echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
88 echo '## at all. If it is, things are likely to break because of'; \
89 echo '## the libucb dependency that is created.'; \
90 echo; \
91 ;; \
92 esac
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060093 $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
94 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL) -lz
Guy Schalnat4ee97b01996-01-16 01:51:56 -060095
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060096pngtest: pngtest.o $(LIBNAME).so
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -060097 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Guy Schalnat4ee97b01996-01-16 01:51:56 -060098
99test: pngtest
100 ./pngtest
101
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600102install-headers: png.h pngconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500103 -@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
104 -@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
105 mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
106 cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
107 chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
108 $(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
109 -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
110 -@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
111 (cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
112 ln -f -s $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600113
114install-static: install-headers libpng.a
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500115 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
116 cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
117 chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
118 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
119 (cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600120
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -0500121install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500122 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
123 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
124 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so
125 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
126 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
127 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
128 cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
129 chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
130 (cd $(DESTDIR)$(LIBPATH); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600131 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
132 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
133 ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
134 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
135 ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500136 -@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
137 mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500138 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500139 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500140 cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
141 chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
142 (cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600143
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500144install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500145 -@if [ ! -d $(DESTDIR)$(MANPATH) ]; then mkdir $(DESTDIR)$(MANPATH); fi
146 -@if [ ! -d $(DESTDIR)$(MANPATH)/man3 ]; then \
147 mkdir $(DESTDIR)$(MANPATH)/man3; fi
148 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man3/libpng.3
149 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man3/libpngpf.3
150 cp libpng.3 $(DESTDIR)$(MANPATH)/man3
151 cp libpngpf.3 $(DESTDIR)$(MANPATH)/man3
152 -@if [ ! -d $(DESTDIR)$(MANPATH)/man5 ]; then \
153 mkdir $(DESTDIR)$(MANPATH)/man5; fi
154 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man5/png.5
155 cp png.5 $(DESTDIR)$(MANPATH)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500156
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500157install-config: scripts/libpng-config
158 -@if [ ! -d $(DESTDIR)$(BINPATH) ]; then \
159 mkdir $(DESTDIR)$(BINPATH); fi
160 -@/bin/rm -f $(DESTDIR)$(BINPATH)/libpng-config
161 -@/bin/rm -f $(DESTDIR)$(BINPATH)/libpng12-config
162 cp scripts/libpng-config $(DESTDIR)$(BINPATH)/libpng12-config
163 chmod 755 $(DESTDIR)$(BINPATH)/libpng12-config
164 (cd $(DESTDIR)$(BINPATH); ln -sf libpng12-config libpng-config)
165
166install: install-static install-shared install-man install-config
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600167
168clean:
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600169 /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600170 pngtest pngout.png
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600171
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600172DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
173writelock:
174 chmod a-w *.[ch35] $(DOCS) scripts/*
175
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600176# DO NOT DELETE THIS LINE -- make depend depends on it.
177
Glenn Randers-Pehrson2687fcc1998-01-07 20:54:20 -0600178png.o png.pic.o: png.h pngconf.h
179pngerror.o pngerror.pic.o: png.h pngconf.h
180pngrio.o pngrio.pic.o: png.h pngconf.h
181pngwio.o pngwio.pic.o: png.h pngconf.h
182pngmem.o pngmem.pic.o: png.h pngconf.h
183pngset.o pngset.pic.o: png.h pngconf.h
184pngget.o pngget.pic.o: png.h pngconf.h
185pngread.o pngread.pic.o: png.h pngconf.h
186pngrtran.o pngrtran.pic.o: png.h pngconf.h
187pngrutil.o pngrutil.pic.o: png.h pngconf.h
188pngtrans.o pngtrans.pic.o: png.h pngconf.h
189pngwrite.o pngwrite.pic.o: png.h pngconf.h
190pngwtran.o pngwtran.pic.o: png.h pngconf.h
191pngwutil.o pngwutil.pic.o: png.h pngconf.h
192pngpread.o pngpread.pic.o: png.h pngconf.h
193
Guy Schalnat4ee97b01996-01-16 01:51:56 -0600194pngtest.o: png.h pngconf.h