fukasawa e60969
# makefile for libpng
fukasawa e60969
# Copyright (C) 2002, 2006, 2009, 2014 Glenn Randers-Pehrson
fukasawa e60969
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
fukasawa e60969
#
fukasawa e60969
# This code is released under the libpng license.
fukasawa e60969
# For conditions of distribution and use, see the disclaimer
fukasawa e60969
# and license in png.h
fukasawa e60969
#
fukasawa e60969
# This makefile requires the file ansi2knr.c, which you can get
fukasawa e60969
# from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
fukasawa e60969
# If you have libjpeg, you probably already have ansi2knr.c in the jpeg
fukasawa e60969
# source distribution.
fukasawa e60969
fukasawa e60969
# where make install puts libpng.a and png.h
fukasawa e60969
prefix=/usr/local
fukasawa e60969
INCPATH=$(prefix)/include
fukasawa e60969
LIBPATH=$(prefix)/lib
fukasawa e60969
fukasawa e60969
# override DESTDIR= on the make install command line to easily support
fukasawa e60969
# installing into a temporary location.  Example:
fukasawa e60969
#
fukasawa e60969
#    make install DESTDIR=/tmp/build/libpng
fukasawa e60969
#
fukasawa e60969
# If you're going to install into a temporary location
fukasawa e60969
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
fukasawa e60969
# you execute make install.
fukasawa e60969
DESTDIR=
fukasawa e60969
fukasawa e60969
CC = cc
fukasawa e60969
CPPFLAGS = -I../zlib
fukasawa e60969
CFLAGS = -O
fukasawa e60969
LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
fukasawa e60969
# flags for ansi2knr
fukasawa e60969
ANSI2KNRFLAGS=
fukasawa e60969
fukasawa e60969
RANLIB = ranlib
fukasawa e60969
#RANLIB = echo
fukasawa e60969
fukasawa e60969
CP = cp
fukasawa e60969
RM_F = rm -f
fukasawa e60969
fukasawa e60969
# Pre-built configuration
fukasawa e60969
# See scripts/pnglibconf.mak for more options
fukasawa e60969
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
fukasawa e60969
fukasawa e60969
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
fukasawa e60969
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
fukasawa e60969
	pngwtran.o pngmem.o pngerror.o pngpread.o
fukasawa e60969
fukasawa e60969
all: ansi2knr libpng.a pngtest
fukasawa e60969
fukasawa e60969
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
fukasawa e60969
	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
fukasawa e60969
fukasawa e60969
# general rule to allow ansi2knr to work
fukasawa e60969
.c.o:
fukasawa e60969
	./ansi2knr $*.c T$*.c
fukasawa e60969
	$(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
fukasawa e60969
	rm -f T$*.c $*.o
fukasawa e60969
	mv T$*.o $*.o
fukasawa e60969
fukasawa e60969
ansi2knr: ansi2knr.c
fukasawa e60969
	$(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
fukasawa e60969
fukasawa e60969
libpng.a: ansi2knr $(OBJS)
fukasawa e60969
	ar rc $@  $(OBJS)
fukasawa e60969
	$(RANLIB) $@
fukasawa e60969
fukasawa e60969
pngtest: pngtest.o libpng.a
fukasawa e60969
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
fukasawa e60969
fukasawa e60969
test: pngtest
fukasawa e60969
	./pngtest
fukasawa e60969
fukasawa e60969
install: libpng.a png.h pngconf.h pnglibconf.h
fukasawa e60969
	-@mkdir $(DESTDIR)$(INCPATH)
fukasawa e60969
	-@mkdir $(DESTDIR)$(INCPATH)/libpng
fukasawa e60969
	-@mkdir $(DESTDIR)$(LIBPATH)
fukasawa e60969
	-@rm -f $(DESTDIR)$(INCPATH)/png.h
fukasawa e60969
	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
fukasawa e60969
	cp png.h $(DESTDIR)$(INCPATH)/libpng
fukasawa e60969
	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
fukasawa e60969
	cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
fukasawa e60969
	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
fukasawa e60969
	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
fukasawa e60969
	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
fukasawa e60969
	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
fukasawa e60969
	cp libpng.a $(DESTDIR)$(LIBPATH)
fukasawa e60969
	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
fukasawa e60969
fukasawa e60969
clean:
fukasawa e60969
	$(RM_F) *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
fukasawa e60969
fukasawa e60969
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
fukasawa e60969
writelock:
fukasawa e60969
	chmod a-w *.[ch35] $(DOCS) scripts/*
fukasawa e60969
fukasawa e60969
# DO NOT DELETE THIS LINE -- make depend depends on it.
fukasawa e60969
fukasawa e60969
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
fukasawa e60969
fukasawa e60969
pngtest.o: png.h pngconf.h pnglibconf.h