| 1 | # makefile for libpng on Solaris 2.x with gcc |
| 2 | # Contributed by William L. Sebok, based on makefile.lnx |
| 3 | # Copyright (C) 1996, 1997 Andreas Dilger |
| 4 | # Copyright (C) 1998 Greg Roelofs |
| 5 | # For conditions of distribution and use, see copyright notice in png.h |
| 6 | |
| 7 | CC=gcc |
| 8 | |
| 9 | # Where the zlib library and include files are located |
| 10 | # Changing these to ../zlib poses a security risk. If you want |
| 11 | # to have zlib in an adjacent directory, specify the full path instead of "..". |
| 12 | #ZLIBLIB=../zlib |
| 13 | #ZLIBINC=../zlib |
| 14 | |
| 15 | ZLIBLIB=/usr/local/lib |
| 16 | ZLIBINC=/usr/local/include |
| 17 | |
| 18 | |
| 19 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ |
| 20 | -Wmissing-declarations -Wtraditional -Wcast-align \ |
| 21 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion |
| 22 | CFLAGS=-I$(ZLIBINC) -Wall -O3 \ |
| 23 | #$(WARNMORE) -g -DPNG_DEBUG=5 |
| 24 | LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng -lz -lm |
| 25 | |
| 26 | #RANLIB=ranlib |
| 27 | RANLIB=echo |
| 28 | |
| 29 | # read libpng.txt or png.h to see why PNGMAJ is 2. You should not |
| 30 | # have to change it. |
| 31 | PNGMAJ = 2 |
| 32 | PNGMIN = 1.0 |
| 33 | PNGVER = $(PNGMAJ).$(PNGMIN) |
| 34 | |
| 35 | # where make install puts libpng.a, libpng.so*, and png.h |
| 36 | prefix=/usr/local |
| 37 | INCPATH=$(prefix)/include |
| 38 | LIBPATH=$(prefix)/lib |
| 39 | |
| 40 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
| 41 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 42 | pngwtran.o pngmem.o pngerror.o pngpread.o |
| 43 | |
| 44 | OBJSDLL = $(OBJS:.o=.pic.o) |
| 45 | |
| 46 | .SUFFIXES: .c .o .pic.o |
| 47 | |
| 48 | .c.pic.o: |
| 49 | $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c |
| 50 | |
| 51 | all: libpng.a libpng.so pngtest |
| 52 | |
| 53 | libpng.a: $(OBJS) |
| 54 | ar rc $@ $(OBJS) |
| 55 | $(RANLIB) $@ |
| 56 | |
| 57 | libpng.so: libpng.so.$(PNGMAJ) |
| 58 | ln -sf libpng.so.$(PNGMAJ) libpng.so |
| 59 | |
| 60 | libpng.so.$(PNGMAJ): libpng.so.$(PNGVER) |
| 61 | ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ) |
| 62 | |
| 63 | libpng.so.$(PNGVER): $(OBJSDLL) |
| 64 | $(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.$(PNGMAJ) \ |
| 65 | -o libpng.so.$(PNGVER) $(OBJSDLL) -lz |
| 66 | |
| 67 | pngtest: pngtest.o libpng.so |
| 68 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 69 | |
| 70 | test: pngtest |
| 71 | ./pngtest |
| 72 | |
| 73 | install: libpng.a libpng.so.$(PNGVER) |
| 74 | -@mkdir $(INCPATH) $(LIBPATH) |
| 75 | cp png.h pngconf.h $(INCPATH) |
| 76 | chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h |
| 77 | cp libpng.a libpng.so.$(PNGVER) $(LIBPATH) |
| 78 | chmod 755 $(LIBPATH)/libpng.so.$(PNGVER) |
| 79 | -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so |
| 80 | (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \ |
| 81 | ln -sf libpng.so.$(PNGMAJ) libpng.so) |
| 82 | |
| 83 | clean: |
| 84 | /bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png |
| 85 | |
| 86 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 87 | |
| 88 | png.o png.pic.o: png.h pngconf.h |
| 89 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 90 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 91 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 92 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 93 | pngset.o pngset.pic.o: png.h pngconf.h |
| 94 | pngget.o pngget.pic.o: png.h pngconf.h |
| 95 | pngread.o pngread.pic.o: png.h pngconf.h |
| 96 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 97 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 98 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 99 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 100 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 101 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 102 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 103 | |
| 104 | pngtest.o: png.h pngconf.h |