1# makefile for libpng 2# Copyright (C) 2002, 2006, 2009 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 15prefix=/usr/local 16INCPATH=$(prefix)/include 17LIBPATH=$(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. 27DESTDIR= 28 29CC=cc 30CFLAGS=-I../zlib -O 31LDFLAGS=-L. -L../zlib/ -lpng -lz -lm 32# flags for ansi2knr 33ANSI2KNRFLAGS= 34 35RANLIB=ranlib 36#RANLIB=echo 37 38OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ 39 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ 40 pngwtran.o pngmem.o pngerror.o pngpread.o 41 42all: ansi2knr libpng.a pngtest 43 44# general rule to allow ansi2knr to work 45.c.o: 46 ./ansi2knr $*.c T$*.c 47 $(CC) $(CFLAGS) -c T$*.c 48 rm -f T$*.c $*.o 49 mv T$*.o $*.o 50 51ansi2knr: ansi2knr.c 52 $(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c 53 54libpng.a: ansi2knr $(OBJS) 55 ar rc $@ $(OBJS) 56 $(RANLIB) $@ 57 58pngtest: pngtest.o libpng.a 59 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) 60 61test: pngtest 62 ./pngtest 63 64install: libpng.a png.h pngconf.h 65 -@mkdir $(DESTDIR)$(INCPATH) 66 -@mkdir $(DESTDIR)$(INCPATH)/libpng 67 -@mkdir $(DESTDIR)$(LIBPATH) 68 -@rm -f $(DESTDIR)$(INCPATH)/png.h 69 -@rm -f $(DESTDIR)$(INCPATH)/pngconf.h 70 cp png.h $(DESTDIR)$(INCPATH)/libpng 71 cp pngconf.h $(DESTDIR)$(INCPATH)/libpng 72 chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h 73 chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h 74 (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .) 75 cp libpng.a $(DESTDIR)$(LIBPATH) 76 chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a 77 78clean: 79 rm -f *.o libpng.a pngtest pngout.png ansi2knr 80 81DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO 82writelock: 83 chmod a-w *.[ch35] $(DOCS) scripts/* 84 85# DO NOT DELETE THIS LINE -- make depend depends on it. 86 87png.o: png.h pngconf.h 88pngerror.o: png.h pngconf.h 89pngrio.o: png.h pngconf.h 90pngwio.o: png.h pngconf.h 91pngmem.o: png.h pngconf.h 92pngset.o: png.h pngconf.h 93pngget.o: png.h pngconf.h 94pngread.o: png.h pngconf.h 95pngpread.o: png.h pngconf.h 96pngrtran.o: png.h pngconf.h 97pngrutil.o: png.h pngconf.h 98pngtrans.o: png.h pngconf.h 99pngwrite.o: png.h pngconf.h 100pngwtran.o: png.h pngconf.h 101pngwutil.o: png.h pngconf.h 102 103pngtest.o: png.h pngconf.h 104