Imported from libpng-1.2.9beta7.tar
diff --git a/scripts/libpng-config-head.in b/scripts/libpng-config-head.in
index 64dd8c3..ea593eb 100755
--- a/scripts/libpng-config-head.in
+++ b/scripts/libpng-config-head.in
@@ -8,7 +8,7 @@
 
 # Modeled after libxml-config.
 
-version=1.2.9beta6
+version=1.2.9beta7
 prefix=""
 libdir=""
 libs=""
diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu
index d686d21..37ab668 100644
--- a/scripts/makefile.32sunu
+++ b/scripts/makefile.32sunu
@@ -1,16 +1,28 @@
 # makefile for libpng on Solaris 2.x with cc
 # Contributed by William L. Sebok, based on makefile.linux
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1998 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
+LIBNAME=libpng12
+PNGMAJ = 0
+PNGMIN = 1.2.9beta7
+PNGVER = $(PNGMAJ).$(PNGMIN)
+
 CC=cc
+AR_RC=ar rc
+MKDIR_P=mkdir -p
+LN_SF=ln -f -s
+RANLIB=echo
+RM_F=/bin/rm -f
+
 SUN_CC_FLAGS=-fast -xtarget=ultra
 SUN_LD_FLAGS=-fast -xtarget=ultra
 
 # where make install puts libpng.a, libpng12.so and libpng12/png.h
 prefix=/a
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 # Changing these to ../zlib poses a security risk.  If you want
@@ -28,18 +40,10 @@
 	# $(WARNMORE) -g -DPNG_DEBUG=5
 LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm
 
-#RANLIB=ranlib
-RANLIB=echo
-
-LIBNAME=libpng12
-PNGMAJ = 0
-PNGMIN = 1.2.9beta6
-PNGVER = $(PNGMAJ).$(PNGMIN)
-
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -70,7 +74,7 @@
 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -90,10 +94,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	@case "`type ld`" in *ucb*) \
@@ -111,7 +115,7 @@
 	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h $(LIBNAME).so.$(PNGMAJ) \
 	 -o $(LIBNAME).so.$(PNGVER) $(OBJSDLL)
 
-libpng.so.0.$(PNGMIN): $(OBJS)
+libpng.so.0.$(PNGMIN): $(OBJSDLL)
 	$(LD) -G -L$(ZLIBLIB) -R$(ZLIBLIB) -h libpng.so.0 \
 	 -o libpng.so.0.$(PNGMIN)  $(OBJSDLL)
 
@@ -126,59 +130,60 @@
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGVER)*
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGVER)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -f -s libpng.so.0 libpng.so; \
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/libpng12.pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
-	cp libpng.pc $(DL)/pkgconfig/libpng12.pc
-	chmod 644 $(DL)/pkgconfig/libpng12.pc
-	(cd $(DL)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
+	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
+	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
 	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
 	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/libpng12-config
-	cp libpng-config $(DB)/libpng12-config
-	chmod 755 $(DB)/libpng12-config
-	(cd $(DB); ln -f -s libpng12-config libpng-config)
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
+	cp libpng-config $(DB)/$(LIBNAME)-config
+	chmod 755 $(DB)/$(LIBNAME)-config
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -190,8 +195,8 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
 	./pngtestd pngtest.png
 
@@ -199,13 +204,13 @@
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu
index fcd38a1..764ec32 100644
--- a/scripts/makefile.64sunu
+++ b/scripts/makefile.64sunu
@@ -1,16 +1,28 @@
 # makefile for libpng on Solaris 2.x with cc
 # Contributed by William L. Sebok, based on makefile.linux
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1998 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
+LIBNAME=libpng12
+PNGMAJ = 0
+PNGMIN = 1.2.9beta7
+PNGVER = $(PNGMAJ).$(PNGMIN)
+
 CC=cc
+AR_RC=ar rc
+MKDIR_P=mkdir -p
+LN_SF=ln -f -s
+RANLIB=echo
+RM_F=/bin/rm -f
+
 SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9
 SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9
 
 # where make install puts libpng.a, libpng12.so and libpng12/png.h
 prefix=/a
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 # Changing these to ../zlib poses a security risk.  If you want
@@ -28,18 +40,10 @@
 	# $(WARNMORE) -g -DPNG_DEBUG=5
 LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
 
-#RANLIB=ranlib
-RANLIB=echo
-
-LIBNAME=libpng12
-PNGMAJ = 0
-PNGMIN = 1.2.9beta6
-PNGVER = $(PNGMAJ).$(PNGMIN)
-
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -70,7 +74,7 @@
 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -90,10 +94,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	@case "`type ld`" in *ucb*) \
@@ -126,60 +130,60 @@
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ).$(PNGVER)*
-	-@/bin/rm -f $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGVER)*
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGVER)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -f -s libpng.so.0 libpng.so; \
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
 	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
 	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -f -s $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -191,8 +195,8 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
 	./pngtestd pngtest.png
 
@@ -200,13 +204,13 @@
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags ` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
index 10c9b9e..6687db9 100644
--- a/scripts/makefile.aix
+++ b/scripts/makefile.aix
@@ -1,5 +1,5 @@
 # makefile for libpng using gcc (generic, static library)
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 2000 Cosmin Truta
 # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
@@ -12,13 +12,14 @@
 # Compiler, linker, lib and other tools
 CC = gcc
 LD = $(CC)
-AR = ar rcs
+AR_RC = ar rcs
 RANLIB = ranlib
-RM = rm -f
+RM_F = rm -f
+LN_SF = ln -f -s
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 prefix=/usr/local
@@ -60,7 +61,7 @@
 all: $(LIBNAME)$(A) pngtest$(E)
 
 $(LIBNAME)$(A): $(OBJS)
-	$(AR) $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 test: pngtest$(E)
@@ -73,24 +74,24 @@
 	-@if [ ! -d $(DI)  ]; then mkdir $(DI); fi
 	-@if [ ! -d $(DI)/$(LIBNAME)  ]; then mkdir $(DI)/$(LIBNAME); fi
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@rm -f $(DI)/$(LIBNAME)/png.h
-	-@rm -f $(DI)/$(LIBNAME)/pngconf.h
-	-@rm -f $(DI)/png.h
-	-@rm -f $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/$(LIBNAME)/png.h
+	-@$(RM_F) $(DI)/$(LIBNAME)/pngconf.h
+	-@$(RM_F) $(DI)/png.h
+	-@$(RM_F) $(DI)/pngconf.h
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h \
 	$(DI)/$(LIBNAME)/pngconf.h
-	-@rm -rf $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
-	-@rm -f $(DL)/$(LIBNAME)$(A)
-	-@rm -f $(DL)/libpng$(A)
+	-@$(RM_F) -r $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
+	-@$(RM_F) $(DL)/$(LIBNAME)$(A)
+	-@$(RM_F) $(DL)/libpng$(A)
 	cp $(LIBNAME)$(A) $(DL)/$(LIBNAME)$(A)
 	chmod 644 $(DL)/$(LIBNAME)$(A)
-	(cd $(DL); ln -f -s $(LIBNAME)$(A) libpng$(A))
-	(cd $(DI); ln -f -s libpng/* .;)
+	(cd $(DL); $(LN_SF) $(LIBNAME)$(A) libpng$(A))
+	(cd $(DI); $(LN_SF) libpng/* .;)
 
 clean:
-	/bin/rm -f *.o $(LIBNAME)$(A) pngtest pngout.png
+	$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png
 
 png$(O): png.h pngconf.h
 pngerror$(O): png.h pngconf.h
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 4963f95..439dc97 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -1,18 +1,23 @@
 # makefile for libpng on BeOS x86 ELF with gcc
 # modified from makefile.linux by Sander Stoks
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1999 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
 CC=gcc
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
 
 # Where the zlib library and include files are located
 ZLIBLIB=/usr/local/lib
 ZLIBINC=/usr/local/include
 
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 ALIGN=
@@ -30,15 +35,13 @@
 # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
 LDFLAGS=-L. -Wl,-soname=$(LIBNAME).so.$(PNGMAJ) -L$(ZLIBLIB) -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
-
 # where make install puts libpng.a, libpng12.so*, and png.h
 prefix=/usr/local
+exec_prefix=$prefix
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -68,7 +71,7 @@
 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -83,11 +86,11 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 	cp $(LIBNAME).so* /boot/home/config/lib
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	$(CC) -nostart -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o \
@@ -104,63 +107,63 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -sf libpng.so.0 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -172,20 +175,20 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) $(CFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) -W1,-rpath $(ZLIBLIB):$(DL) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	$(CC) $(CFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
+	$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtesti \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index d76a561..4c81c91 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -46,6 +46,7 @@
 prefix=/usr
 $(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
 endif
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 ZLIBLIB= /usr/lib
@@ -79,7 +80,7 @@
 LIBNAME = libpng12
 PNGMAJ = 0
 CYGDLL = 12
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 SHAREDLIB=cygpng$(CYGDLL).dll
@@ -98,9 +99,9 @@
 #RANLIB=echo
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 MANPATH=$(prefix)/man
 MAN3PATH=$(MANPATH)/man3
 MAN5PATH=$(MANPATH)/man5
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index 47713ac..fdcaa8c 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -1,5 +1,5 @@
 # makefile for libpng on Darwin / Mac OS X
-# Copyright (C) 2002,2004 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2004, 2006 Glenn Randers-Pehrson
 # Copyright (C) 2001 Christoph Pfisterer
 # derived from makefile.linux:
 #  Copyright (C) 1998, 1999 Greg Roelofs
@@ -8,6 +8,7 @@
 
 # where "make install" puts libpng.a, libpng12.dylib, png.h and pngconf.h
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib
@@ -16,21 +17,24 @@
 ZLIBINC=../zlib
 
 CC=cc
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
+
 CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
 
-#RANLIB=echo
-RANLIB=ranlib
-
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -61,7 +65,7 @@
 all: libpng.a $(LIBNAME).dylib pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -78,10 +82,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib
-	ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
+	$(LN_SF) $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
 
 $(LIBNAME).$(PNGMAJ).dylib: $(LIBNAME).$(PNGVER).dylib
-	ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib
+	$(LN_SF) $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib
 
 $(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
 	$(CC) -dynamiclib \
@@ -108,61 +112,61 @@
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
 	$(RANLIB) $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).dylib libpng.pc \
 	libpng.3.$(PNGMIN).dylib
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).$(PNGVER)*.dylib
-	-@/bin/rm -f $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
-	-@/bin/rm -f $(DL)/$(LIBNAME).dylib
-	-@/bin/rm -f $(DL)/libpng.dylib
-	-@/bin/rm -f $(DL)/libpng.3.dylib
-	-@/bin/rm -f $(DL)/libpng.3.$(PNGMIN)*.dylib
+	-@$(RM_F) $(DL)/$(LIBNAME).$(PNGVER)*.dylib
+	-@$(RM_F) $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
+	-@$(RM_F) $(DL)/$(LIBNAME).dylib
+	-@$(RM_F) $(DL)/libpng.dylib
+	-@$(RM_F) $(DL)/libpng.3.dylib
+	-@$(RM_F) $(DL)/libpng.3.$(PNGMIN)*.dylib
 	cp $(LIBNAME).$(PNGVER).dylib $(DL)
 	cp libpng.3.$(PNGMIN).dylib $(DL)
 	chmod 755 $(DL)/$(LIBNAME).$(PNGVER).dylib
 	chmod 755 $(DL)/libpng.3.$(PNGMIN).dylib
 	(cd $(DL); \
-	ln -sf libpng.3.$(PNGMIN).dylib libpng.3.dylib; \
-	ln -sf libpng.3.dylib libpng.dylib; \
-	ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
-	ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
+	$(LN_SF) libpng.3.$(PNGMIN).dylib libpng.3.dylib; \
+	$(LN_SF) libpng.3.dylib libpng.dylib; \
+	$(LN_SF) $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
+	$(LN_SF) $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
 	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
 	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -174,20 +178,20 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	$(CC) $(CFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	rm -f *.o libpng.a pngtest pngout.png libpng-config \
+	$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
 	libpng.3.$(PNGMIN).dylib \
 	libpng.pc $(LIBNAME).*dylib pngtesti
 
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index b35960a..904b00c 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -1,14 +1,15 @@
 # makefile for libpng on DEC Alpha Unix
-# Copyright (C) 2000-2002 Glenn Randers-Pehrson
+# Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
 # where make install puts libpng.a and png.h
 prefix=/usr/local
+exec_prefix=$prefix
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -32,17 +33,20 @@
 ZLIBINC=../zlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
+AR_RC=ar rc
 CC=cc
+MKDIR_P=mkdir
+LN_SF=ln -f -s
+RANLIB=ranlib
+RM_F=/bin/rm -f
+
 CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
 LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
 
-#RANLIB=echo
-RANLIB=ranlib
-
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 	pngwtran.o pngmem.o pngerror.o pngpread.o
@@ -50,7 +54,7 @@
 all: $(LIBNAME).so libpng.a pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@  $(OBJS)
+	$(AR_RC) $@  $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -67,10 +71,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJS)
 	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
@@ -93,14 +97,14 @@
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
 	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
 	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	(cd $(DI); $(LN_SF)(LIBNAME) libpng; $(LN_SF)(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
 	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	(cd $(DL); $(LN_SF)(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
@@ -115,16 +119,16 @@
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -f -s libpng.so.0 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF)(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF)(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
 	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
 	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
@@ -143,7 +147,7 @@
 	-@/bin/rm -f $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -155,18 +159,18 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -w1 -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) -w1 -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) -R$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
diff --git a/scripts/makefile.elf b/scripts/makefile.elf
index 8e3318f..6c1f10a 100644
--- a/scripts/makefile.elf
+++ b/scripts/makefile.elf
@@ -1,25 +1,37 @@
 # makefile for libpng.a and libpng12.so on Linux ELF with gcc
-# Copyright (C) 1998, 1999, 2002 Greg Roelofs and Glenn Randers-Pehrson
+# Copyright (C) 1998, 1999, 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
+# Modified for Debian by Junichi Uekawa and Josselin Mouette
+# Major modifications are:
+#    * link libpng explicitly with libz and libm
+#    * libpng.so.%OLDSONUM% is a symlink rather than a different library
+#    * versioned symbols
+
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
+AR_RC=ar rc
 CC=gcc
+MKDIR_P=mkdir -p
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
 
 # where "make install" puts libpng12.a, libpng12.so*,
 # libpng12/png.h and libpng12/pngconf.h
 # Prefix must be a full pathname.
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located.
-#ZLIBLIB=/usr/local/lib
-#ZLIBINC=/usr/local/include
-ZLIBLIB=../zlib
-ZLIBINC=../zlib
+ZLIBLIB=/usr/local/lib
+ZLIBINC=/usr/local/include
+# ZLIBLIB=../zlib
+# ZLIBINC=../zlib
 
 ALIGN=
 # for i386:
@@ -31,19 +43,18 @@
 
 # for pgcc version 2.95.1, -O3 is buggy; don't use it.
 
-CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
+CFLAGS=-Wall -D_REENTRANT -O2 \
 	$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
 
-LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
-LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
+LDFLAGS=-L. -lpng12
+LDFLAGS_A=libpng.a -lz -lm
+LIBADDFLAGS=-lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -74,15 +85,15 @@
 all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
 	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 
 libpng.syms: png.h pngconf.h
-	$(CC) $(CFLAGS) -E -DPNG_BUILDSYMS png.h |\
-	awk -F '[\t [\]();]' 'BEGIN{print "{global:"}\
+	$(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\
+	awk -F '[\t [\\]();]' -v PNGMAJ=$(PNGMAJ) 'BEGIN{printf("PNG12_%s {global:\n",PNGMAJ)}\
 	{ for (i=1;i+2<=NF;++i)\
 		if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\
 			print $$(i+1) ";";\
@@ -90,24 +101,25 @@
 		if ($$(i)=="PNG_DATA_EXPORT")\
 			print $$(i+1) ";";}\
 	END{print "local: *; };"}' >$@.new
-	rm -f $@
+	$(RM_F) $@
 	mv $@.new $@
 
 libpng-config:
 	( cat scripts/libpng-config-head.in; \
 	echo prefix=\"$(prefix)\"; \
 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
-	echo L_opts=\"-L$(LIBPATH)\"; \
-	echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
-	echo libs=\"-lpng12 -lz -lm\"; \
+	echo L_opts=\"\"; \
+	echo R_opts=\"\"; \
+	echo libs=\"-lpng12\"; \
+	echo all_libs=\"-lpng12 $(LIBADDFLAGS)\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL) libpng.syms
 	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
@@ -131,70 +143,70 @@
 	@echo ""
 	@echo "   Running pngtest dynamically linked with $(LIBNAME).so:"
 	@echo ""
-	./pngtest
+	LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}" ./pngtest
 	@echo ""
 	@echo "   Running pngtest statically linked with libpng.a:"
 	@echo ""
 	./pngtest-static
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -sf libpng.so.0 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -206,20 +218,20 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) -W1, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a libpng.syms pngtest pngout.png libpng-config \
+	$(RM_F) *.o libpng.a libpng.syms pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.gcc b/scripts/makefile.gcc
index f7fc368..22daedd 100644
--- a/scripts/makefile.gcc
+++ b/scripts/makefile.gcc
@@ -10,9 +10,9 @@
 # Compiler, linker, lib and other tools
 CC = gcc
 LD = $(CC)
-AR = ar rcs
+AR_RC = ar rcs
 RANLIB = ranlib
-RM = rm -f
+RM_F = rm -f
 
 CDEBUG = -g -DPNG_DEBUG=5
 LDDEBUG =
@@ -35,7 +35,7 @@
 all: libpng$(A) pngtest$(E)
 
 libpng$(A): $(OBJS)
-	$(AR) $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 test: pngtest$(E)
@@ -45,7 +45,7 @@
 	$(LD) -o $@ pngtest$(O) $(LDFLAGS)
 
 clean:
-	$(RM) *$(O) libpng$(A) pngtest$(E) pngout.png
+	$(RM_F) *$(O) libpng$(A) pngtest$(E) pngout.png
 
 png$(O): png.h pngconf.h
 pngerror$(O): png.h pngconf.h
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index d026046..96fb8a8 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -1,6 +1,6 @@
 # makefile for libpng.a and libpng12.so on Linux ELF with gcc using MMX
 # assembler code
-# Copyright 2002 Greg Roelofs and Glenn Randers-Pehrson
+# Copyright 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson
 # Copyright 1998-2001 Greg Roelofs
 # Copyright 1996-1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
@@ -15,15 +15,23 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
-CC=gcc
+# Compiler, linker, lib and other tools
+CC = gcc
+LD = $(CC)
+AR_RC = ar rc
+LN_SF = ln -sf
+MKDIR_P = mkdir
+RANLIB = ranlib
+RM_F = /bin/rm -f
 
 # where "make install" puts libpng12.a, libpng12.so*,
 # libpng12/png.h and libpng12/pngconf.h
 # Prefix must be a full pathname.
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located.
 #ZLIBLIB=/usr/local/lib
@@ -58,13 +66,11 @@
 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -95,7 +101,7 @@
 all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -119,10 +125,10 @@
 	$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
@@ -151,63 +157,63 @@
 	./pngtest-static
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -sf libpng.so.0 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -219,20 +225,20 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) -W1, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
+	$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.hp64 b/scripts/makefile.hp64
index 0305bb0..b5c80a4 100644
--- a/scripts/makefile.hp64
+++ b/scripts/makefile.hp64
@@ -15,7 +15,13 @@
 #   LDSHARED=ld -b
 #   SHAREDLIB=libz.sl
 
+AR_RC=ar rc
 CC=cc
+MKDIR_P=mkdir
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
+
 CFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
 # Caution: be sure you have built zlib with the same CFLAGS.
@@ -24,19 +30,19 @@
 
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 
-RANLIB=ranlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 # where make install puts libpng.a, libpng12.sl, and png.h
 prefix=/opt/libpng
+exec_prefix=$prefix
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -67,7 +73,7 @@
 all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -84,10 +90,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
-	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
+	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
 
 $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
-	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
 
 $(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
 	$(LD) -b +s \
@@ -104,63 +110,63 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
 	libpng.sl.3.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
-	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.sl
-	-@/bin/rm -f $(DL)/libpng.sl.3
-	-@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
+	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.sl
+	-@$(RM_F) $(DL)/libpng.sl.3
+	-@$(RM_F) $(DL)/libpng.sl.3.$(PNGMIN)*
 	cp $(LIBNAME).sl.$(PNGVER) $(DL)
 	cp libpng.sl.3.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
 	chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
-	ln -sf libpng.sl.3 libpng.sl; \
-	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
-	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.sl.3.$(PNGMIN) libpng.sl.3; \
+	$(LN_SF) libpng.sl.3 libpng.sl; \
+	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -172,22 +178,22 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) $(CCFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
 	libpng.sl.3.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc
index 11f8dda..206f5f0 100644
--- a/scripts/makefile.hpgcc
+++ b/scripts/makefile.hpgcc
@@ -1,5 +1,5 @@
 # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
-# Copyright (C) 2002, Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 2001, Laurent faillie
 # Copyright (C) 1998, 1999 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
@@ -7,9 +7,15 @@
 
 CC=gcc
 LD=ld
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
 
 # where "make install" puts libpng.a, libpng.sl*, png.h and pngconf.h
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 ZLIBLIB=/opt/zlib/lib
@@ -37,18 +43,15 @@
 #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
-
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -79,7 +82,7 @@
 all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -94,10 +97,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
-	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
+	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
 
 $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
-	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
 
 $(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
 	$(LD) -b +s \
@@ -115,63 +118,63 @@
 
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
 	libpng.sl.3.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
-	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.sl
-	-@/bin/rm -f $(DL)/libpng.sl.3
-	-@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
+	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.sl
+	-@$(RM_F) $(DL)/libpng.sl.3
+	-@$(RM_F) $(DL)/libpng.sl.3.$(PNGMIN)*
 	cp $(LIBNAME).sl.$(PNGVER) $(DL)
 	cp libpng.sl.3.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
 	chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
-	ln -sf libpng.sl.3 libpng.sl; \
-	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
-	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.sl.3.$(PNGMIN) libpng.sl.3; \
+	$(LN_SF) libpng.sl.3 libpng.sl; \
+	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -183,22 +186,22 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) -W1,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
 	libpng.sl.3.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index d12c7ab..635bfe2 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -1,5 +1,5 @@
 # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
-# Copyright (C) 1999-2002 Glenn Randers-Pehrson
+# Copyright (C) 1999-2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42
 # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
 # For conditions of distribution and use, see copyright notice in png.h
@@ -15,25 +15,30 @@
 #   LDSHARED=ld -b
 #   SHAREDLIB=libz.sl
 
+AR_RC=ar rc
 CC=cc
+MKDIR_P=mkdir
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
+
 CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
 # Caution: be sure you have built zlib with the same CFLAGS.
 CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 
-RANLIB=ranlib
-
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 # where make install puts libpng.a, libpng12.sl, and png.h
 prefix=/opt/libpng
+exec_prefix=$prefix
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -64,7 +69,7 @@
 all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -81,10 +86,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
-	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
+	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
 
 $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
-	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
 
 $(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
 	$(LD) -b +s \
@@ -101,63 +106,63 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
 	libpng.sl.3.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
-	-@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.sl
-	-@/bin/rm -f $(DL)/libpng.sl.3
-	-@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
+	-@$(RM_F) $(DL)/$(LIBNAME).sl.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.sl
+	-@$(RM_F) $(DL)/libpng.sl.3
+	-@$(RM_F) $(DL)/libpng.sl.3.$(PNGMIN)*
 	cp $(LIBNAME).sl.$(PNGVER) $(DL)
 	cp libpng.sl.3.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
 	chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
-	ln -sf libpng.sl.3 libpng.sl; \
-	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
-	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.sl.3.$(PNGMIN) libpng.sl.3; \
+	$(LN_SF) libpng.sl.3 libpng.sl; \
+	$(LN_SF) $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -169,22 +174,22 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) $(CCFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
 	libpng.sl.3.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index 8e3c639..88948df 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -1,19 +1,25 @@
 # makefile for libpng.a and libpng12.so on Linux ELF with gcc
-# Copyright (C) 1998, 1999, 2002 Greg Roelofs and Glenn Randers-Pehrson
+# Copyright (C) 1998, 1999, 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
+AR_RC=ar rc
 CC=gcc
+MKDIR_P=mkdir -p
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=/bin/rm -f
 
 # where "make install" puts libpng12.a, libpng12.so*,
 # libpng12/png.h and libpng12/pngconf.h
 # Prefix must be a full pathname.
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located.
 #ZLIBLIB=/usr/local/lib
@@ -37,13 +43,10 @@
 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
-
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -74,7 +77,7 @@
 all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -91,10 +94,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
@@ -123,63 +126,63 @@
 	./pngtest-static
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -sf libpng.so.0 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -191,20 +194,20 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) -W1, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
+	$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd
index a9bceb5..e93e020 100644
--- a/scripts/makefile.ne12bsd
+++ b/scripts/makefile.ne12bsd
@@ -13,7 +13,7 @@
 
 LIB=	png12
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.9beta6
+SHLIB_MINOR=	1.2.9beta7
 SRCS=	pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
 		pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
 		pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd
index ef2dc2d..9cf8bf1 100644
--- a/scripts/makefile.netbsd
+++ b/scripts/makefile.netbsd
@@ -13,7 +13,7 @@
 
 LIB=	png
 SHLIB_MAJOR=	3
-SHLIB_MINOR=	1.2.9beta6
+SHLIB_MINOR=	1.2.9beta7
 SRCS=	pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
 		pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
 		pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd
index f028610..78ccb66 100644
--- a/scripts/makefile.openbsd
+++ b/scripts/makefile.openbsd
@@ -7,7 +7,7 @@
 MANDIR= ${PREFIX}/man/cat
 
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.9beta6
+SHLIB_MINOR=	1.2.9beta7
 
 LIB=	png
 SRCS=	png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index b760514..14c2685 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -1,15 +1,21 @@
 # makefile for SCO OSr5  ELF and Unixware 7 with Native cc
 # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
 #   force ELF build dynamic linking, SONAME setting in lib and RPATH in app
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1998 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
 CC=cc
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -f -s
+RANLIB=echo
+RM_F=/bin/rm -f
 
 # where make install puts libpng.a, libpng.so*, and png.h
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib
@@ -20,18 +26,15 @@
 CFLAGS= -dy -belf -I$(ZLIBINC) -O3
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
 
-#RANLIB=ranlib
-RANLIB=echo
-
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include/libpng
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -62,7 +65,7 @@
 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -79,10 +82,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_FS) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	$(CC) -G  -Wl,-h,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
@@ -101,63 +104,63 @@
 install-headers: png.h pngconf.h
 	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
-	-@/bin/rm -f $(DI)/png.h
-	-@/bin/rm -f $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/png.h
+	-@$(RM_F) $(DI)/pngconf.h
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_FS) $(LIBNAME) libpng; $(LN_FS) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_FS) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -f -s libpng.so.0 libpng.so; \
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	$(LN_FS) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_FS) libpng.so.0 libpng.so; \
+	$(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_FS) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_FS) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
 	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
 	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -f -s $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_FS) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -169,20 +172,20 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) $(CFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	$(CC) $(CFLAGS) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
+	$(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index c6d10a4..d1cc492 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -1,5 +1,5 @@
 # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
-# Copyright (C) 2001-2002 Glenn Randers-Pehrson
+# Copyright (C) 2001-2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
@@ -7,6 +7,7 @@
 # Prefix must be a full pathname.
 
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib32
@@ -18,9 +19,15 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
+
+AR_RC=ar rc
 CC=gcc
+MKDIR_P=mkdir -p
+LN_SF=ln -sf
+RANLIB=echo
+RM_F=/bin/rm -f
 
 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
 # See "man abi".  zlib must be built with the same ABI.
@@ -39,10 +46,10 @@
 #RANLIB=ranlib
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
-#LIBPATH=$(prefix)/lib32
+LIBPATH=$(exec_prefix)/lib
+#LIBPATH=$(exec_prefix)/lib32
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -66,7 +73,7 @@
 all: libpng.a pngtest shared libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 shared: $(LIBNAME).so.$(PNGVER)
@@ -94,7 +101,7 @@
 
 $(LIBNAME).so.$(PNGVER): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
-	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
+	$(RM_F) $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
 
 libpng.so.0.$(PNGMIN): $(OBJS)
 	$(LDLEGACY) -o $@ $(OBJS)
@@ -112,25 +119,25 @@
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
 	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
+	-@$(RM_F) $(DL)/libpng.a
 	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
@@ -141,8 +148,8 @@
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
 	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
@@ -150,18 +157,18 @@
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
 	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
 	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
 	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
@@ -176,24 +183,24 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) \
            -rpath $(ZLIBLIB):$(DL)\
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) \
-           -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+           -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
+	$(RM_F)libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
 	libpng.so.0.$(PNGMIN) \
 	so_locations
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index 8745a9d..3128f8c 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -1,17 +1,18 @@
 # makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
-# Copyright (C) 2001-2002 Glenn Randers-Pehrson
+# Copyright (C) 2001-2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 # Where make install puts libpng.a, libpng12.so, and libpng12/png.h
 # Prefix must be a full pathname.
 
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib32
@@ -21,7 +22,12 @@
 ZLIBLIB=../zlib
 ZLIBINC=../zlib
 
+AR_RC=ar rc
 CC=cc
+MKDIR_P=mkdir -p
+LN_SF=ln -sf
+RANLIB=echo
+RM_F=/bin/rm -f
 
 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
 # See "man abi".  zlib must be built with the same ABI.
@@ -40,14 +46,11 @@
   -set_version sgi$3.0
 # See "man dso" for info about shared objects
 
-RANLIB=echo
-#RANLIB=ranlib
-
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
-#LIBPATH=$(prefix)/lib32
+LIBPATH=$(exec_prefix)/lib
+#LIBPATH=$(exec_prefix)/lib32
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -71,7 +74,7 @@
 all: libpng.a pngtest shared libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 shared: $(LIBNAME).so.$(PNGVER)
@@ -93,14 +96,14 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
-	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
+	$(RM_F) $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
 
 libpng.so.0.$(PNGMIN): $(OBJS)
 	$(LDLEGACY) -o $@ $(OBJS)
@@ -114,63 +117,63 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -sf libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -sf libpng.so.0 libpng.so; \
-	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -182,24 +185,24 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(DL) -L$(ZLIBLIB) \
            -rpath $(ZLIBLIB):$(DL) \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtestd pngtest.png
 
 test-installed:
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
 	   -L$(ZLIBLIB) \
-           -rpath $(ZLIBLIB):`$(BINPATH)/libpng12-config --libdir` \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
+           -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
 	./pngtesti pngtest.png
 
 clean:
-	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
 	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
 	libpng.so.0.$(PNGMIN) \
 	so_locations
diff --git a/scripts/makefile.so9 b/scripts/makefile.so9
index 8087647..6fef3e7 100644
--- a/scripts/makefile.so9
+++ b/scripts/makefile.so9
@@ -1,16 +1,22 @@
 # makefile for libpng on Solaris 9 (beta) with Forte cc
 # Updated by Chad Schrock for Solaris 9
 # Contributed by William L. Sebok, based on makefile.linux
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1998-2001 Greg Roelofs
 # Copyright (C) 1996-1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
 # gcc 2.95 doesn't work.
 CC=cc
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -f -s
+RANLIB=echo
+RM_F=/bin/rm -f
 
 # Where make install puts libpng.a, libpng.so*, and png.h
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 # Changing these to ../zlib poses a security risk.  If you want
@@ -30,18 +36,15 @@
 CFLAGS=-I$(ZLIBINC) -O3
 LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
 
-#RANLIB=ranlib
-RANLIB=echo
-
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -72,7 +75,7 @@
 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -89,10 +92,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	@case "`type ld`" in *ucb*) \
@@ -125,59 +128,59 @@
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -f -s libpng.so.0 libpng.so; \
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
+	$(LN_SF) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_SF) libpng.so.0 libpng.so; \
+	$(LN_SF) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
+	$(LN_SF) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
 	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
 	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
 	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
 	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -f -s $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -189,8 +192,8 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   -L$(DL) -L$(ZLIBLIB)  -R$(ZLIBLIB) -R$(DL)
 	./pngtestd pngtest.png
 
@@ -198,13 +201,13 @@
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   -L$(ZLIBLIB) -R$(ZLIBLIB)
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 9374229..4ccb892 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -1,14 +1,20 @@
 # makefile for libpng on Solaris 2.x with gcc
-# Copyright (C) 2004 Glenn Randers-Pehrson
+# Copyright (C) 2004, 2006 Glenn Randers-Pehrson
 # Contributed by William L. Sebok, based on makefile.linux
 # Copyright (C) 1998 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
+AR_RC=ar rc
 CC=gcc
+MKDIR_P=mkdir
+LN_SF=ln -f -s
+RANLIB=echo
+RM_F=/bin/rm -f
 
 # Where make install puts libpng.a, libpng12.so*, and png.h
 prefix=/usr/local
+exec_prefix=$prefix
 
 # Where the zlib library and include files are located
 # Changing these to ../zlib poses a security risk.  If you want
@@ -26,18 +32,15 @@
 	# $(WARNMORE) -g -DPNG_DEBUG=5
 LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
 
-#RANLIB=ranlib
-RANLIB=echo
-
 PNGMAJ = 0
-PNGMIN = 1.2.9beta6
+PNGMIN = 1.2.9beta7
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib
+LIBPATH=$(exec_prefix)/lib
 MANPATH=$(prefix)/man
-BINPATH=$(prefix)/bin
+BINPATH=$(exec_prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -68,7 +71,7 @@
 all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
+	$(AR_RC) $@ $(OBJS)
 	$(RANLIB) $@
 
 libpng.pc:
@@ -86,10 +89,10 @@
 	chmod +x libpng-config
 
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
-	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+	$(LN_FS) $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
 $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+	$(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
 	@case "`type ld`" in *ucb*) \
@@ -118,63 +121,63 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
+	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
+	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
-	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
+	-@$(RM_F) $(DI)/libpng
+	(cd $(DI); $(LN_FS) $(LIBNAME) libpng; $(LN_FS) $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
-	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
+	-@$(RM_F) $(DL)/libpng.a
+	(cd $(DL); $(LN_FS) $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
 	libpng.so.0.$(PNGMIN)
-	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
-	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)
-	-@/bin/rm -f $(DL)/libpng.so
-	-@/bin/rm -f $(DL)/libpng.so.0
-	-@/bin/rm -f $(DL)/libpng.so.0.$(PNGMIN)*
+	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
+	-@$(RM_F) $(DL)/$(LIBNAME).so.$(PNGMAJ)
+	-@$(RM_F) $(DL)/libpng.so
+	-@$(RM_F) $(DL)/libpng.so.0
+	-@$(RM_F) $(DL)/libpng.so.0.$(PNGMIN)*
 	cp $(LIBNAME).so.$(PNGVER) $(DL)
 	cp libpng.so.0.$(PNGMIN) $(DL)
 	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
 	chmod 755 $(DL)/libpng.so.0.$(PNGMIN)
 	(cd $(DL); \
-	ln -f -s libpng.so.0.$(PNGMIN) libpng.so.0; \
-	ln -f -s libpng.so.0 libpng.so; \
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
-	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
-	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
-	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
+	$(LN_FS) libpng.so.0.$(PNGMIN) libpng.so.0; \
+	$(LN_FS) libpng.so.0 libpng.so; \
+	$(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
+	$(LN_FS) $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
+	-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
+	-@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
+	-@$(RM_F) $(DL)/pkgconfig/libpng.pc
 	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
-	(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
+	(cd $(DL)/pkgconfig; $(LN_FS) $(LIBNAME).pc libpng.pc)
 
 install-man: libpng.3 libpngpf.3 png.5
-	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
-	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
-	-@/bin/rm -f $(DM)/man3/libpng.3
-	-@/bin/rm -f $(DM)/man3/libpngpf.3
+	-@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
+	-@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
+	-@$(RM_F) $(DM)/man3/libpng.3
+	-@$(RM_F) $(DM)/man3/libpngpf.3
 	cp libpng.3 $(DM)/man3
 	cp libpngpf.3 $(DM)/man3
-	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
-	-@/bin/rm -f $(DM)/man5/png.5
+	-@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
+	-@$(RM_F) $(DM)/man5/png.5
 	cp png.5 $(DM)/man5
 
 install-config: libpng-config
-	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
-	-@/bin/rm -f $(DB)/libpng-config
-	-@/bin/rm -f $(DB)/$(LIBNAME)-config
+	-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
+	-@$(RM_F) $(DB)/libpng-config
+	-@$(RM_F) $(DB)/$(LIBNAME)-config
 	cp libpng-config $(DB)/$(LIBNAME)-config
 	chmod 755 $(DB)/$(LIBNAME)-config
-	(cd $(DB); ln -s -f $(LIBNAME)-config libpng-config)
+	(cd $(DB); $(LN_FS) $(LIBNAME)-config libpng-config)
 
 install: install-static install-shared install-man install-config
 
@@ -186,8 +189,8 @@
 	echo
 	echo Testing installed dynamic shared library in $(DL).
 	$(CC) -I$(DI) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtestd `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
 	./pngtestd pngtest.png
 
@@ -195,13 +198,13 @@
 	echo
 	echo Testing installed dynamic shared library.
 	$(CC) -I$(ZLIBINC) \
-	   `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags` \
+	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
 	   -L$(ZLIBLIB) -R$(ZLIBLIB)
 	./pngtesti pngtest.png
 
 clean:
-	/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
+	$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
 	libpng-config $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
 	libpng.so.0.$(PNGMIN) \
 	libpng.pc
diff --git a/scripts/makefile.std b/scripts/makefile.std
index 5d1f529..9b1925d 100644
--- a/scripts/makefile.std
+++ b/scripts/makefile.std
@@ -1,5 +1,5 @@
 # makefile for libpng
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
@@ -25,12 +25,15 @@
 ZLIBINC=../zlib
 
 CC=cc
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -sf
+RANLIB=ranlib
+RM_F=rm -f
+
 CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 
-#RANLIB=echo
-RANLIB=ranlib
-
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 	pngwtran.o pngmem.o pngerror.o pngpread.o
@@ -38,7 +41,7 @@
 all: libpng.a pngtest
 
 libpng.a: $(OBJS)
-	ar rc $@  $(OBJS)
+	$(AR_RC) $@  $(OBJS)
 	$(RANLIB) $@
 
 pngtest: pngtest.o libpng.a
@@ -48,11 +51,11 @@
 	./pngtest
 
 install: libpng.a
-	-@mkdir $(DESTDIR)$(INCPATH)
-	-@mkdir $(DESTDIR)$(INCPATH)/libpng
-	-@mkdir $(DESTDIR)$(LIBPATH)
-	-@rm -f $(DESTDIR)$(INCPATH)/png.h
-	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)
+	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
+	-@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
+	-@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
+	-@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
 	cp png.h $(DESTDIR)$(INCPATH)/libpng
 	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
 	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
@@ -62,7 +65,7 @@
 	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
 
 clean:
-	rm -f *.o libpng.a pngtest pngout.png
+	$(RM_F) *.o libpng.a pngtest pngout.png
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.sunos b/scripts/makefile.sunos
index 70a6e88..241224c 100644
--- a/scripts/makefile.sunos
+++ b/scripts/makefile.sunos
@@ -1,5 +1,5 @@
 # makefile for libpng
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
@@ -28,13 +28,17 @@
 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \
 	-Wmissing-declarations -Wtraditional -Wcast-align \
 	-Wstrict-prototypes -Wmissing-prototypes
+
 CC=gcc
+AR_RC=ar rc
+MKDIR_P=mkdir
+LN_SF=ln -f -s
+RANLIB=ranlib
+RM_F=/bin/rm -f
+
 CFLAGS=-I$(ZLIBINC) -O # $(WARNMORE) -DPNG_DEBUG=5
 LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
 
-RANLIB=ranlib
-#RANLIB=echo
-
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 	pngwtran.o pngmem.o pngerror.o pngpread.o
@@ -42,7 +46,7 @@
 all: libpng.a pngtest
 
 libpng.a: $(OBJS)
-	ar rc $@  $(OBJS)
+	$(AR_RC) $@  $(OBJS)
 	$(RANLIB) $@
 
 pngtest: pngtest.o libpng.a
@@ -52,21 +56,21 @@
 	./pngtest
 
 install: libpng.a
-	-@mkdir $(DESTDIR)$(INCPATH)
-	-@mkdir $(DESTDIR)$(INCPATH)/libpng
-	-@mkdir $(DESTDIR)$(LIBPATH)
-	-@rm -f $(DESTDIR)$(INCPATH)/png.h
-	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)
+	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
+	-@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
+	-@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
+	-@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
 	cp png.h $(DESTDIR)$(INCPATH)/libpng
 	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
 	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
 	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
-	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
+	(cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .)
 	cp libpng.a $(DESTDIR)$(LIBPATH)
 	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
 
 clean:
-	rm -f *.o libpng.a pngtest pngout.png
+	$(RM_F) *.o libpng.a pngtest pngout.png
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index fbdae33..68f563b 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -2,7 +2,7 @@
 ; PNG.LIB module definition file for OS/2
 ;----------------------------------------
 
-; Version 1.2.9beta6
+; Version 1.2.9beta7
 
 LIBRARY		PNG
 DESCRIPTION	"PNG image compression library for OS/2"
diff --git a/scripts/pngw32.def b/scripts/pngw32.def
index 581fa9b..0177fc3 100644
--- a/scripts/pngw32.def
+++ b/scripts/pngw32.def
@@ -5,7 +5,7 @@
 LIBRARY
 
 EXPORTS
-;Version 1.2.9beta6
+;Version 1.2.9beta7
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3