1 # makefile for libpng 2 # Copyright (C) 2002, 2006, 2009, 2014 Glenn Randers-Pehrson 3 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. 4 # 5 # This code is released under the libpng license. 6 # For conditions of distribution and use, see the disclaimer 7 # and license in png.h 8 # 9 # This makefile requires the file ansi2knr.c, which you can get 10 # from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/ 11 # If you have libjpeg, you probably already have ansi2knr.c in the jpeg 12 # source distribution. 13 14 # where make install puts libpng.a and png.h 15 prefix=/usr/local 16 INCPATH=$(prefix)/include 17 LIBPATH=$(prefix)/lib 18 19 # override DESTDIR= on the make install command line to easily support 20 # installing into a temporary location. Example: 21 # 22 # make install DESTDIR=/tmp/build/libpng 23 # 24 # If you're going to install into a temporary location 25 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before 26 # you execute make install. 27 DESTDIR= 28 29 CC = cc 30 CPPFLAGS = -I../zlib 31 CFLAGS = -O 32 LDFLAGS = -L. -L../zlib/ -lpng -lz -lm 33 # flags for ansi2knr 34 ANSI2KNRFLAGS= 35 36 RANLIB = ranlib 37 #RANLIB = echo 38 39 CP = cp 40 RM_F = rm -f 41 42 # Pre-built configuration 43 # See scripts/pnglibconf.mak for more options 44 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt 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 all: ansi2knr libpng.a pngtest 51 52 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) 53 $(CP) $(PNGLIBCONF_H_PREBUILT) $@ 54 55 # general rule to allow ansi2knr to work 56 .c.o: 57 ./ansi2knr $*.c T$*.c 58 $(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c 59 rm -f T$*.c $*.o 60 mv T$*.o $*.o 61 62 ansi2knr: ansi2knr.c 63 $(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c 64 65 libpng.a: ansi2knr $(OBJS) 66 ar rc $@ $(OBJS) 67 $(RANLIB) $@ 68 69 pngtest: pngtest.o libpng.a 70 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) 71 72 test: pngtest 73 ./pngtest 74 75 install: libpng.a png.h pngconf.h pnglibconf.h 76 -@mkdir $(DESTDIR)$(INCPATH) 77 -@mkdir $(DESTDIR)$(INCPATH)/libpng 78 -@mkdir $(DESTDIR)$(LIBPATH) 79 -@rm -f $(DESTDIR)$(INCPATH)/png.h 80 -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h 81 cp png.h $(DESTDIR)$(INCPATH)/libpng 82 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng 83 cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng 84 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h 85 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h 86 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h 87 (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .) 88 cp libpng.a $(DESTDIR)$(LIBPATH) 89 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a 90 91 clean: 92 $(RM_F) *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h 93 94 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO 95 writelock: 96 chmod a-w *.[ch35] $(DOCS) scripts/* 97 98 # DO NOT DELETE THIS LINE -- make depend depends on it. 99 100 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 101 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 102 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 103 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 104 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 105 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 106 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 107 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 108 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 109 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 110 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 111 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 112 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 113 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 114 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 115 116 pngtest.o: png.h pngconf.h pnglibconf.h 117