Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 1 | # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc' |
| 2 | # Copyright (C) 2001-2002 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 3 | # 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-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 6 | LIBNAME=libpng12 |
| 7 | PNGMAJ = 0 |
Glenn Randers-Pehrson | 865f4f0 | 2002-09-15 20:30:38 -0500 | [diff] [blame^] | 8 | PNGMIN = 1.2.5rc2 |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 9 | PNGVER = $(PNGMAJ).$(PNGMIN) |
| 10 | |
| 11 | # Where make install puts libpng.a, libpng12.so, and libpng12/png.h |
| 12 | # Prefix must be a full pathname. |
| 13 | |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 14 | prefix=/usr/local |
| 15 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 16 | # Where the zlib library and include files are located |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 17 | #ZLIBLIB=/usr/local/lib32 |
| 18 | #ZLIBINC=/usr/local/include |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 19 | #ZLIBLIB=/usr/local/lib |
| 20 | #ZLIBINC=/usr/local/include |
| 21 | ZLIBLIB=../zlib |
| 22 | ZLIBINC=../zlib |
| 23 | |
| 24 | CC=cc |
| 25 | |
Glenn Randers-Pehrson | b182893 | 2001-06-23 08:03:17 -0500 | [diff] [blame] | 26 | # ABI can be blank to use default for your system, -32, -o32, -n32, or -64 |
| 27 | # See "man abi". zlib must be built with the same ABI. |
| 28 | ABI= |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 29 | |
Glenn Randers-Pehrson | b182893 | 2001-06-23 08:03:17 -0500 | [diff] [blame] | 30 | WARNMORE=-fullwarn |
| 31 | # Note: -KPIC is the default anyhow |
| 32 | #CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC -DPNG_USE_PNGGCCRD # -g -DPNG_DEBUG=5 |
| 33 | CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 34 | LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm |
Glenn Randers-Pehrson | b182893 | 2001-06-23 08:03:17 -0500 | [diff] [blame] | 35 | LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 36 | LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 37 | LDLEGACY=cc $(ABI) -shared -soname libpng.so.3 |
Glenn Randers-Pehrson | b182893 | 2001-06-23 08:03:17 -0500 | [diff] [blame] | 38 | # See "man dso" for info about shared objects |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 39 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 40 | RANLIB=echo |
| 41 | #RANLIB=ranlib |
| 42 | |
Glenn Randers-Pehrson | ae498dc | 2001-11-24 14:53:31 -0600 | [diff] [blame] | 43 | INCPATH=$(prefix)/include |
| 44 | LIBPATH=$(prefix)/lib |
| 45 | #LIBPATH=$(prefix)/lib32 |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 46 | MANPATH=$(prefix)/man |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 47 | BINPATH=$(prefix)/bin |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 48 | |
| 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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 55 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 56 | # you execute make install. |
| 57 | DESTDIR= |
Glenn Randers-Pehrson | ae498dc | 2001-11-24 14:53:31 -0600 | [diff] [blame] | 58 | |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 59 | DB=$(DESTDIR)$(BINPATH) |
| 60 | DI=$(DESTDIR)$(INCPATH) |
| 61 | DL=$(DESTDIR)$(LIBPATH) |
| 62 | DM=$(DESTDIR)$(MANPATH) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 63 | |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 64 | OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 65 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 66 | pngwtran.o pngmem.o pngerror.o pngpread.o |
| 67 | |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 68 | all: libpng.a pngtest shared libpng.pc libpng-config |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 69 | |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 70 | libpng.a: $(OBJS) |
| 71 | ar rc $@ $(OBJS) |
| 72 | $(RANLIB) $@ |
| 73 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 74 | shared: $(LIBNAME).so.$(PNGVER) |
| 75 | |
| 76 | libpng.pc: |
| 77 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 78 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 79 | libpng-config: |
| 80 | ( cat scripts/libpng-config-head.in; \ |
| 81 | echo prefix=\"$(prefix)\"; \ |
Glenn Randers-Pehrson | 22f2896 | 2002-05-13 18:17:09 -0500 | [diff] [blame] | 82 | echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \ |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 83 | -DPNG_NO_ASSEMBLER_CODE\"; \ |
| 84 | echo cflags=\"$(ABI)\"; \ |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 85 | echo ldflags=\"-L$(LIBPATH) \"; \ |
| 86 | echo rpath=\"$(LIBPATH) \"; \ |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 87 | echo libs=\"-lpng12 -lz -lm\"; \ |
| 88 | cat scripts/libpng-config-body.in ) > libpng-config |
| 89 | chmod +x libpng-config |
| 90 | |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 91 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) |
| 92 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so |
| 93 | |
| 94 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) |
| 95 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 96 | |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 97 | $(LIBNAME).so.$(PNGVER): $(OBJS) |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 98 | $(LDSHARED) -o $@ $(OBJS) |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 99 | rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 100 | |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 101 | libpng.so.3.$(PNGMIN): $(OBJS) |
| 102 | $(LDLEGACY) -o $@ $(OBJS) |
| 103 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 104 | pngtest: pngtest.o libpng.a |
Glenn Randers-Pehrson | ea3bcd7 | 1998-03-07 14:33:00 -0600 | [diff] [blame] | 105 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 106 | |
| 107 | test: pngtest |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 108 | echo |
| 109 | echo Testing local static library. |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 110 | ./pngtest |
| 111 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 112 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 113 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi |
| 114 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi |
| 115 | cp png.h pngconf.h $(DI)/$(LIBNAME) |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 116 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 117 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h |
| 118 | -@/bin/rm -f $(DI)/libpng |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame] | 119 | (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 120 | |
| 121 | install-static: install-headers libpng.a |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 122 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
| 123 | cp libpng.a $(DL)/$(LIBNAME).a |
| 124 | chmod 644 $(DL)/$(LIBNAME).a |
| 125 | -@/bin/rm -f $(DL)/libpng.a |
| 126 | (cd $(DL); ln -sf $(LIBNAME).a libpng.a) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 127 | |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 128 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \ |
| 129 | libpng.so.3.$(PNGMIN) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 130 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 131 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 132 | -@/bin/rm -f $(DL)/libpng.so |
| 133 | -@/bin/rm -f $(DL)/libpng.so.3 |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 134 | -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)* |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 135 | cp $(LIBNAME).so.$(PNGVER) $(DL) |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 136 | cp libpng.so.3.$(PNGMIN) $(DL) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 137 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER) |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 138 | chmod 755 $(DL)/libpng.so.3.$(PNGMIN) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 139 | (cd $(DL); \ |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 140 | ln -sf libpng.so.3.$(PNGMIN) libpng.so.3; \ |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 141 | ln -sf libpng.so.3 libpng.so; \ |
Glenn Randers-Pehrson | 299d735 | 2002-05-01 16:55:46 -0500 | [diff] [blame] | 142 | ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ |
| 143 | ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 144 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi |
| 145 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc |
| 146 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc |
| 147 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc |
| 148 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc |
| 149 | (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 150 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 151 | install-man: libpng.3 libpngpf.3 png.5 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 152 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi |
| 153 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi |
| 154 | -@/bin/rm -f $(DM)/man3/libpng.3 |
| 155 | -@/bin/rm -f $(DM)/man3/libpngpf.3 |
| 156 | cp libpng.3 $(DM)/man3 |
| 157 | cp libpngpf.3 $(DM)/man3 |
| 158 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi |
| 159 | -@/bin/rm -f $(DM)/man5/png.5 |
| 160 | cp png.5 $(DM)/man5 |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 161 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 162 | install-config: libpng-config |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 163 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi |
| 164 | -@/bin/rm -f $(DB)/libpng-config |
| 165 | -@/bin/rm -f $(DB)/$(LIBNAME)-config |
| 166 | cp libpng-config $(DB)/$(LIBNAME)-config |
| 167 | chmod 755 $(DB)/$(LIBNAME)-config |
| 168 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config) |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 169 | |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 170 | install: install-static install-shared install-man install-config |
Glenn Randers-Pehrson | be9de0f | 2001-01-22 08:52:16 -0600 | [diff] [blame] | 171 | |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 172 | # If you installed in $(DESTDIR), test-installed won't work until you |
| 173 | # move the library to its final location. |
| 174 | |
| 175 | test-installed: |
| 176 | echo |
| 177 | echo Testing installed dynamic shared library. |
| 178 | $(CC) -I$(ZLIBINC) \ |
| 179 | `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \ |
Glenn Randers-Pehrson | 8a7df00 | 2002-08-15 22:02:57 -0500 | [diff] [blame] | 180 | -L$(ZLIBLIB) -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --rpath` \ |
Glenn Randers-Pehrson | d020e9d | 2002-06-28 09:34:00 -0500 | [diff] [blame] | 181 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` |
Glenn Randers-Pehrson | 2ae022d | 2002-07-01 22:23:46 -0500 | [diff] [blame] | 182 | ./pngtesti pngtest.png |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 183 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 184 | clean: |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 185 | rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \ |
Glenn Randers-Pehrson | 51d9250 | 2002-08-23 23:07:42 -0500 | [diff] [blame] | 186 | $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \ |
| 187 | libpng.so.3.$(PNGMIN) \ |
| 188 | so_locations |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 189 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 190 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 191 | writelock: |
| 192 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 193 | |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 194 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 195 | |
| 196 | png.o: png.h pngconf.h |
| 197 | pngerror.o: png.h pngconf.h |
| 198 | pngrio.o: png.h pngconf.h |
| 199 | pngwio.o: png.h pngconf.h |
| 200 | pngmem.o: png.h pngconf.h |
| 201 | pngset.o: png.h pngconf.h |
| 202 | pngget.o: png.h pngconf.h |
| 203 | pngread.o: png.h pngconf.h |
| 204 | pngrtran.o: png.h pngconf.h |
| 205 | pngrutil.o: png.h pngconf.h |
| 206 | pngtest.o: png.h pngconf.h |
| 207 | pngtrans.o: png.h pngconf.h |
| 208 | pngwrite.o: png.h pngconf.h |
| 209 | pngwtran.o: png.h pngconf.h |
| 210 | pngwutil.o: png.h pngconf.h |
| 211 | pngpread.o: png.h pngconf.h |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 212 | pnggccrd.o: png.h pngconf.h |
Glenn Randers-Pehrson | c4a2ae6 | 1998-01-16 22:06:18 -0600 | [diff] [blame] | 213 | |