1# makefile for libpng 2# Copyright (C) 2002, 2006, 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# where make install puts libpng.a and png.h 10prefix=/usr/local 11INCPATH=$(prefix)/include 12LIBPATH=$(prefix)/lib 13 14# override DESTDIR= on the make install command line to easily support 15# installing into a temporary location. Example: 16# 17# make install DESTDIR=/tmp/build/libpng 18# 19# If you're going to install into a temporary location 20# via DESTDIR, $(DESTDIR)$(prefix) must already exist before 21# you execute make install. 22DESTDIR= 23 24# Where the zlib library and include files are located 25#ZLIBLIB=/usr/local/lib 26#ZLIBINC=/usr/local/include 27ZLIBLIB=../zlib 28ZLIBINC=../zlib 29 30 31WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \ 32 -Wmissing-declarations -Wtraditional -Wcast-align \ 33 -Wstrict-prototypes -Wmissing-prototypes 34 35CC=gcc 36AR_RC=ar rc 37MKDIR_P=mkdir -p 38LN_SF=ln -f -s 39RANLIB=ranlib 40CP=cp 41RM_F=/bin/rm -f 42 43CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 44CFLAGS=-O # $(WARNMORE) 45LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm 46 47# Pre-built configuration 48# See scripts/pnglibconf.mak for more options 49PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt 50 51OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ 52 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ 53 pngwtran.o pngmem.o pngerror.o pngpread.o 54 55.c.o: 56 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 57 58all: libpng.a pngtest 59 60pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) 61 $(CP) $(PNGLIBCONF_H_PREBUILT) $@ 62 63libpng.a: $(OBJS) 64 $(AR_RC) $@ $(OBJS) 65 $(RANLIB) $@ 66 67pngtest: pngtest.o libpng.a 68 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) 69 70test: pngtest 71 ./pngtest 72 73install: libpng.a 74 -@$(MKDIR_P) $(DESTDIR)$(INCPATH) 75 -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng 76 -@$(MKDIR_P) $(DESTDIR)$(LIBPATH) 77 -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h 78 -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h 79 -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h 80 cp png.h $(DESTDIR)$(INCPATH)/libpng 81 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng 82 cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng 83 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h 84 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h 85 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h 86 (cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .) 87 cp libpng.a $(DESTDIR)$(LIBPATH) 88 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a 89 90clean: 91 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h 92 93DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO 94writelock: 95 chmod a-w *.[ch35] $(DOCS) scripts/* 96 97# DO NOT DELETE THIS LINE -- make depend depends on it. 98 99png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 100pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 101pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 102pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 103pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 104pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 105pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 106pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 107pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 108pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 109pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 110pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 111pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 112pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 113pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 114 115pngtest.o: png.h pngconf.h pnglibconf.h 116