Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 1 | # makefile for SCO OSr5 ELF and Unixware 7 with Native cc |
| 2 | # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx |
| 3 | # force ELF build dynamic linking, SONAME setting in lib and RPATH in app |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 4 | # Copyright (C) 2002 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 98c9d73 | 2000-05-03 21:06:11 -0500 | [diff] [blame] | 5 | # Copyright (C) 1998 Greg Roelofs |
Glenn Randers-Pehrson | d436672 | 2000-06-04 14:29:29 -0500 | [diff] [blame] | 6 | # Copyright (C) 1996, 1997 Andreas Dilger |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 7 | # For conditions of distribution and use, see copyright notice in png.h |
| 8 | |
| 9 | CC=cc |
| 10 | |
Glenn Randers-Pehrson | 5c6aeb2 | 1998-12-29 11:47:59 -0600 | [diff] [blame] | 11 | # where make install puts libpng.a, libpng.so*, and png.h |
| 12 | prefix=/usr/local |
| 13 | |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 14 | # Where the zlib library and include files are located |
| 15 | #ZLIBLIB=/usr/local/lib |
| 16 | #ZLIBINC=/usr/local/include |
| 17 | ZLIBLIB=../zlib |
| 18 | ZLIBINC=../zlib |
| 19 | |
Glenn Randers-Pehrson | d56aca7 | 2000-11-23 11:51:42 -0600 | [diff] [blame] | 20 | CFLAGS= -dy -belf -I$(ZLIBINC) -O3 |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 21 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm |
| 22 | |
| 23 | #RANLIB=ranlib |
| 24 | RANLIB=echo |
| 25 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 26 | # read libpng.txt or png.h to see why PNGMAJ is 0. You should not |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 27 | # have to change it. |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 28 | PNGMAJ = 0 |
Glenn Randers-Pehrson | 299d735 | 2002-05-01 16:55:46 -0500 | [diff] [blame^] | 29 | PNGMIN = 1.2.3rc3 |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 30 | PNGVER = $(PNGMAJ).$(PNGMIN) |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 31 | LIBNAME = libpng12 |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 32 | |
Glenn Randers-Pehrson | fcbd787 | 2002-04-07 16:35:38 -0500 | [diff] [blame] | 33 | INCPATH=$(prefix)/include/libpng |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 34 | LIBPATH=$(prefix)/lib |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 35 | MANPATH=$(prefix)/man |
| 36 | |
| 37 | # override DESTDIR= on the make install command line to easily support |
| 38 | # installing into a temporary location. Example: |
| 39 | # |
| 40 | # make install DESTDIR=/tmp/build/libpng |
| 41 | # |
| 42 | # If you're going to install into a temporary location |
| 43 | # via DESTDIR, that location must already exist before |
| 44 | # you execute make install. |
| 45 | DESTDIR= |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 46 | |
| 47 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
Glenn Randers-Pehrson | 4393a9a | 1999-09-17 12:27:26 -0500 | [diff] [blame] | 48 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 49 | pngwtran.o pngmem.o pngerror.o pngpread.o |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 50 | |
| 51 | OBJSDLL = $(OBJS:.o=.pic.o) |
| 52 | |
| 53 | .SUFFIXES: .c .o .pic.o |
| 54 | |
| 55 | .c.pic.o: |
| 56 | $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c |
| 57 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 58 | all: libpng.a $(LIBNAME).so pngtest libpng.pc |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 59 | |
| 60 | libpng.a: $(OBJS) |
| 61 | ar rc $@ $(OBJS) |
| 62 | $(RANLIB) $@ |
| 63 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 64 | libpng.pc: |
| 65 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc |
| 66 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 67 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ) |
| 68 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 69 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 70 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER) |
| 71 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ) |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 72 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 73 | $(LIBNAME).so.$(PNGVER): $(OBJSDLL) |
| 74 | $(CC) -G -Wl,-h,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \ |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 75 | $(OBJSDLL) |
| 76 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 77 | pngtest: pngtest.o $(LIBNAME).so |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 78 | LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 79 | |
| 80 | test: pngtest |
| 81 | ./pngtest |
| 82 | |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 83 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 84 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 85 | -@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi |
| 86 | -@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \ |
| 87 | mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi |
| 88 | -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h |
| 89 | -@/bin/rm -f $(DESTDIR)$(INCPATH)/pngconf.h |
| 90 | cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME) |
| 91 | chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \ |
| 92 | $(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h |
| 93 | -@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h |
| 94 | -@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng |
| 95 | (cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \ |
| 96 | ln -f -s $(LIBNAME)/* .) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 97 | |
| 98 | install-static: install-headers libpng.a |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 99 | -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi |
| 100 | cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a |
| 101 | chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a |
| 102 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a |
| 103 | (cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 104 | |
Glenn Randers-Pehrson | 25d8224 | 2002-05-01 11:51:26 -0500 | [diff] [blame] | 105 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 106 | -@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi |
| 107 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \ |
| 108 | $(DESTDIR)$(LIBPATH)/$(LIBNAME).so |
| 109 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so |
| 110 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3 |
| 111 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.* |
| 112 | cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH) |
| 113 | chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER) |
| 114 | (cd $(DESTDIR)$(LIBPATH); \ |
Glenn Randers-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 115 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \ |
| 116 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \ |
| 117 | ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \ |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 118 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \ |
| 119 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so) |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 120 | -@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \ |
| 121 | mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi |
Glenn Randers-Pehrson | 299d735 | 2002-05-01 16:55:46 -0500 | [diff] [blame^] | 122 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.12.pc |
| 123 | -@/bin/rm -f $(DESTDIR)$(LIBPATH)/pkgconfig/libpng.pc |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 124 | cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc |
| 125 | chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc |
| 126 | (cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc) |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 127 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 128 | install-man: libpng.3 libpngpf.3 png.5 |
| 129 | -@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi |
| 130 | -@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi |
| 131 | -@/bin/rm -f $(MANPATH)/man3/libpng.3 |
| 132 | -@/bin/rm -f $(MANPATH)/man3/libpngpf.3 |
| 133 | cp libpng.3 $(MANPATH)/man3 |
| 134 | cp libpngpf.3 $(MANPATH)/man3 |
| 135 | -@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi |
| 136 | -@/bin/rm -f $(MANPATH)/man5/png.5 |
| 137 | cp png.5 $(MANPATH)/man5 |
| 138 | |
| 139 | install: install-static install-shared install-man |
| 140 | |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 141 | |
| 142 | clean: |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 143 | /bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 144 | |
Glenn Randers-Pehrson | 166c5a3 | 1999-12-10 09:43:02 -0600 | [diff] [blame] | 145 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 146 | writelock: |
| 147 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 148 | |
Glenn Randers-Pehrson | 1d96361 | 1998-05-02 12:52:25 -0500 | [diff] [blame] | 149 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 150 | |
| 151 | png.o png.pic.o: png.h pngconf.h |
| 152 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 153 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 154 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 155 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 156 | pngset.o pngset.pic.o: png.h pngconf.h |
| 157 | pngget.o pngget.pic.o: png.h pngconf.h |
| 158 | pngread.o pngread.pic.o: png.h pngconf.h |
| 159 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 160 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 161 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 162 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 163 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 164 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 165 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 166 | |
| 167 | pngtest.o: png.h pngconf.h |