blob: 5cc3341fe1b8820738cf3ca0c5573246adff45a1 [file] [log] [blame]
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -06001# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
2# Copyright (C) 2001-2002 Glenn Randers-Pehrson
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -06003# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4# For conditions of distribution and use, see copyright notice in png.h
5
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -06006# where make install puts libpng.a, libpng12.so and libpng12/png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -06007prefix=/usr/local
8
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -06009# Where the zlib library and include files are located
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060010#ZLIBLIB=/usr/local/lib32
11#ZLIBINC=/usr/local/include
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060012#ZLIBLIB=/usr/local/lib
13#ZLIBINC=/usr/local/include
14ZLIBLIB=../zlib
15ZLIBINC=../zlib
16
17CC=cc
18
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050019# ABI can be blank to use default for your system, -32, -o32, -n32, or -64
20# See "man abi". zlib must be built with the same ABI.
21ABI=
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060022
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050023WARNMORE=-fullwarn
24# Note: -KPIC is the default anyhow
25#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5
26CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060027LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050028LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
29LDSHARED=cc $(ABI) -shared
30
Glenn Randers-Pehrsonb1828932001-06-23 08:03:17 -050031# See "man dso" for info about shared objects
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060032LIBNAME=libpng12
33PNGMAJ = 0
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050034PNGMIN = 1.2.3rc4
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060035PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060036
37RANLIB=echo
38#RANLIB=ranlib
39
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060040INCPATH=$(prefix)/include
41LIBPATH=$(prefix)/lib
42#LIBPATH=$(prefix)/lib32
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050043MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050044BINPATH=$(prefix)/bin
45BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050046
47# override DESTDIR= on the make install command line to easily support
48# installing into a temporary location. Example:
49#
50# make install DESTDIR=/tmp/build/libpng
51#
52# If you're going to install into a temporary location
53# via DESTDIR, that location must already exist before
54# you execute make install.
55DESTDIR=
Glenn Randers-Pehrsonae498dc2001-11-24 14:53:31 -060056
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060057OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060058 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
59 pngwtran.o pngmem.o pngerror.o pngpread.o
60
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050061all: libpng.a pngtest shared libpng.pc
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060062
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050063shared: $(LIBNAME).so.$(PNGVER)
64
65libpng.pc:
66 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060067
68libpng.a: $(OBJS)
69 ar rc $@ $(OBJS)
70 $(RANLIB) $@
71
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060072$(LIBNAME).so.$(PNGVER): $(OBJS)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060073 $(LDSHARED) -o $@ $(OBJS)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060074 rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -050075 ln -s -f $@ $(LIBNAME).so
76 ln -s -f $@ $(LIBNAME).so.$(PNGMAJ)
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -060077
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060078pngtest: pngtest.o libpng.a
Glenn Randers-Pehrsonea3bcd71998-03-07 14:33:00 -060079 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -060080
81test: pngtest
82 ./pngtest
83
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060084install-headers: png.h pngconf.h
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050085 -@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
86 -@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
87 mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
88 cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
89 chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
90 $(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
91 -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
92 -@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -050093 (cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; \
94 ln -sf $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060095
96install-static: install-headers libpng.a
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050097 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
98 cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
99 chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
100 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500101 (cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600102
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -0500103install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500104 -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
105 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
106 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so
107 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
108 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
109 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
110 cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
111 chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
112 (cd $(DESTDIR)$(LIBPATH); \
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500113 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
114 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
115 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
116 ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
117 ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500118 -@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
119 mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500120 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500121 -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500122 cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
123 chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
Glenn Randers-Pehrson299d7352002-05-01 16:55:46 -0500124 (cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600125
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500126install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500127 -@if [ ! -d $(DESTDIR)$(MANPATH) ]; then mkdir $(DESTDIR)$(MANPATH); fi
128 -@if [ ! -d $(DESTDIR)$(MANPATH)/man3 ]; then \
129 mkdir $(DESTDIR)$(MANPATH)/man3; fi
130 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man3/libpng.3
131 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man3/libpngpf.3
132 cp libpng.3 $(DESTDIR)$(MANPATH)/man3
133 cp libpngpf.3 $(DESTDIR)$(MANPATH)/man3
134 -@if [ ! -d $(DESTDIR)$(MANPATH)/man5 ]; then \
135 mkdir $(DESTDIR)$(MANPATH)/man5; fi
136 -@/bin/rm -f $(DESTDIR)$(MANPATH)/man5/png.5
137 cp png.5 $(DESTDIR)$(MANPATH)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500138
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500139install-config: scripts/libpng-config
140 -@if [ ! -d $(DESTDIR)$(BINPATH) ]; then \
141 mkdir $(DESTDIR)$(BINPATH); fi
142 -@/bin/rm -f $(DESTDIR)$(BINPATH)/libpng-config
143 -@/bin/rm -f $(DESTDIR)$(BINPATH)/libpng12-config
144 cp scripts/libpng-config $(DESTDIR)$(BINPATH)/libpng12-config
145 chmod 755 $(DESTDIR)$(BINPATH)/libpng12-config
146 (cd $(DESTDIR)$(BINPATH); ln -sf libpng12-config libpng-config)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500147
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500148install: install-static install-shared install-man install-config
Glenn Randers-Pehrsonbe9de0f2001-01-22 08:52:16 -0600149
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600150clean:
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600151 rm -f *.o libpng.a pngtest pngout.png $(LIBNAME).so \
152 $(LIBNAME).so.$(PNGMAJ)*
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600153
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600154DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
155writelock:
156 chmod a-w *.[ch35] $(DOCS) scripts/*
157
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600158# DO NOT DELETE THIS LINE -- make depend depends on it.
159
160png.o: png.h pngconf.h
161pngerror.o: png.h pngconf.h
162pngrio.o: png.h pngconf.h
163pngwio.o: png.h pngconf.h
164pngmem.o: png.h pngconf.h
165pngset.o: png.h pngconf.h
166pngget.o: png.h pngconf.h
167pngread.o: png.h pngconf.h
168pngrtran.o: png.h pngconf.h
169pngrutil.o: png.h pngconf.h
170pngtest.o: png.h pngconf.h
171pngtrans.o: png.h pngconf.h
172pngwrite.o: png.h pngconf.h
173pngwtran.o: png.h pngconf.h
174pngwutil.o: png.h pngconf.h
175pngpread.o: png.h pngconf.h
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600176pnggccrd.o: png.h pngconf.h
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600177