lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | # makefile for libpng on Linux ELF with gcc |
| 2 | # Copyright (C) 1998, 1999 Greg Roelofs |
| 3 | # Copyright (C) 1996, 1997 Andreas Dilger |
| 4 | # For conditions of distribution and use, see copyright notice in png.h |
| 5 | include $(COMMON_BASE_MK) |
| 6 | #CC=gcc |
| 7 | |
| 8 | # where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h |
| 9 | #prefix=/usr/local |
| 10 | |
| 11 | # Where the zlib library and include files are located |
| 12 | #ZLIBLIB=/usr/local/lib |
| 13 | #ZLIBINC=/usr/local/include |
| 14 | ZLIBLIB=../zlib/build |
| 15 | ZLIBINC=../zlib/zlib-1.2.11 |
| 16 | LIBTARGET=libpng.a |
| 17 | |
| 18 | |
| 19 | |
| 20 | ALIGN= |
| 21 | # for i386: |
| 22 | #ALIGN=-malign-loops=2 -malign-functions=2 |
| 23 | |
| 24 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ |
| 25 | -Wmissing-declarations -Wtraditional -Wcast-align \ |
| 26 | -Wstrict-prototypes -Wmissing-prototypes #-Wconversion |
| 27 | |
| 28 | # for pgcc version 2.95.1, -O3 is buggy; don't use it. |
| 29 | |
| 30 | CFLAGS += -I$(ZLIBINC) -Wall -O3 -funroll-loops \ |
| 31 | $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 |
| 32 | #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm |
| 33 | |
| 34 | #RANLIB=ranlib |
| 35 | #RANLIB=echo |
| 36 | |
| 37 | # read libpng.txt or png.h to see why PNGMAJ is 2. You should not |
| 38 | # have to change it. |
| 39 | PNGMAJ = 2 |
| 40 | PNGMIN = 1.0.12 |
| 41 | PNGVER = $(PNGMAJ).$(PNGMIN) |
| 42 | |
| 43 | #INCPATH=$(prefix)/include |
| 44 | #LIBPATH=$(prefix)/lib |
| 45 | |
| 46 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
| 47 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 48 | pngwtran.o pngmem.o pngerror.o pngpread.o |
| 49 | |
| 50 | OBJSDLL = $(OBJS:.o=.pic.o) |
| 51 | |
| 52 | .SUFFIXES: .c .o .pic.o |
| 53 | |
| 54 | .c.pic.o: |
| 55 | $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c |
| 56 | |
| 57 | #all: libpng.a libpng.so pngtest |
| 58 | all: $(LIBTARGET) |
| 59 | #libpng.so |
| 60 | |
| 61 | #shared: all install |
| 62 | |
| 63 | |
| 64 | libpng.a: $(OBJS) |
| 65 | $(AR) -rv $@ $(OBJS) |
| 66 | # $(RANLIB) $@ |
| 67 | # $(INSTALL) -m 644 libpng.a $(ROOT_PATH)/lib/lib |
| 68 | |
| 69 | libpng.so: libpng.so.$(PNGMAJ) |
| 70 | ln -sf libpng.so.$(PNGMAJ) libpng.so |
| 71 | |
| 72 | libpng.so.$(PNGMAJ): libpng.so.$(PNGVER) |
| 73 | ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ) |
| 74 | |
| 75 | libpng.so.$(PNGVER): $(OBJSDLL) |
| 76 | $(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \ |
| 77 | $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc |
| 78 | |
| 79 | pngtest: pngtest.o libpng.so |
| 80 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 81 | |
| 82 | test: pngtest |
| 83 | ./pngtest |
| 84 | |
| 85 | install: libpng.a libpng.so.$(PNGVER) |
| 86 | -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi |
| 87 | -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi |
| 88 | cp png.h pngconf.h $(INCPATH) |
| 89 | chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h |
| 90 | cp libpng.a $(LIBPATH) |
| 91 | # cp libpng.a libpng.so.$(PNGVER) $(LIBPATH) |
| 92 | # chmod 755 $(LIBPATH)/libpng.so.$(PNGVER) |
| 93 | # -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so |
| 94 | # (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \ |
| 95 | # ln -sf libpng.so.$(PNGMAJ) libpng.so) |
| 96 | |
| 97 | romfs: |
| 98 | if [ "$(CONFIG_X86)" = "y" ]; then \ |
| 99 | [ -d $(ROMFSDIR)/lib ] || mkdir -p $(ROMFSDIR)/lib ; \ |
| 100 | $(ROMFSINST) libpng.so.2 /lib/libpng.so.2 ; \ |
| 101 | fi |
| 102 | |
| 103 | clean: |
| 104 | -/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png |
| 105 | |
| 106 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 107 | writelock: |
| 108 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 109 | |
| 110 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 111 | |
| 112 | png.o png.pic.o: png.h pngconf.h |
| 113 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 114 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 115 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 116 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 117 | pngset.o pngset.pic.o: png.h pngconf.h |
| 118 | pngget.o pngget.pic.o: png.h pngconf.h |
| 119 | pngread.o pngread.pic.o: png.h pngconf.h |
| 120 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 121 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 122 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 123 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 124 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 125 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 126 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 127 | |
| 128 | pngtest.o: png.h pngconf.h |