fukasawa e60969
# makefile for libpng
fukasawa e60969
# Copyright (C) 2002, 2006, 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
# 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
# Where the zlib library and include files are located
fukasawa e60969
#ZLIBLIB=/usr/local/lib
fukasawa e60969
#ZLIBINC=/usr/local/include
fukasawa e60969
ZLIBLIB=../zlib
fukasawa e60969
ZLIBINC=../zlib
fukasawa e60969
fukasawa e60969
CC = cc
fukasawa e60969
AR_RC = ar rc
fukasawa e60969
MKDIR_P = mkdir
fukasawa e60969
LN_SF = ln -sf
fukasawa e60969
RANLIB = ranlib
fukasawa e60969
CP = cp
fukasawa e60969
RM_F = rm -f
fukasawa e60969
AWK = awk
fukasawa e60969
SED = sed
fukasawa e60969
CPP = $(CC) -E
fukasawa e60969
ECHO = echo
fukasawa e60969
fukasawa e60969
DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
fukasawa e60969
DFA_EXTRA = # extra files that can be used to control configuration
fukasawa e60969
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
fukasawa e60969
CFLAGS = -O # -g
fukasawa e60969
LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
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
.c.o:
fukasawa e60969
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
fukasawa e60969
fukasawa e60969
all: libpng.a pngtest
fukasawa e60969
fukasawa e60969
# The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
fukasawa e60969
# copy this if the following doesn't work.
fukasawa e60969
pnglibconf.h: pnglibconf.dfn
fukasawa e60969
	$(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
fukasawa e60969
	$(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
fukasawa e60969
	$(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
fukasawa e60969
	$(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
fukasawa e60969
	$(AWK) -f "scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
fukasawa e60969
	mv pnglibconf.tmp $@
fukasawa e60969
fukasawa e60969
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
fukasawa e60969
	$(RM_F) $@ pnglibconf.pre pnglibconf.tmp
fukasawa e60969
	$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
fukasawa e60969
	$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
fukasawa e60969
	$(AWK) -f scripts/options.awk out="pnglibconf.pre"\
fukasawa e60969
	    version=search pngconf.h scripts/pnglibconf.dfa\
fukasawa e60969
	    pngusr.dfa $(DFA_XTRA) 1>&2
fukasawa e60969
	$(AWK) -f scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
fukasawa e60969
	mv pnglibconf.tmp $@
fukasawa e60969
fukasawa e60969
libpng.a: $(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 pnglibconf.h
fukasawa e60969
	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)
fukasawa e60969
	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
fukasawa e60969
	-@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
fukasawa e60969
	-@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
fukasawa e60969
	-@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
fukasawa e60969
	-@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.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 pnglibconf.h pnglibconf.c \
fukasawa e60969
	pnglibconf.out
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
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
pngpread.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