fukasawa e60969
# makefile for libpng using gcc (generic, static library)
fukasawa e60969
# Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson
fukasawa e60969
# Copyright (C) 2000 Cosmin Truta
fukasawa e60969
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
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
# Location of the zlib library and include files
fukasawa e60969
ZLIBINC = ../zlib
fukasawa e60969
ZLIBLIB = ../zlib
fukasawa e60969
fukasawa e60969
# Compiler, linker, lib and other tools
fukasawa e60969
CC = gcc
fukasawa e60969
LD = $(CC)
fukasawa e60969
AR_RC = ar rcs
fukasawa e60969
MKDIR_P = mkdir -p
fukasawa e60969
RANLIB = ranlib
fukasawa e60969
RM_F = rm -f
fukasawa e60969
LN_SF = ln -f -s
fukasawa e60969
fukasawa e60969
LIBNAME = libpng16
fukasawa e60969
PNGMAJ = 16
fukasawa e60969
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
DI=$(DESTDIR)$(INCPATH)
fukasawa e60969
DL=$(DESTDIR)$(LIBPATH)
fukasawa e60969
fukasawa e60969
WARNMORE =
fukasawa e60969
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
fukasawa e60969
CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
fukasawa e60969
LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm
fukasawa e60969
fukasawa e60969
# Variables
fukasawa e60969
OBJS =  png.o pngerror.o pngget.o pngmem.o pngpread.o \
fukasawa e60969
	pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
fukasawa e60969
	pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
fukasawa e60969
fukasawa e60969
# Targets
fukasawa e60969
.c.o:
fukasawa e60969
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
fukasawa e60969
fukasawa e60969
all: $(LIBNAME).a pngtest$(E)
fukasawa e60969
fukasawa e60969
include scripts/pnglibconf.mak
fukasawa e60969
REMOVE = $(RM_F)
fukasawa e60969
DFNFLAGS = $(DEFS) $(CPPFLAGS)
fukasawa e60969
fukasawa e60969
$(LIBNAME).a: $(OBJS)
fukasawa e60969
	$(AR_RC) $@ $(OBJS)
fukasawa e60969
	$(RANLIB) $@
fukasawa e60969
fukasawa e60969
test: pngtest$(E)
fukasawa e60969
	./pngtest$(E)
fukasawa e60969
fukasawa e60969
pngtest$(E): pngtest.o $(LIBNAME).a
fukasawa e60969
	$(LD) -o $@ pngtest.o $(LDFLAGS)
fukasawa e60969
fukasawa e60969
install: $(LIBNAME).a
fukasawa e60969
	-@if [ ! -d $(DI)  ]; then $(MKDIR_P) $(DI); fi
fukasawa e60969
	-@if [ ! -d $(DI)/$(LIBNAME)  ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
fukasawa e60969
	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
fukasawa e60969
	-@$(RM_F) $(DI)/$(LIBNAME)/png.h
fukasawa e60969
	-@$(RM_F) $(DI)/$(LIBNAME)/pngconf.h
fukasawa e60969
	-@$(RM_F) $(DI)/$(LIBNAME)/pnglibconf.h
fukasawa e60969
	-@$(RM_F) $(DI)/png.h
fukasawa e60969
	-@$(RM_F) $(DI)/pngconf.h
fukasawa e60969
	-@$(RM_F) $(DI)/pnglibconf.h
fukasawa e60969
	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
fukasawa e60969
	chmod 644 $(DI)/$(LIBNAME)/png.h \
fukasawa e60969
	$(DI)/$(LIBNAME)/pngconf.h \
fukasawa e60969
	$(DI)/$(LIBNAME)/pnglibconf.h
fukasawa e60969
	-@$(RM_F) -r $(DI)/libpng
fukasawa e60969
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
fukasawa e60969
	-@$(RM_F) $(DL)/$(LIBNAME).a
fukasawa e60969
	-@$(RM_F) $(DL)/libpng.a
fukasawa e60969
	cp $(LIBNAME).a $(DL)/$(LIBNAME).a
fukasawa e60969
	chmod 644 $(DL)/$(LIBNAME).a
fukasawa e60969
	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
fukasawa e60969
	(cd $(DI); $(LN_SF) libpng/* .;)
fukasawa e60969
fukasawa e60969
clean:
fukasawa e60969
	$(RM_F) *.o $(LIBNAME).a pngtest pngout.png pnglibconf.h
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
pngget.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
pngpread.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
pngrio.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
pngset.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
pngwio.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