|
fukasawa |
e60969 |
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
|
|
fukasawa |
e60969 |
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
|
|
fukasawa |
e60969 |
# Glenn Randers-Pehrson
|
|
fukasawa |
e60969 |
# Copyright (C) 1996, 1997 Andreas Dilger
|
|
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 |
# Library name:
|
|
fukasawa |
e60969 |
LIBNAME = libpng16
|
|
fukasawa |
e60969 |
PNGMAJ = 16
|
|
fukasawa |
e60969 |
RELEASE = 21
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# Shared library names:
|
|
fukasawa |
e60969 |
LIBSO=$(LIBNAME).so
|
|
fukasawa |
e60969 |
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
|
fukasawa |
e60969 |
LIBSOREL=$(LIBSOMAJ).$(RELEASE)
|
|
fukasawa |
e60969 |
OLDSO=libpng.so
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# Utilities:
|
|
fukasawa |
e60969 |
AR_RC=ar rc
|
|
fukasawa |
e60969 |
CC=gcc
|
|
fukasawa |
e60969 |
MKDIR_P=mkdir -p
|
|
fukasawa |
e60969 |
LN_SF=ln -sf
|
|
fukasawa |
e60969 |
RANLIB=ranlib
|
|
fukasawa |
e60969 |
CP=cp
|
|
fukasawa |
e60969 |
RM_F=/bin/rm -f
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# where "make install" puts libpng16.a, libpng16.so*,
|
|
fukasawa |
e60969 |
# libpng16/png.h, libpng16/pngconf.h, and libpng16/pnglibconf.h
|
|
fukasawa |
e60969 |
# Prefix must be a full pathname.
|
|
fukasawa |
e60969 |
prefix=/usr/local
|
|
fukasawa |
e60969 |
exec_prefix=$(prefix)
|
|
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 |
ALIGN=
|
|
fukasawa |
e60969 |
# for i386:
|
|
fukasawa |
e60969 |
#ALIGN=-malign-loops=2 -malign-functions=2
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
|
fukasawa |
e60969 |
-Wmissing-declarations -Wtraditional -Wcast-align \
|
|
fukasawa |
e60969 |
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
|
fukasawa |
e60969 |
CFLAGS= -W -Wall -O3 -funroll-loops \
|
|
fukasawa |
e60969 |
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
|
fukasawa |
e60969 |
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
INCPATH=$(prefix)/include
|
|
fukasawa |
e60969 |
LIBPATH=$(exec_prefix)/lib
|
|
fukasawa |
e60969 |
MANPATH=$(prefix)/man
|
|
fukasawa |
e60969 |
BINPATH=$(exec_prefix)/bin
|
|
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 |
DB=$(DESTDIR)$(BINPATH)
|
|
fukasawa |
e60969 |
DI=$(DESTDIR)$(INCPATH)
|
|
fukasawa |
e60969 |
DL=$(DESTDIR)$(LIBPATH)
|
|
fukasawa |
e60969 |
DM=$(DESTDIR)$(MANPATH)
|
|
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 |
OBJSDLL = $(OBJS:.o=.pic.o)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
.SUFFIXES: .c .o .pic.o
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
.c.o:
|
|
fukasawa |
e60969 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
.c.pic.o:
|
|
fukasawa |
e60969 |
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
|
fukasawa |
e60969 |
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
libpng.a: $(OBJS)
|
|
fukasawa |
e60969 |
$(AR_RC) $@ $(OBJS)
|
|
fukasawa |
e60969 |
$(RANLIB) $@
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
libpng.pc:
|
|
fukasawa |
e60969 |
cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
|
|
fukasawa |
e60969 |
-e s!@exec_prefix@!$(exec_prefix)! \
|
|
fukasawa |
e60969 |
-e s!@libdir@!$(LIBPATH)! \
|
|
fukasawa |
e60969 |
-e s!@includedir@!$(INCPATH)! \
|
|
fukasawa |
e60969 |
-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
libpng-config:
|
|
fukasawa |
e60969 |
( cat scripts/libpng-config-head.in; \
|
|
fukasawa |
e60969 |
echo prefix=\"$(prefix)\"; \
|
|
fukasawa |
e60969 |
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
|
fukasawa |
e60969 |
echo L_opts=\"-L$(LIBPATH)\"; \
|
|
fukasawa |
e60969 |
echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
|
|
fukasawa |
e60969 |
echo libs=\"-lpng16 -lz -lm\"; \
|
|
fukasawa |
e60969 |
cat scripts/libpng-config-body.in ) > libpng-config
|
|
fukasawa |
e60969 |
chmod +x libpng-config
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
$(LIBSO): $(LIBSOMAJ)
|
|
fukasawa |
e60969 |
$(LN_SF) $(LIBSOMAJ) $(LIBSO)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
$(LIBSOMAJ): $(OBJSDLL)
|
|
fukasawa |
e60969 |
$(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
pngtest: pngtest.o $(LIBSO)
|
|
fukasawa |
e60969 |
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
pngtest-static: pngtest.o libpng.a
|
|
fukasawa |
e60969 |
$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
test: pngtest pngtest-static
|
|
fukasawa |
e60969 |
@echo ""
|
|
fukasawa |
e60969 |
@echo " Running pngtest dynamically linked with $(LIBSO):"
|
|
fukasawa |
e60969 |
@echo ""
|
|
fukasawa |
e60969 |
./pngtest
|
|
fukasawa |
e60969 |
@echo ""
|
|
fukasawa |
e60969 |
@echo " Running pngtest statically linked with libpng.a:"
|
|
fukasawa |
e60969 |
@echo ""
|
|
fukasawa |
e60969 |
./pngtest-static
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
install-headers: png.h pngconf.h pnglibconf.h
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
|
fukasawa |
e60969 |
cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
|
|
fukasawa |
e60969 |
chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DI)/libpng
|
|
fukasawa |
e60969 |
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
install-static: install-headers libpng.a
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
|
fukasawa |
e60969 |
cp libpng.a $(DL)/$(LIBNAME).a
|
|
fukasawa |
e60969 |
chmod 644 $(DL)/$(LIBNAME).a
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DL)/libpng.a
|
|
fukasawa |
e60969 |
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
install-shared: install-headers $(LIBSOMAJ) libpng.pc
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DL)/$(LIBSO)
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DL)/$(LIBSOREL)
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DL)/$(OLDSO)
|
|
fukasawa |
e60969 |
cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
|
|
fukasawa |
e60969 |
chmod 755 $(DL)/$(LIBSOREL)
|
|
fukasawa |
e60969 |
(cd $(DL); \
|
|
fukasawa |
e60969 |
$(LN_SF) $(LIBSOREL) $(LIBSO); \
|
|
fukasawa |
e60969 |
$(LN_SF) $(LIBSO) $(OLDSO))
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DL)/pkgconfig/libpng.pc
|
|
fukasawa |
e60969 |
cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
|
|
fukasawa |
e60969 |
chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
|
|
fukasawa |
e60969 |
(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
install-man: libpng.3 libpngpf.3 png.5
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DM)/man3/libpng.3
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DM)/man3/libpngpf.3
|
|
fukasawa |
e60969 |
cp libpng.3 $(DM)/man3
|
|
fukasawa |
e60969 |
cp libpngpf.3 $(DM)/man3
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DM)/man5/png.5
|
|
fukasawa |
e60969 |
cp png.5 $(DM)/man5
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
install-config: libpng-config
|
|
fukasawa |
e60969 |
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DB)/libpng-config
|
|
fukasawa |
e60969 |
-@$(RM_F) $(DB)/$(LIBNAME)-config
|
|
fukasawa |
e60969 |
cp libpng-config $(DB)/$(LIBNAME)-config
|
|
fukasawa |
e60969 |
chmod 755 $(DB)/$(LIBNAME)-config
|
|
fukasawa |
e60969 |
(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
install: install-static install-shared install-man install-config
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
# If you installed in $(DESTDIR), test-installed won't work until you
|
|
fukasawa |
e60969 |
# move the library to its final location. Use test-dd to test it
|
|
fukasawa |
e60969 |
# before then.
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
test-dd:
|
|
fukasawa |
e60969 |
echo
|
|
fukasawa |
e60969 |
echo Testing installed dynamic shared library in $(DL).
|
|
fukasawa |
e60969 |
$(CC) -I$(DI) $(CPPFLAGS) \
|
|
fukasawa |
e60969 |
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
|
fukasawa |
e60969 |
-L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
|
fukasawa |
e60969 |
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
fukasawa |
e60969 |
./pngtestd pngtest.png
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
test-installed:
|
|
fukasawa |
e60969 |
$(CC) $(CPPFLAGS) \
|
|
fukasawa |
e60969 |
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
|
fukasawa |
e60969 |
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
|
fukasawa |
e60969 |
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
fukasawa |
e60969 |
./pngtesti pngtest.png
|
|
fukasawa |
e60969 |
|
|
fukasawa |
e60969 |
clean:
|
|
fukasawa |
e60969 |
$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
|
|
fukasawa |
e60969 |
$(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
|
|
fukasawa |
e60969 |
libpng.pc 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.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
fukasawa |
e60969 |
pngpread.o pngpread.pic.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
|