[master] Imported from libpng-1.6.13.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 47181be..c14a3d1 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,4 @@
-
-Libpng 1.6.12 - June 12, 2014
+Libpng 1.6.13 - August 21, 2014
 
 This is a public release of libpng, intended for use in production codes.
 
@@ -8,28 +7,48 @@
 Source files with LF line endings (for Unix/Linux) and with a
 "configure" script
 
-   libpng-1.6.12.tar.xz (LZMA-compressed, recommended)
-   libpng-1.6.12.tar.gz
+   libpng-1.6.13.tar.xz (LZMA-compressed, recommended)
+   libpng-1.6.13.tar.gz
 
 Source files with CRLF line endings (for Windows), without the
 "configure" script
 
-   lpng1612.7z  (LZMA-compressed, recommended)
-   lpng1612.zip
+   lpng1613.7z  (LZMA-compressed, recommended)
+   lpng1613.zip
 
 Other information:
 
-   libpng-1.6.12-README.txt
-   libpng-1.6.12-LICENSE.txt
-   libpng-1.6.12-*.asc (armored detached GPG signatures)
+   libpng-1.6.13-README.txt
+   libpng-1.6.13-LICENSE.txt
+   libpng-1.6.13-*.asc (armored detached GPG signatures)
 
-Changes since the last public release (1.6.11):
-  Relocated new code from 1.6.11 in png.c to a point after the
-    declarations (Max Stepin).
-  Changed file permissions of contrib/tools/intgamma.sh,
-    test-driver, and compile from 0644 to 0755 (Cosmin).
-  Ensure "__has_attribute()" macro exists before trying to use it with
-    old clang compilers (MacPorts Ticket #43939).
+Changes since the last public release (1.6.12):
+
+  Quieted -Wsign-compare and -Wclobber compiler warnings in
+    contrib/pngminus/*.c
+  Added "(void) png_ptr;" where needed in contrib/gregbook to quiet
+    compiler complaints about unused pointers.
+  Split a long output string in contrib/gregbook/rpng2-x.c.
+  Added "PNG_SET_OPTION" requirement for sRGB chunk support to pnglibconf.dfa,
+    Needed for write-only support (John Bowler).
+  Changed "if defined(__ARM_NEON__)" to
+    "if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
+  Fixed clang no-warning builds: png_digit was defined but never used.
+  Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
+    (bug report from Wolfgang S. Kechel).  Bug was introduced in libpng-1.6.11.
+    Also fixed makefile.bc32, makefile.bor, makefile.msc, makefile.intel, and
+    makefile.tc3 similarly.
+  Removed scripts/makefile.elf. It has not worked since libpng-1.5.0beta14
+    due to elimination of the PNG_FUNCTION_EXPORT and PNG_DATA_EXPORT
+    definitions from pngconf.h.
+  Ensure that CMakeLists.txt makes the target "lib" directory before making
+    symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
+  Added opinion that the ECCN (Export Control Classification Number) for
+    libpng is EAR99 to the README file.
+  Eliminated use of "$<" in makefile explicit rules, when copying
+    $PNGLIBCONF_H_PREBUILT.  This does not work on some versions of make;
+    bug introduced in libpng version 1.6.11.
+  Made "ccopts" agree with "CFLAGS" in scripts/makefile.hp* and makefile.*sunu
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
@@ -38,4 +57,3 @@
 or to glennrp at users.sourceforge.net
 
 Glenn R-P
-#endif
diff --git a/CHANGES b/CHANGES
index c1951a7..880eca9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-#if 0
+
 CHANGES - changes for libpng
 
 Version 0.2
@@ -4940,6 +4940,44 @@
 Version 1.6.12 [June 12, 2014]
   No changes.
 
+Version 1.6.13beta01 [July 4, 2014]
+  Quieted -Wsign-compare and -Wclobber compiler warnings in
+    contrib/pngminus/*.c
+  Added "(void) png_ptr;" where needed in contrib/gregbook to quiet
+    compiler complaints about unused pointers.
+  Split a long output string in contrib/gregbook/rpng2-x.c.
+  Added "PNG_SET_OPTION" requirement for sRGB chunk support to pnglibconf.dfa,
+    Needed for write-only support (John Bowler).
+  Changed "if defined(__ARM_NEON__)" to
+    "if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
+  Fixed clang no-warning builds: png_digit was defined but never used.
+    
+Version 1.6.13beta02 [July 21, 2014]
+  Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
+    (bug report from Wolfgang S. Kechel).  Bug was introduced in libpng-1.6.11.
+    Also fixed makefile.bc32, makefile.bor, makefile.msc, makefile.intel, and
+    makefile.tc3 similarly.
+
+Version 1.6.13beta03 [August 3, 2014]
+  Removed scripts/makefile.elf. It has not worked since libpng-1.5.0beta14
+    due to elimination of the PNG_FUNCTION_EXPORT and PNG_DATA_EXPORT
+    definitions from pngconf.h.
+  Ensure that CMakeLists.txt makes the target "lib" directory before making
+    symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
+
+Version 1.6.13beta04 [August 8, 2014]
+  Added opinion that the ECCN (Export Control Classification Number) for
+    libpng is EAR99 to the README file.
+  Eliminated use of "$<" in makefile explicit rules, when copying
+    $PNGLIBCONF_H_PREBUILT.  This does not work on some versions of make;
+    bug introduced in libpng version 1.6.11.
+
+Version 1.6.13rc01 [August 14, 2014]
+  Made "ccopts" agree with "CFLAGS" in scripts/makefile.hp* and makefile.*sunu
+
+Version 1.6.13 [August 21, 2014]
+  No changes.
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
@@ -4947,4 +4985,3 @@
 or to glennrp at users.sourceforge.net
 
 Glenn R-P
-#endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f74147b..e0353a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 # CMakeLists.txt
 
-# Copyright (C) 2007-2013 Glenn Randers-Pehrson
+# Copyright (C) 2007-2014 Glenn Randers-Pehrson
 
 # This code is released under the libpng license.
 # For conditions of distribution and use, see the disclaimer
@@ -16,7 +16,7 @@
 
 set(PNGLIB_MAJOR 1)
 set(PNGLIB_MINOR 6)
-set(PNGLIB_RELEASE 12)
+set(PNGLIB_RELEASE 13)
 set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
 set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
 
@@ -220,6 +220,7 @@
     ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE})
   else(WIN32 AND NOT CYGWIN AND NOT MSYS)
     get_filename_component(LINK_TARGET "${SRC_FILE}" NAME)
+    execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
     execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
     execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
   endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
@@ -252,7 +253,7 @@
 # SET UP LINKS
 if(PNG_SHARED)
   set_target_properties(${PNG_LIB_NAME} PROPERTIES
-#   VERSION 16.${PNGLIB_RELEASE}.1.6.12
+#   VERSION 16.${PNGLIB_RELEASE}.1.6.13
     VERSION 16.${PNGLIB_RELEASE}.0
     SOVERSION 16
     CLEAN_DIRECT_OUTPUT 1)
@@ -350,7 +351,7 @@
   install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
 endif()
 
-# what's with libpng-$VER%.txt and all the extra files?
+# what's with libpng-manual.txt and all the extra files?
 
 # UNINSTALL
 # do we need this?
diff --git a/INSTALL b/INSTALL
index 49e9329..f4df80a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -28,7 +28,9 @@
     make check
     make install
 
-and ignore the rest of this document.
+and ignore the rest of this document.  "/path" is the path to the directory
+where you want to install the libpng "lib", "include", and "bin"
+subdirectories.
 
 II. Rebuilding the configure scripts
 
@@ -64,8 +66,8 @@
 
 Before installing libpng, you must first install zlib, if it
 is not already on your system.  zlib can usually be found
-wherever you got libpng.  zlib can be placed in another directory,
-at the same level as libpng.
+wherever you got libpng; otherwise go to http://zlib.net.  You can place
+zlib in in the same directory as libpng or in another directory.
 
 If your system already has a preinstalled zlib you will still need
 to have access to the zlib.h and zconf.h include files that
@@ -93,6 +95,10 @@
    make
    make install
 
+As when using the simple configure method described above, "/path" points to
+the installation directory where you want to put the libpng "lib", "include",
+and "bin" subdirectories.
+
 V. Directory structure
 
 You can rename the directories that you downloaded (they
@@ -322,9 +328,10 @@
 These mechanisms still work in the configure build and in any makefile
 build that builds pnglibconf.h, although the feature selection macros
 have changed somewhat as described above.  In 1.5.0, however, pngusr.h is
-processed only once, when the exported header file pnglibconf.h is built.
-pngconf.h no longer includes pngusr.h, therefore pngusr.h is ignored after the
-build of pnglibconf.h and it is never included in an application build.
+processed only once, at the time the exported header file pnglibconf.h is
+built.  pngconf.h no longer includes pngusr.h; therefore, pngusr.h is ignored
+after the build of pnglibconf.h and it is never included in an application
+build.
 
 The rarely used alternative of adding a list of feature macros to the
 CPPFLAGS setting in the build also still works; however, the macros will be
@@ -347,7 +354,7 @@
 pngusr.h a system builder may also define equivalent options in pngusr.dfa
 (or, indeed, any file) and add that to the configuration by setting
 DFA_XTRA to the file name.  The makefiles in contrib/pngminim illustrate
-how to do this, and a case where pngusr.h is still required.
+how to do this, and illustrate a case where pngusr.h is still required.
 
 XV. Configuring libpng for multiprocessing
 
diff --git a/LICENSE b/LICENSE
index b77abdd..a38339e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,7 +10,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.6.12, June 12, 2014, are
+libpng versions 1.2.6, August 15, 2004, through 1.6.13, August 21, 2014, are
 Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-June 12, 2014
+August 21, 2014
diff --git a/README b/README
index dc6c00b..69bda87 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.12 - June 12, 2014 (shared library 16.0)
+README for libpng version 1.6.13 - August 21, 2014 (shared library 16.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -87,6 +87,12 @@
 [DOWNLOAD] area, and at ftp://ftp.simplesystems.org.  If you can't find it
 in any of those places, e-mail me, and I'll help you find it.
 
+I am not a lawyer, but I believe that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because it
+is open source, publicly available software, that does not contain any
+encryption software.  See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
+
 If you have any code changes, requests, problems, etc., please e-mail
 them to me.  Also, I'd appreciate any make files or project files,
 and any modifications you needed to make to get libpng to compile,
diff --git a/arm/arm_init.c b/arm/arm_init.c
index cff47ff..b0e929b 100644
--- a/arm/arm_init.c
+++ b/arm/arm_init.c
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2014 Glenn Randers-Pehrson
  * Written by Mans Rullgard, 2011.
- * Last changed in libpng 1.6.10 [June 12, 2014]
+ * Last changed in libpng 1.6.10 [March 6, 2014]
  *
  * This code is released under the libpng license.
  * For conditions of distribution and use, see the disclaimer
diff --git a/configure.ac b/configure.ac
index 0ea4dd2..6fafa02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@
 
 dnl Version number stuff here:
 
-AC_INIT([libpng],[1.6.12],[png-mng-implement@lists.sourceforge.net])
+AC_INIT([libpng],[1.6.13],[png-mng-implement@lists.sourceforge.net])
 AC_CONFIG_MACRO_DIR([scripts])
 
 # libpng does not follow GNU file name conventions (hence 'foreign')
@@ -39,10 +39,10 @@
 dnl AM_PREREQ([1.11.2])
 dnl stop configure from automagically running automake
 
-PNGLIB_VERSION=1.6.12
+PNGLIB_VERSION=1.6.13
 PNGLIB_MAJOR=1
 PNGLIB_MINOR=6
-PNGLIB_RELEASE=12
+PNGLIB_RELEASE=13
 
 dnl End of version number stuff
 
diff --git a/contrib/gregbook/Makefile.unx b/contrib/gregbook/Makefile.unx
index c8cadf8..1a73e03 100644
--- a/contrib/gregbook/Makefile.unx
+++ b/contrib/gregbook/Makefile.unx
@@ -59,15 +59,16 @@
 RLIBSd = $(PNGLIBd) $(ZLIBd) $(XLIB) -lm
 RLIBSs = $(PNGLIBs) $(ZLIBs) $(XLIB) -lm
 WLIBSd = $(PNGLIBd) $(ZLIBd) -lm
-WLIBSs = $(PNGLIBs) $(ZLIBs)
+WLIBSs = $(PNGLIBs) $(ZLIBs) -lm
 
 CC = gcc
 LD = gcc
 RM = rm -f
 CPPFLAGS = $(INCS) -DFEATURE_LOOP
 CFLAGS = -O -Wall
+#CFLAGS = -O -W -Wall -Wextra -pedantic -ansi
 # [note that -Wall is a gcc-specific compilation flag ("most warnings on")]
-# [-ansi, -pedantic and -W can also be used]
+# [-ansi, -pedantic, -Wextra, and -W can also be used]
 LDFLAGS =
 O = .o
 E =
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index e6a132e..2e4c536 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -448,6 +448,8 @@
 
     /* all done */
 
+    (void)info_ptr; /* Unused */
+
     return;
 }
 
@@ -472,6 +474,7 @@
 {
     fprintf(stderr, "readpng2 libpng warning: %s\n", msg);
     fflush(stderr);
+    (void)png_ptr; /* Unused */
 }
 
 
diff --git a/contrib/gregbook/readppm.c b/contrib/gregbook/readppm.c
index be9a56d..7fefc39 100644
--- a/contrib/gregbook/readppm.c
+++ b/contrib/gregbook/readppm.c
@@ -163,8 +163,12 @@
 
     /* now we can go ahead and just read the whole image */
 
-    fread(image_data, 1L, rowbytes*height, saved_infile);
-
+    if (fread(image_data, 1L, rowbytes*height, saved_infile) <
+       rowbytes*height) {
+        free (image_data);
+        image_data = NULL;
+        return NULL;
+    }
 
     return image_data;
 }
diff --git a/contrib/gregbook/rpng-x.c b/contrib/gregbook/rpng-x.c
index 6d10e1b..ddd7c58 100644
--- a/contrib/gregbook/rpng-x.c
+++ b/contrib/gregbook/rpng-x.c
@@ -26,6 +26,8 @@
     - 1.14:  added support for X resources (thanks to Gerhard Niklasch)
     - 2.00:  dual-licensed (added GNU GPL)
     - 2.01:  fixed improper display of usage screen on PNG error(s)
+    - 2.02:  Added "void(argc);" statement to quiet pedantic compiler warnings
+             about unused variable (GR-P)
 
   ---------------------------------------------------------------------------
 
@@ -80,7 +82,7 @@
 
 #define PROGNAME  "rpng-x"
 #define LONGNAME  "Simple PNG Viewer for X"
-#define VERSION   "2.01 of 16 March 2008"
+#define VERSION   "2.02 of 15 June 2014"
 #define RESNAME   "rpng"        /* our X resource application name */
 #define RESCLASS  "Rpng"        /* our X resource class name */
 
@@ -279,15 +281,17 @@
           "Usage:  %s [-display xdpy] [-gamma exp] [-bgcolor bg] file.png\n"
           "    xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
           "    exp \ttransfer-function exponent (``gamma'') of the display\n"
-          "\t\t  system in floating-point format (e.g., ``%.1f''); equal\n"
+          "\t\t  system in floating-point format (e.g., ``%.1f''); equal\n",
+          PROGNAME, default_display_exponent);
+
+        fprintf(stderr, "\n"
           "\t\t  to the product of the lookup-table exponent (varies)\n"
           "\t\t  and the CRT exponent (usually 2.2); must be positive\n"
           "    bg  \tdesired background color in 7-character hex RGB format\n"
           "\t\t  (e.g., ``#ff7700'' for orange:  same as HTML colors);\n"
           "\t\t  used with transparent images\n"
           "\nPress Q, Esc or mouse button 1 (within image window, after image\n"
-          "is displayed) to quit.\n"
-          "\n", PROGNAME, default_display_exponent);
+          "is displayed) to quit.\n");
         exit(1);
     }
 
@@ -419,6 +423,8 @@
 
     rpng_x_cleanup();
 
+    (void)argc; /* Unused */
+
     return 0;
 }
 
diff --git a/contrib/gregbook/rpng2-win.c b/contrib/gregbook/rpng2-win.c
index 223e737..eda176e 100644
--- a/contrib/gregbook/rpng2-win.c
+++ b/contrib/gregbook/rpng2-win.c
@@ -33,6 +33,8 @@
     - 2.02:  fixed improper display of usage screen on PNG error(s); fixed
               unexpected-EOF and file-read-error cases
     - 2.03:  removed runtime MMX-enabling/disabling and obsolete -mmx* options
+    - 2.04:  
+             (GR-P)
 
   ---------------------------------------------------------------------------
 
diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c
index 7f24b63..a146ef4 100644
--- a/contrib/gregbook/rpng2-x.c
+++ b/contrib/gregbook/rpng2-x.c
@@ -41,7 +41,11 @@
               unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
               paste bugs
     - 2.03:  deleted runtime MMX-enabling/disabling and obsolete -mmx* options
+    - 2.04:  Added "void(foo);" statements to quiet pedantic compiler warnings
+             about unused variables (GR-P)
 
+  TO DO:
+             use nanosleep() instead of usleep(), which is obsolete/deprecated.
   ---------------------------------------------------------------------------
 
       Copyright (c) 1998-2008 Greg Roelofs.  All rights reserved.
@@ -95,10 +99,13 @@
 
 #define PROGNAME  "rpng2-x"
 #define LONGNAME  "Progressive PNG Viewer for X"
-#define VERSION   "2.03 of 25 February 2010"
+#define VERSION   "2.04 of 15 June 2014"
 #define RESNAME   "rpng2"       /* our X resource application name */
 #define RESCLASS  "Rpng"       /* our X resource class name */
 
+/* This is temporary until the code is rewritten to use nanosleep(). */
+#define usleep(x) sleep(((x)+499999)/1000000)
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
@@ -456,40 +463,47 @@
         fprintf(stderr, "\n%s %s:  %s\n\n", PROGNAME, VERSION, appname);
         readpng2_version_info();
         fprintf(stderr, "\n"
-          "Usage:  %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
+          "Usage:   ");
+        fprintf(stderr,
+          "%s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
+          "        %*s [-usleep dur | -timing] [-pause]\n",
+          PROGNAME, (int)strlen(PROGNAME), " ");
+        fprintf(stderr,
 #ifdef FEATURE_LOOP
-          "        %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
-#else
-          "        %*s [-usleep dur | -timing] [-pause] file.png\n\n"
+          "        [-loop [sec]]"
 #endif
+          " file.png\n\n");
+        fprintf(stderr,
           "    xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
           "    exp \ttransfer-function exponent (``gamma'') of the display\n"
           "\t\t  system in floating-point format (e.g., ``%.1f''); equal\n"
-          "\t\t  to the product of the lookup-table exponent (varies)\n"
+          "\t\t  to the product of the lookup-table exponent (varies)\n",
+          default_display_exponent);
+        fprintf(stderr,
           "\t\t  and the CRT exponent (usually 2.2); must be positive\n"
           "    bg  \tdesired background color in 7-character hex RGB format\n"
           "\t\t  (e.g., ``#ff7700'' for orange:  same as HTML colors);\n"
           "\t\t  used with transparent images; overrides -bgpat\n"
           "    pat \tdesired background pattern number (0-%d); used with\n"
-          "\t\t  transparent images; overrides -bgcolor\n"
+          "\t\t  transparent images; overrides -bgcolor\n",
+          num_bgpat-1);
 #ifdef FEATURE_LOOP
+        fprintf(stderr, 
           "    -loop\tloops through background images after initial display\n"
           "\t\t  is complete (depends on -bgpat)\n"
-          "    sec \tseconds to display each background image (default = 2)\n"
+          "    sec \tseconds to display each background image (default = 2)\n");
 #endif
+        fprintf(stderr, 
           "    dur \tduration in microseconds to wait after displaying each\n"
           "\t\t  row (for demo purposes)\n"
           "    -timing\tenables delay for every block read, to simulate modem\n"
           "\t\t  download of image (~36 Kbps)\n"
           "    -pause\tpauses after displaying each pass until mouse clicked\n"
           "\nPress Q, Esc or mouse button 1 (within image window, after image\n"
-          "is displayed) to quit.\n"
-          "\n", PROGNAME,
-          (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
+          "is displayed) to quit.\n");
         exit(1);
     }
 
-
     if (!(infile = fopen(filename, "rb"))) {
         fprintf(stderr, PROGNAME ":  can't open PNG file [%s]\n", filename);
         ++error;
@@ -735,6 +749,8 @@
     Trace((stderr, "about to call rpng2_x_cleanup()\n"))
     rpng2_x_cleanup();
 
+    (void)argc; /* Unused */
+
     return 0;
 }
 
@@ -1826,6 +1842,9 @@
         XFlush(display);
     }
 
+    (void)startcol;
+    (void)width;
+
 } /* end function rpng2_x_redisplay_image() */
 
 
diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c
index aa9513d..83d9565 100644
--- a/contrib/pngminus/png2pnm.c
+++ b/contrib/pngminus/png2pnm.c
@@ -52,7 +52,8 @@
 
 int  main (int argc, char *argv[]);
 void usage ();
-BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha);
+BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
+   BOOL alpha);
 
 /*
  *  main
@@ -85,7 +86,8 @@
           if ((fp_al = fopen (argv[argi], "wb")) == NULL)
           {
             fprintf (stderr, "PNM2PNG\n");
-            fprintf (stderr, "Error:  can not create alpha-channel file %s\n", argv[argi]);
+            fprintf (stderr, "Error:  can not create alpha-channel file %s\n",
+               argv[argi]);
             exit (1);
           }
           break;
@@ -176,9 +178,11 @@
   fprintf (stderr, "Usage:  png2pnm [options] <file>.png [<file>.pnm]\n");
   fprintf (stderr, "   or:  ... | png2pnm [options]\n");
   fprintf (stderr, "Options:\n");
-  fprintf (stderr, "   -r[aw]   write pnm-file in binary format (P4/P5/P6) (default)\n");
+  fprintf (stderr,
+     "   -r[aw]   write pnm-file in binary format (P4/P5/P6) (default)\n");
   fprintf (stderr, "   -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
-  fprintf (stderr, "   -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
+  fprintf (stderr,
+     "   -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
   fprintf (stderr, "   -h | -?  print this help-information\n");
 }
 
@@ -186,7 +190,8 @@
  *  png2pnm
  */
 
-BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
+BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
+    volatile BOOL raw, BOOL alpha)
 {
   png_struct    *png_ptr = NULL;
   png_info        *info_ptr = NULL;
@@ -315,12 +320,14 @@
   /* row_bytes is the width x number of channels x (bit-depth / 8) */
   row_bytes = png_get_rowbytes (png_ptr, info_ptr);
 
-  if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
+  if ((png_pixels = (png_byte *)
+     malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
     png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
     return FALSE;
   }
 
-  if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
+  if ((row_pointers = (png_byte **)
+     malloc (height * sizeof (png_bytep))) == NULL)
   {
     png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
     free (png_pixels);
@@ -329,7 +336,7 @@
   }
 
   /* set the individual row_pointers to point at the correct offsets */
-  for (i = 0; i < (height); i++)
+  for (i = 0; i < ((int) height); i++)
     row_pointers[i] = png_pixels + i * row_bytes;
 
   /* now we can go ahead and just read the whole image */
@@ -372,9 +379,9 @@
   /* write data to PNM file */
   pix_ptr = png_pixels;
 
-  for (row = 0; row < height; row++)
+  for (row = 0; row < (int) height; row++)
   {
-    for (col = 0; col < width; col++)
+    for (col = 0; col < (int) width; col++)
     {
       for (i = 0; i < (channels - alpha_present); i++)
       {
diff --git a/contrib/pngminus/pnm2png.c b/contrib/pngminus/pnm2png.c
index f9903dd..b073414 100644
--- a/contrib/pngminus/pnm2png.c
+++ b/contrib/pngminus/pnm2png.c
@@ -50,7 +50,8 @@
 
 int  main (int argc, char *argv[]);
 void usage ();
-BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha);
+BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
+    BOOL alpha);
 void get_token(FILE *pnm_file, char *token);
 png_uint_32 get_data (FILE *pnm_file, int depth);
 png_uint_32 get_value (FILE *pnm_file, int depth);
@@ -176,7 +177,8 @@
   fprintf (stderr, "   or:  ... | pnm2png [options]\n");
   fprintf (stderr, "Options:\n");
   fprintf (stderr, "   -i[nterlace]   write png-file with interlacing on\n");
-  fprintf (stderr, "   -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n");
+  fprintf (stderr,
+      "   -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n");
   fprintf (stderr, "   -h | -?  print this help-information\n");
 }
 
@@ -184,27 +186,28 @@
  *  pnm2png
  */
 
-BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha)
+BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
+     BOOL alpha)
 {
   png_struct    *png_ptr = NULL;
   png_info      *info_ptr = NULL;
   png_byte      *png_pixels = NULL;
   png_byte      **row_pointers = NULL;
   png_byte      *pix_ptr = NULL;
-  png_uint_32   row_bytes;
+  volatile png_uint_32   row_bytes;
 
   char          type_token[16];
   char          width_token[16];
   char          height_token[16];
   char          maxval_token[16];
-  int           color_type;
+  volatile int           color_type;
   unsigned long   ul_width=0, ul_alpha_width=0;
   unsigned long   ul_height=0, ul_alpha_height=0;
   unsigned long   ul_maxval=0;
-  png_uint_32   width, alpha_width;
-  png_uint_32   height, alpha_height;
+  volatile png_uint_32   width, height;
+  volatile png_uint_32   alpha_width, alpha_height;
   png_uint_32   maxval;
-  int           bit_depth = 0;
+  volatile int           bit_depth = 0;
   int           channels;
   int           alpha_depth = 0;
   int           alpha_present;
@@ -367,23 +370,24 @@
     /* row_bytes is the width x number of channels x (bit-depth / 8) */
     row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
 
-  if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL)
+  if ((png_pixels = (png_byte *)
+     malloc (row_bytes * height * sizeof (png_byte))) == NULL)
     return FALSE;
 
   /* read data from PNM file */
   pix_ptr = png_pixels;
 
-  for (row = 0; row < height; row++)
+  for (row = 0; row < (int) height; row++)
   {
 #if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
     if (packed_bitmap) {
-      for (i = 0; i < row_bytes; i++)
+      for (i = 0; i < (int) row_bytes; i++)
         /* png supports this format natively so no conversion is needed */
         *pix_ptr++ = get_data (pnm_file, 8);
     } else
 #endif
     {
-      for (col = 0; col < width; col++)
+      for (col = 0; col < (int) width; col++)
       {
         for (i = 0; i < (channels - alpha_present); i++)
         {
@@ -462,7 +466,8 @@
   /* if needed we will allocate memory for an new array of row-pointers */
   if (row_pointers == (unsigned char**) NULL)
   {
-    if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
+    if ((row_pointers = (png_byte **)
+        malloc (height * sizeof (png_bytep))) == NULL)
     {
       png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
       return FALSE;
@@ -470,13 +475,13 @@
   }
 
   /* set the individual row_pointers to point at the correct offsets */
-  for (i = 0; i < (height); i++)
+  for (i = 0; i < (int) height; i++)
     row_pointers[i] = png_pixels + i * row_bytes;
 
   /* write out the entire image data in one call */
   png_write_image (png_ptr, row_pointers);
 
-  /* write the additional chuncks to the PNG file (not really needed) */
+  /* write the additional chunks to the PNG file (not really needed) */
   png_write_end (png_ptr, info_ptr);
 
   /* clean up after the write, and free any memory allocated */
diff --git a/example.c b/example.c
index e9747a8..ad5fc70 100644
--- a/example.c
+++ b/example.c
@@ -2,7 +2,7 @@
 #if 0 /* in case someone actually tries to compile this */
 
 /* example.c - an example of using libpng
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Maintained 1998-2014 Glenn Randers-Pehrson
  * Maintained 1996, 1997 Andreas Dilger)
  * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/libpng-manual.txt b/libpng-manual.txt
index f79ca7e..a394cc9 100644
--- a/libpng-manual.txt
+++ b/libpng-manual.txt
@@ -1,6 +1,6 @@
 libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.6.12 - June 12, 2014
+ libpng version 1.6.13 - August 21, 2014
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.6.12 - June 12, 2014
+ libpng versions 0.97, January 1998, through 1.6.13 - August 21, 2014
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
 
@@ -5042,7 +5042,8 @@
 libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
 means of
 
-    #ifdef PNG_SKIP_sRGB_CHECK_PROFILE
+    #if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && \
+        defined(PNG_SET_OPTION_SUPPORTED)
        png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE,
            PNG_OPTION_ON);
     #endif
@@ -5055,8 +5056,8 @@
 with color type 0 or 4 and that even if the image only contains gray pixels,
 only RGB profiles may appear in images with color type 2, 3, or 6, is now
 enforced.  The sRGB chunk is allowed to appear in images with any color type
-and is interpreted by libpng to convey a one-tracer-curve profile or a
-three-tracer-curve profile as appropriate.
+and is interpreted by libpng to convey a one-tracer-curve gray profile or a
+three-tracer-curve RGB profile as appropriate.
 
 Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
 an empty language field or an empty translated keyword.  Both of these
@@ -5275,13 +5276,13 @@
 
 XVI. Y2K Compliance in libpng
 
-June 12, 2014
+August 21, 2014
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.6.12 are Y2K compliant.  It is my belief that earlier
+upward through 1.6.13 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has two year fields.  One is a 2-byte unsigned integer
diff --git a/libpng.3 b/libpng.3
index 6ac1b6a..0ace861 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "June 12, 2014"
+.TH LIBPNG 3 "August 21, 2014"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.12
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.13
 .SH SYNOPSIS
 \fB
 #include <png.h>\fP
@@ -504,7 +504,7 @@
 .SH LIBPNG.TXT
 libpng-manual.txt - A description on how to use and modify libpng
 
- libpng version 1.6.12 - June 12, 2014
+ libpng version 1.6.13 - August 21, 2014
  Updated and distributed by Glenn Randers-Pehrson
  <glennrp at users.sourceforge.net>
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
@@ -515,7 +515,7 @@
 
  Based on:
 
- libpng versions 0.97, January 1998, through 1.6.12 - June 12, 2014
+ libpng versions 0.97, January 1998, through 1.6.13 - August 21, 2014
  Updated and distributed by Glenn Randers-Pehrson
  Copyright (c) 1998-2014 Glenn Randers-Pehrson
 
@@ -5546,7 +5546,8 @@
 libpng-1.6.11, recognizing and checking sRGB profiles can be avoided by
 means of
 
-    #ifdef PNG_SKIP_sRGB_CHECK_PROFILE
+    #if defined(PNG_SKIP_sRGB_CHECK_PROFILE) && \
+        defined(PNG_SET_OPTION_SUPPORTED)
        png_set_option(png_ptr, PNG_SKIP_sRGB_CHECK_PROFILE,
            PNG_OPTION_ON);
     #endif
@@ -5559,8 +5560,8 @@
 with color type 0 or 4 and that even if the image only contains gray pixels,
 only RGB profiles may appear in images with color type 2, 3, or 6, is now
 enforced.  The sRGB chunk is allowed to appear in images with any color type
-and is interpreted by libpng to convey a one-tracer-curve profile or a
-three-tracer-curve profile as appropriate.
+and is interpreted by libpng to convey a one-tracer-curve gray profile or a
+three-tracer-curve RGB profile as appropriate.
 
 Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
 an empty language field or an empty translated keyword.  Both of these
@@ -5779,13 +5780,13 @@
 
 .SH XVI. Y2K Compliance in libpng
 
-June 12, 2014
+August 21, 2014
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.6.12 are Y2K compliant.  It is my belief that earlier
+upward through 1.6.13 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has two year fields.  One is a 2-byte unsigned integer
@@ -6024,6 +6025,9 @@
  1.6.11              16    10611  16.so.16.11[.0]
  1.6.12rc01          16    10612  16.so.16.12[.0]
  1.6.12              16    10612  16.so.16.12[.0]
+ 1.6.13beta01-04     16    10613  16.so.16.13[.0]
+ 1.6.13rc01-02       16    10613  16.so.16.13[.0]
+ 1.6.13              16    10613  16.so.16.13[.0]
 
 Henceforth the source version will match the shared-library minor
 and patch numbers; the shared-library major version number will be
@@ -6080,7 +6084,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.6.12 - June 12, 2014:
+Libpng version 1.6.13 - August 21, 2014:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
 
@@ -6103,7 +6107,7 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.6.12, June 12, 2014, are
+libpng versions 1.2.6, August 15, 2004, through 1.6.13, August 21, 2014, are
 Copyright (c) 2004,2006-2014 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
@@ -6202,7 +6206,7 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-June 12, 2014
+August 21, 2014
 
 .\" end of man page
 
diff --git a/libpngpf.3 b/libpngpf.3
index 6ac6285..e940735 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "June 12, 2014"
+.TH LIBPNGPF 3 "August 21, 2014"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.12
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.13
 (private functions)
 .SH SYNOPSIS
 \fB#include \fI"pngpriv.h"
diff --git a/png.5 b/png.5
index 8f329fd..461e2f8 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "June 12, 2014"
+.TH PNG 5 "August 21, 2014"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index f813e0a..8d8841f 100644
--- a/png.c
+++ b/png.c
@@ -14,7 +14,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_12 Your_png_h_is_not_version_1_6_12;
+typedef png_libpng_version_1_6_13 Your_png_h_is_not_version_1_6_13;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -773,13 +773,13 @@
 #else
 #  ifdef __STDC__
    return PNG_STRING_NEWLINE \
-     "libpng version 1.6.12 - June 12, 2014" PNG_STRING_NEWLINE \
+     "libpng version 1.6.13 - August 21, 2014" PNG_STRING_NEWLINE \
      "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
      "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
      "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
      PNG_STRING_NEWLINE;
 #  else
-      return "libpng version 1.6.12 - June 12, 2014\
+      return "libpng version 1.6.13 - August 21, 2014\
       Copyright (c) 1998-2014 Glenn Randers-Pehrson\
       Copyright (c) 1996-1997 Andreas Dilger\
       Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -2293,8 +2293,8 @@
                    */
                   else if (!png_sRGB_checks[i].have_md5)
                   {
-                     png_chunk_report(png_ptr,
-                        "out-of-date sRGB profile with no signature",
+                     png_chunk_report(png_ptr, "out-of-date sRGB profile with"
+                        " no signature",
                         PNG_CHUNK_WARNING);
                   }
 
@@ -2307,8 +2307,8 @@
           * way.  This probably indicates a data error or uninformed hacking.
           * Fall through to "no match".
           */
-         png_chunk_report(png_ptr,
-             "Not recognizing known sRGB profile that has been edited", 
+         png_chunk_report(png_ptr, "Not recognizing known sRGB profile that"
+             " has been edited", 
              PNG_CHUNK_WARNING);
          break;
 # endif
diff --git a/png.h b/png.h
index 75e8736..0071c16 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.6.12 - June 12, 2014
+ * libpng version 1.6.13 - August 21, 2014
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,7 +11,7 @@
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.6.12 - June 12, 2014: Glenn
+ *   libpng versions 0.97, January 1998, through 1.6.13 - August 21, 2014: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -200,6 +200,9 @@
  *    1.6.11                  16    10611  16.so.16.11[.0]
  *    1.6.12rc01-03           16    10612  16.so.16.12[.0]
  *    1.6.12                  16    10612  16.so.16.12[.0]
+ *    1.6.13beta01-04         16    10613  16.so.16.13[.0]
+ *    1.6.13rc01-02           16    10613  16.so.16.13[.0]
+ *    1.6.13                  16    10613  16.so.16.13[.0]
  *
  *   Henceforth the source version will match the shared-library major
  *   and minor numbers; the shared-library major version number will be
@@ -231,7 +234,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.6.12, June 12, 2014, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.6.13, August 21, 2014, are
  * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.2.5
  * with the following individual added to the list of Contributing Authors:
@@ -343,13 +346,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    June 12, 2014
+ *    August 21, 2014
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.6.12 are Y2K compliant.  It is my belief that
+ *    upward through 1.6.13 are Y2K compliant.  It is my belief that
  *    earlier versions were also Y2K compliant.
  *
  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
@@ -411,9 +414,9 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.12"
+#define PNG_LIBPNG_VER_STRING "1.6.13"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.6.12 - June 12, 2014\n"
+     " libpng version 1.6.13 - August 21, 2014\n"
 
 #define PNG_LIBPNG_VER_SONUM   16
 #define PNG_LIBPNG_VER_DLLNUM  16
@@ -421,7 +424,7 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 12
+#define PNG_LIBPNG_VER_RELEASE 13
 
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -452,7 +455,7 @@
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
  */
-#define PNG_LIBPNG_VER 10612 /* 1.6.12 */
+#define PNG_LIBPNG_VER 10613 /* 1.6.13 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -557,7 +560,7 @@
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_12;
+typedef char* png_libpng_version_1_6_13;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
diff --git a/pngconf.h b/pngconf.h
index 72ec81f..62e075f 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
 
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng version 1.6.12 - June 12, 2014
+ * libpng version 1.6.13 - August 21, 2014
  *
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngerror.c b/pngerror.c
index f21f4dd..a2f8a56 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.13 [August 21, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -415,10 +415,13 @@
 }
 #endif /* BENIGN_ERRORS */
 
+#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
+#if defined(PNG_WARNINGS_SUPPORTED) || \
+   (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
 /* These utilities are used internally to build an error message that relates
  * to the current chunk.  The chunk name comes from png_ptr->chunk_name,
- * this is used to prefix the message.  The message is limited in length
- * to 63 bytes, the name characters are output as hex digits wrapped in []
+ * which is used to prefix the message.  The message is limited in length
+ * to 63 bytes. The name characters are output as hex digits wrapped in []
  * if the character is invalid.
  */
 #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
@@ -427,9 +430,6 @@
    'A', 'B', 'C', 'D', 'E', 'F'
 };
 
-#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
-#if defined(PNG_WARNINGS_SUPPORTED) || \
-   (defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
 static void /* PRIVATE */
 png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
     error_message)
diff --git a/pngget.c b/pngget.c
index 9e205ad..172f50a 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/pngpread.c b/pngpread.c
index 819db03..a4d073b 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/pngpriv.h b/pngpriv.h
index c498313..71a5ab4 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -119,8 +119,12 @@
     * PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
     * to compile with an appropriate #error if ALIGNED_MEMORY has been turned
     * off.
+    *
+    * Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
+    * check both variants.
     */
-#  if defined(__ARM_NEON__) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
+#  if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
+   defined(PNG_ALIGNED_MEMORY_SUPPORTED)
 #     define PNG_ARM_NEON_OPT 2
 #  else
 #     define PNG_ARM_NEON_OPT 0
@@ -148,7 +152,7 @@
     * libpng implementation list for incorporation in the next minor release.
     */
 #  ifndef PNG_ARM_NEON_IMPLEMENTATION
-#     ifdef __ARM_NEON__
+#     if defined(__ARM_NEON__) || defined(__ARM_NEON)
 #        if defined(__clang__)
             /* At present it is unknown by the libpng developers which versions
              * of clang support the intrinsics, however some or perhaps all
diff --git a/pngread.c b/pngread.c
index 4bf2021..845ff7b 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -945,7 +945,7 @@
    png_free(png_ptr, png_ptr->save_buffer);
 #endif
 
-#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) &&\
+#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
    defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
    png_free(png_ptr, png_ptr->unknown_chunk.data);
 #endif
@@ -1220,7 +1220,7 @@
 #  define P_LINEAR8 4 /* 8-bit linear: only from a file value */
 
 /* Color-map processing: after libpng has run on the PNG image further
- * processing may be needed to conver the data to color-map indicies.
+ * processing may be needed to convert the data to color-map indices.
  */
 #define PNG_CMAP_NONE      0
 #define PNG_CMAP_GA        1 /* Process GA data to a color-map with alpha */
@@ -2187,7 +2187,7 @@
             data_encoding = P_FILE;
 
             /* The rows from libpng, while technically gray values, are now also
-             * color-map indicies; however, they may need to be expanded to 1
+             * color-map indices; however, they may need to be expanded to 1
              * byte per pixel.  This is what png_set_packing does (i.e., it
              * unpacks the bit values into bytes.)
              */
@@ -2273,8 +2273,8 @@
                 * 8-bit GA and it has to be processing to single byte color-map
                 * values.  Entry 254 is replaced by either a completely
                 * transparent entry or by the background color at full
-                * precision (and the background color is not a simple gray leve
-                * in this case.)
+                * precision (and the background color is not a simple gray
+                * level in this case.)
                 */
                expand_tRNS = 1;
                output_processing = PNG_CMAP_TRANS;
@@ -2752,7 +2752,7 @@
                num_trans = 0;
 
             output_processing = PNG_CMAP_NONE;
-            data_encoding = P_FILE; /* Don't change from color-map indicies */
+            data_encoding = P_FILE; /* Don't change from color-map indices */
             cmap_entries = png_ptr->num_palette;
             if (cmap_entries > 256)
                cmap_entries = 256;
@@ -2792,7 +2792,7 @@
                      i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
             }
 
-            /* The PNG data may have indicies packed in fewer than 8 bits, it
+            /* The PNG data may have indices packed in fewer than 8 bits, it
              * must be expanded if so.
              */
             if (png_ptr->bit_depth < 8)
diff --git a/pngrtran.c b/pngrtran.c
index 5b89423..d8ab705 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/pngrutil.c b/pngrutil.c
index cc52202..3f415bf 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -1319,9 +1319,9 @@
     * chunk is just ignored, so does not invalidate the color space.  An
     * alternative is to set the 'invalid' flags at the start of this routine
     * and only clear them in they were not set before and all the tests pass.
-    * The minimum 'deflate' stream is assumed to be just the 2 byte header and 4
-    * byte checksum.  The keyword must be one character and there is a
-    * terminator (0) byte and the compression method.
+    * The minimum 'deflate' stream is assumed to be just the 2 byte header and
+    * 4 byte checksum.  The keyword must be at least one character and there is
+    * a terminator (0) byte and the compression method.
     */
    if (length < 9)
    {
@@ -2640,7 +2640,7 @@
       /* prefix_length should now be at the trailing '\0' of the translated
        * keyword, but it may already be over the end.  None of this arithmetic
        * can overflow because chunks are at most 2^31 bytes long, but on 16-bit
-       * systems the available allocaton may overflow.
+       * systems the available allocation may overflow.
        */
       ++prefix_length;
 
diff --git a/pngset.c b/pngset.c
index 0c827d3..cde4c6d 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/pngtest.c b/pngtest.c
index ffac74e..bd9688b 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -1991,4 +1991,4 @@
 #endif
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_12 Your_png_h_is_not_version_1_6_12;
+typedef png_libpng_version_1_6_13 Your_png_h_is_not_version_1_6_13;
diff --git a/pngtrans.c b/pngtrans.c
index 792e13a..9b6c3d0 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,7 +1,7 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/pngwrite.c b/pngwrite.c
index 7087d08..f03aeb2 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/pngwutil.c b/pngwutil.c
index cfc3312..8a0b7f2 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * Last changed in libpng 1.6.11 [June 12, 2014]
+ * Last changed in libpng 1.6.11 [June 5, 2014]
  * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/projects/vstudio/readme.txt b/projects/vstudio/readme.txt
index a39fed5..5b0035d 100644
--- a/projects/vstudio/readme.txt
+++ b/projects/vstudio/readme.txt
@@ -1,7 +1,7 @@
 
 VisualStudio instructions
 
-libpng version 1.6.12 - June 12, 2014
+libpng version 1.6.13 - August 21, 2014
 
 Copyright (c) 1998-2010 Glenn Randers-Pehrson
 
diff --git a/projects/vstudio/zlib.props b/projects/vstudio/zlib.props
index 7d09a41..a39e577 100644
--- a/projects/vstudio/zlib.props
+++ b/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
 <!--
  * zlib.props - location of zlib source
  *
- * libpng version 1.6.12 - June 12, 2014
+ * libpng version 1.6.13 - August 21, 2014
  *
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  *
diff --git a/scripts/README.txt b/scripts/README.txt
index b381964..721a0ef 100644
--- a/scripts/README.txt
+++ b/scripts/README.txt
@@ -1,9 +1,9 @@
 
-Makefiles for  libpng version 1.6.12 - June 12, 2014
+Makefiles for  libpng version 1.6.13 - August 21, 2014
 
 pnglibconf.h.prebuilt       =>  Stores configuration settings
  makefile.linux    =>  Linux/ELF makefile
-                       (gcc, creates libpng16.so.16.1.6.12)
+                       (gcc, creates libpng16.so.16.1.6.13)
  makefile.gcc      =>  Generic makefile (gcc, creates static libpng.a)
  makefile.knr      =>  Archaic UNIX Makefile that converts files with
                        ansi2knr (Requires ansi2knr.c from
@@ -19,8 +19,6 @@
  makefile.darwin   =>  Darwin makefile, can use on MacosX
  makefile.dec      =>  DEC Alpha UNIX makefile
  makefile.dj2      =>  DJGPP 2 makefile
- makefile.elf      =>  Linux/ELF makefile symbol versioning,
-                       (gcc, creates libpng16.so.16.1.6.12)
  makefile.freebsd  =>  FreeBSD makefile
  makefile.gcc      =>  Generic gcc makefile
  makefile.hpgcc    =>  HPUX makefile using gcc
@@ -35,12 +33,12 @@
  makefile.os2      =>  OS/2 Makefile (gcc and emx, requires libpng.def)
  makefile.sco      =>  For SCO OSr5  ELF and Unixware 7 with Native cc
  makefile.sggcc    =>  Silicon Graphics (gcc,
-                       creates libpng16.so.16.1.6.12)
+                       creates libpng16.so.16.1.6.13)
  makefile.sgi      =>  Silicon Graphics IRIX makefile (cc, creates static lib)
  makefile.solaris  =>  Solaris 2.X makefile (gcc,
-                       creates libpng16.so.16.1.6.12)
+                       creates libpng16.so.16.1.6.13)
  makefile.so9      =>  Solaris 9 makefile (gcc,
-                       creates libpng16.so.16.1.6.12)
+                       creates libpng16.so.16.1.6.13)
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
  makefile.sunos    =>  Sun makefile
  makefile.32sunu   =>  Sun Ultra 32-bit makefile
diff --git a/scripts/def.dfn b/scripts/def.dfn
index 76dda39..439c6cd 100644
--- a/scripts/def.dfn
+++ b/scripts/def.dfn
@@ -21,7 +21,7 @@
 PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
 PNG_DFN ""
 PNG_DFN "EXPORTS"
-PNG_DFN ";Version 1.6.12"
+PNG_DFN ";Version 1.6.13"
 
 #define PNG_EXPORTA(ordinal, type, name, args, attributes)\
         PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
diff --git a/scripts/dfn.awk b/scripts/dfn.awk
index afa498c..675829d 100755
--- a/scripts/dfn.awk
+++ b/scripts/dfn.awk
Binary files differ
diff --git a/scripts/libpng-config-head.in b/scripts/libpng-config-head.in
index 66df968..035f3d6 100644
--- a/scripts/libpng-config-head.in
+++ b/scripts/libpng-config-head.in
@@ -11,7 +11,7 @@
 
 # Modeled after libxml-config.
 
-version=1.6.12
+version=1.6.13
 prefix=""
 libdir=""
 libs=""
diff --git a/scripts/libpng.pc.in b/scripts/libpng.pc.in
index 4e21234..2f6d3a2 100644
--- a/scripts/libpng.pc.in
+++ b/scripts/libpng.pc.in
@@ -5,6 +5,6 @@
 
 Name: libpng
 Description: Loads and saves PNG files
-Version: 1.6.12
+Version: 1.6.13
 Libs: -L${libdir} -lpng16
 Cflags: -I${includedir}
diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu
index c6e7fed..7d4b7c5 100644
--- a/scripts/makefile.32sunu
+++ b/scripts/makefile.32sunu
@@ -107,8 +107,8 @@
 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
 	echo L_opts=\"-L$(LIBPATH)\"; \
 	echo R_opts=\"-R$(LIBPATH)\"; \
-	echo ccopts=\"-xtarget=ultra\"; \
-	echo ldopts=\"-xtarget=ultra\"; \
+	echo ccopts=\"-fast -xtarget=ultra\"; \
+	echo ldopts=\"-fast -xtarget=ultra\"; \
 	echo libs=\"-lpng16 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
 	chmod +x libpng-config
diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu
index 6186290..341fce9 100644
--- a/scripts/makefile.64sunu
+++ b/scripts/makefile.64sunu
@@ -107,8 +107,8 @@
 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
 	echo L_opts=\"-L$(LIBPATH)\"; \
 	echo R_opts=\"-R$(LIBPATH)\"; \
-	echo ccopts=\"-xtarget=ultra -xarch=v9\"; \
-	echo ldopts=\"-xtarget=ultra -xarch=v9\"; \
+	echo ccopts=\"-fast -xtarget=ultra -xarch=v9\"; \
+	echo ldopts=\"-fast -xtarget=ultra -xarch=v9\"; \
 	echo libs=\"-lpng16 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
 	chmod +x libpng-config
diff --git a/scripts/makefile.atari b/scripts/makefile.atari
index d0aa481..b5dbd49 100644
--- a/scripts/makefile.atari
+++ b/scripts/makefile.atari
@@ -49,7 +49,7 @@
 $(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	cp $< $@
+	cp $(PNGLIBCONF_H_PREBUILT) $@
 
 pngtest.ttp: pngtest.o $(LBR)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
diff --git a/scripts/makefile.bc32 b/scripts/makefile.bc32
index 6fece9c..d488a54 100644
--- a/scripts/makefile.bc32
+++ b/scripts/makefile.bc32
@@ -51,8 +51,8 @@
 LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
 
 # Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
+# See scripts\pnglibconf.mak for more options
+PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
 
 ## Variables
 OBJS = \
@@ -117,7 +117,7 @@
 ## Minor Targets
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
 pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index edac365..01346f1 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -87,7 +87,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.bor b/scripts/makefile.bor
index 254de89..a01f738 100644
--- a/scripts/makefile.bor
+++ b/scripts/makefile.bor
@@ -59,8 +59,8 @@
 LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
 
 # Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
+# See scripts\pnglibconf.mak for more options
+PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
 
 ## Variables
 
@@ -117,7 +117,7 @@
 
 # try !include scripts\pnglibconf.mak for more options
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng: $(LIBNAME)
 
diff --git a/scripts/makefile.cegcc b/scripts/makefile.cegcc
index 88a1109..99848ad 100644
--- a/scripts/makefile.cegcc
+++ b/scripts/makefile.cegcc
@@ -23,7 +23,7 @@
 
 VERMAJ = 1
 VERMIN = 6
-VERMIC = 12
+VERMIC = 13
 VER = $(VERMAJ).$(VERMIN).$(VERMIC)
 NAME = libpng
 PACKAGE = $(NAME)-$(VER)
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index fd6adff..fdc744d 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -84,7 +84,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 54cbcac..8566a02 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -72,7 +72,7 @@
 all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@  $(OBJS)
diff --git a/scripts/makefile.dj2 b/scripts/makefile.dj2
index e21546d..e59c432 100644
--- a/scripts/makefile.dj2
+++ b/scripts/makefile.dj2
@@ -36,7 +36,7 @@
 all: libpng.a pngtest
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
diff --git a/scripts/makefile.elf b/scripts/makefile.elf
deleted file mode 100644
index e595d95..0000000
--- a/scripts/makefile.elf
+++ /dev/null
@@ -1,270 +0,0 @@
-# makefile for libpng.a and libpng16.so on Linux ELF with gcc
-# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs
-# and Glenn Randers-Pehrson
-# Copyright (C) 1996, 1997 Andreas Dilger
-#
-# This code is released under the libpng license.
-# For conditions of distribution and use, see the disclaimer
-# and license in png.h
-
-# Modified for Debian by Junichi Uekawa and Josselin Mouette
-# Major modifications are:
-#    * link libpng explicitly with libz and libm
-#    * $(OLDSO).16 is a symlink rather than a different library
-#    * versioned symbols
-
-# Library name:
-LIBNAME = libpng16
-PNGMAJ = 16
-
-# Shared library names:
-LIBSO=$(LIBNAME).so
-LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
-LIBSOREL=$(LIBSOMAJ).$(RELEASE)
-OLDSO=libpng.so
-OLDSOMAJ=libpng.so.16
-
-# Utilities:
-AR_RC=ar rc
-CC=gcc
-MKDIR_P=mkdir -p
-LN_SF=ln -sf
-RANLIB=ranlib
-CP=cp
-RM_F=/bin/rm -f
-
-# where "make install" puts libpng16.a, libpng16.so*,
-# libpng16/png.h, libpng16/pngconf.h, and libpng16/pnglibconf.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
-
-ALIGN=
-# for i386:
-#ALIGN=-malign-loops=2 -malign-functions=2
-
-WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-	-Wmissing-declarations -Wtraditional -Wcast-align \
-	-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
-
-# for pgcc version 2.95.1, -O3 is buggy; don't use it.
-
-CPPFLAGS=-D_REENTRANT # -DPNG_DEBUG=5
-CFLAGS=-W -Wall -O2 $(ALIGN) # $(WARNMORE) -g
-
-LDFLAGS=-L. -lpng16
-LDFLAGS_A=libpng.a -lz -lm
-LIBADDFLAGS=-lz -lm
-
-
-INCPATH=$(prefix)/include
-LIBPATH=$(exec_prefix)/lib
-MANPATH=$(prefix)/man
-BINPATH=$(exec_prefix)/bin
-
-# override DESTDIR= on the make install command line to easily support
-# installing into a temporary location.  Example:
-#
-#    make install DESTDIR=/tmp/build/libpng
-#
-# If you're going to install into a temporary location
-# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
-# you execute make install.
-DESTDIR=
-
-DB=$(DESTDIR)$(BINPATH)
-DI=$(DESTDIR)$(INCPATH)
-DL=$(DESTDIR)$(LIBPATH)
-DM=$(DESTDIR)$(MANPATH)
-
-# Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
-
-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
-
-OBJSDLL = $(OBJS:.o=.pic.o)
-
-.SUFFIXES:      .c .o .pic.o
-
-.c.o:
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
-
-.c.pic.o:
-	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
-
-all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
-
-pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
-
-libpng.a: $(OBJS)
-	$(AR_RC) $@ $(OBJS)
-	$(RANLIB) $@
-
-libpng.pc:
-	cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-	-e s!@exec_prefix@!$(exec_prefix)! \
-	-e s!@libdir@!$(LIBPATH)! \
-	-e s!@includedir@!$(INCPATH)! \
-	-e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
-
-libpng.syms: png.h pngconf.h pnglibconf.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\
-	awk -F '[\t [\\]();]' -v PNGMAJ=$(PNGMAJ) 'BEGIN{printf("PNG16_%s {global:\n",PNGMAJ)}\
-	{ for (i=1;i+2<=NF;++i)\
-		if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\
-			print $$(i+1) ";";\
-	for (i=1;i+1<=NF;++i)\
-		if ($$(i)=="PNG_DATA_EXPORT")\
-			print $$(i+1) ";";}\
-	END{print "local: *; };"}' >$@.new
-	$(RM_F) $@
-	mv $@.new $@
-
-libpng-config:
-	( cat scripts/libpng-config-head.in; \
-	echo prefix=\"$(prefix)\"; \
-	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
-	echo L_opts=\"\"; \
-	echo R_opts=\"\"; \
-	echo libs=\"-lpng16\"; \
-	echo all_libs=\"-lpng16 $(LIBADDFLAGS)\"; \
-	cat scripts/libpng-config-body.in ) > libpng-config
-	chmod +x libpng-config
-
-$(LIBSO): $(LIBSOMAJ)
-	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
-
-$(LIBSOMAJ): $(OBJSDLL) libpng.syms
-	$(CC) -shared -Wl,-soname,$(LIBSOMAJ) \
-	-Wl,-version-script,libpng.syms \
-	-o $(LIBSOMAJ) \
-	$(OBJSDLL)
-
-pngtest: pngtest.o $(LIBSO)
-	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-pngtest-static: pngtest.o libpng.a
-	$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
-
-test: pngtest pngtest-static
-	@echo ""
-	@echo "   Running pngtest dynamically linked with $(LIBSO):"
-	@echo ""
-	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 pnglibconf.h
-	-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
-	-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
-	cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
-	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
-	-@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.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_P) $(DL); fi
-	cp libpng.a $(DL)/$(LIBNAME).a
-	chmod 644 $(DL)/$(LIBNAME).a
-	-@$(RM_F) $(DL)/libpng.a
-	(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
-
-install-shared: install-headers $(LIBSOMAJ) libpng.pc
-	-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
-	-@$(RM_F) $(DL)/$(LIBSO)
-	-@$(RM_F) $(DL)/$(LIBSOREL)
-	-@$(RM_F) $(DL)/$(OLDSO)
-	cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
-	chmod 755 $(DL)/$(LIBSOREL)
-	(cd $(DL); \
-	$(LN_SF) $(LIBSOREL) $(LIBSO); \
-	$(LN_SF) $(LIBSO) $(OLDSO))
-	-@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)
-
-install-man: libpng.3 libpngpf.3 png.5
-	-@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_P) $(DM)/man5; fi
-	-@$(RM_F) $(DM)/man5/png.5
-	cp png.5 $(DM)/man5
-
-install-config: libpng-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)
-
-install: install-static install-shared install-man install-config
-
-# If you installed in $(DESTDIR), test-installed won't work until you
-# move the library to its final location.  Use test-dd to test it
-# before then.
-
-test-dd:
-	echo
-	echo Testing installed dynamic shared library in $(DL).
-	$(CC) -I$(DI) $(CPPFLAGS) \
-	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
-	   -L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
-	./pngtestd pngtest.png
-
-test-installed:
-	$(CC) $(CPPFLAGS) \
-	   `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
-	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
-	   -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
-	./pngtesti pngtest.png
-
-clean:
-	$(RM_F) *.o libpng.a libpng.syms pngtest pngout.png libpng-config \
-	$(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
-	libpng.pc pnglibconf.h
-
-DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
-writelock:
-	chmod a-w *.[ch35] $(DOCS) scripts/*
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
-
-pngtest.o: png.h pngconf.h pnglibconf.h
diff --git a/scripts/makefile.freebsd b/scripts/makefile.freebsd
index c008435..cad1a5a 100644
--- a/scripts/makefile.freebsd
+++ b/scripts/makefile.freebsd
@@ -60,7 +60,7 @@
 	./pngtest
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	cp $< $@
+	cp $(PNGLIBCONF_H_PREBUILT) $@
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.gcc b/scripts/makefile.gcc
index 8811a28..ba92d15 100644
--- a/scripts/makefile.gcc
+++ b/scripts/makefile.gcc
@@ -43,7 +43,7 @@
 all: static
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 .c.o:
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
diff --git a/scripts/makefile.hp64 b/scripts/makefile.hp64
index 2883d65..5948be8 100644
--- a/scripts/makefile.hp64
+++ b/scripts/makefile.hp64
@@ -89,7 +89,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
@@ -106,7 +106,7 @@
 	( cat scripts/libpng-config-head.in; \
 	echo prefix=\"$(prefix)\"; \
 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
-	echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
+	echo ccopts=\"-O -Ae -Wl,+vnocompatwarnings +DD64 +Z\"; \
 	echo L_opts=\"-L$(LIBPATH)\"; \
 	echo libs=\"-lpng16 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index 2a4a0b3..b07612d 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -87,7 +87,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
@@ -104,7 +104,7 @@
 	( cat scripts/libpng-config-head.in; \
 	echo prefix=\"$(prefix)\"; \
 	echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
-	echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
+	echo ccopts=\"-O -Ae +DA1.1 +DS2.0\"; \
 	echo L_opts=\"-L$(LIBPATH)\"; \
 	echo libs=\"-lpng16 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
diff --git a/scripts/makefile.ibmc b/scripts/makefile.ibmc
index 2f5a03c..89b1196 100644
--- a/scripts/makefile.ibmc
+++ b/scripts/makefile.ibmc
@@ -51,7 +51,7 @@
 all: libpng$(A) pngtest$(E)
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng$(A): $(OBJS)
 	$(AR) -out:$@ $(OBJS)
diff --git a/scripts/makefile.intel b/scripts/makefile.intel
index 9fa963f..4187261 100644
--- a/scripts/makefile.intel
+++ b/scripts/makefile.intel
@@ -39,8 +39,8 @@
 CP=cp
 
 # Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
+# See scripts\pnglibconf.mak for more options
+PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
 
 O=.obj
 
@@ -51,7 +51,7 @@
 all: test
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
 	$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
diff --git a/scripts/makefile.knr b/scripts/makefile.knr
index 38a67cb..d8de064 100644
--- a/scripts/makefile.knr
+++ b/scripts/makefile.knr
@@ -50,7 +50,7 @@
 all: ansi2knr libpng.a pngtest
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 # general rule to allow ansi2knr to work
 .c.o:
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index 4168c92..a595cf8 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -10,7 +10,7 @@
 # Library name:
 LIBNAME = libpng16
 PNGMAJ = 16
-RELEASE = 12
+RELEASE = 13
 
 # Shared library names:
 LIBSO=$(LIBNAME).so
@@ -97,7 +97,7 @@
 all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.mips b/scripts/makefile.mips
index d171dc4..5633608 100644
--- a/scripts/makefile.mips
+++ b/scripts/makefile.mips
@@ -46,7 +46,7 @@
 all: libpng.a pngtest
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
diff --git a/scripts/makefile.msc b/scripts/makefile.msc
index 6e30e81..539d62e 100644
--- a/scripts/makefile.msc
+++ b/scripts/makefile.msc
@@ -20,8 +20,8 @@
 O=.obj
 
 # Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
+# See scripts\pnglibconf.mak for more options
+PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
 
 #uncomment next to put error messages in a file
 ERRFILE= >> pngerrs
@@ -34,7 +34,7 @@
 all: libpng.lib
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
diff --git a/scripts/makefile.msys b/scripts/makefile.msys
index 8f722e3..a10b79a 100644
--- a/scripts/makefile.msys
+++ b/scripts/makefile.msys
@@ -18,7 +18,7 @@
 # Library name:
 LIBNAME = libpng16
 PNGMAJ = 16
-RELEASE = 12
+RELEASE = 13
 
 # Shared library names:
 LIBSO=$(LIBNAME).dll
@@ -87,7 +87,7 @@
 all: static shared
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 .c.o:
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd
index 98258bc..b5a369a 100644
--- a/scripts/makefile.ne12bsd
+++ b/scripts/makefile.ne12bsd
@@ -17,7 +17,7 @@
 
 LIB=	png16
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.6.12
+SHLIB_MINOR=	1.6.13
 SRCS=	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
@@ -42,7 +42,7 @@
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	cp $< $@
+	cp $(PNGLIBCONF_H_PREBUILT) $@
 
 pngtest.o:	pngtest.c
 	${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}
diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd
index 617daa5..e4aefc2 100644
--- a/scripts/makefile.netbsd
+++ b/scripts/makefile.netbsd
@@ -17,7 +17,7 @@
 
 LIB=	png
 SHLIB_MAJOR=	16
-SHLIB_MINOR=	1.6.12
+SHLIB_MINOR=	1.6.13
 SRCS=	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
@@ -42,7 +42,7 @@
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	cp $< $@
+	cp $(PNGLIBCONF_H_PREBUILT) $@
 
 pngtest.o:	pngtest.c
 	${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}
diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd
index 8a6ebe6..64257be 100644
--- a/scripts/makefile.openbsd
+++ b/scripts/makefile.openbsd
@@ -11,7 +11,7 @@
 MANDIR= ${PREFIX}/man/cat
 
 SHLIB_MAJOR=	16
-SHLIB_MINOR=	1.6.12
+SHLIB_MINOR=	1.6.13
 
 LIB=	png
 SRCS=	png.c pngerror.c pngget.c pngmem.c pngpread.c \
@@ -39,7 +39,7 @@
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	cp $< $@
+	cp $(PNGLIBCONF_H_PREBUILT) $@
 
 pngtest.o:	pngtest.c
 	${CC} ${CPPFLAGS} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index 6e5457d..b9c7c40 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -83,7 +83,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index f8721c9..a0d051d 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -86,7 +86,7 @@
 all: libpng.a pngtest shared libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index 561ce83..7df0902 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -89,7 +89,7 @@
 all: libpng.a pngtest shared libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.so9 b/scripts/makefile.so9
index 9102e69..ba9308c 100644
--- a/scripts/makefile.so9
+++ b/scripts/makefile.so9
@@ -93,7 +93,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 879e6a4..8a450d3 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -89,7 +89,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.solaris-x86 b/scripts/makefile.solaris-x86
index 509d5a3..b6d2437 100644
--- a/scripts/makefile.solaris-x86
+++ b/scripts/makefile.solaris-x86
@@ -88,7 +88,7 @@
 all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@ $(OBJS)
diff --git a/scripts/makefile.sunos b/scripts/makefile.sunos
index df661bf..efe308c 100644
--- a/scripts/makefile.sunos
+++ b/scripts/makefile.sunos
@@ -58,7 +58,7 @@
 all: libpng.a pngtest
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 libpng.a: $(OBJS)
 	$(AR_RC) $@  $(OBJS)
diff --git a/scripts/makefile.tc3 b/scripts/makefile.tc3
index e4744a7..c917a08 100644
--- a/scripts/makefile.tc3
+++ b/scripts/makefile.tc3
@@ -15,8 +15,8 @@
 CP=copy
 
 # Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
+# See scripts\pnglibconf.mak for more options
+PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
 
 O=.obj
 E=.exe
@@ -32,7 +32,7 @@
 all: libpng$(MODEL).lib pngtest$(E)
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-	$(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 pngtest: pngtest$(E)
 
diff --git a/scripts/makefile.vcwin32 b/scripts/makefile.vcwin32
index b17f6a4..6219692 100644
--- a/scripts/makefile.vcwin32
+++ b/scripts/makefile.vcwin32
@@ -23,8 +23,8 @@
 RM = del
 
 # Pre-built configuration
-# See scripts/pnglibconf.mak for more options
-PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
+# See scripts\pnglibconf.mak for more options
+PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
 
 # File extensions
 O=.obj
@@ -42,7 +42,7 @@
 all: libpng.lib
 
 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
-       $(CP) $< $@
+	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
 
 png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
 	$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa
index 294a4e2..46f61c2 100644
--- a/scripts/pnglibconf.dfa
+++ b/scripts/pnglibconf.dfa
@@ -721,7 +721,7 @@
 chunk sBIT
 chunk sCAL
 chunk sPLT
-chunk sRGB enables COLORSPACE, GAMMA
+chunk sRGB enables COLORSPACE, GAMMA, SET_OPTION
 chunk tEXt requires TEXT
 chunk tIME
 chunk tRNS
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 08ee25c..4c8605a 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -1,8 +1,8 @@
-/* libpng 1.6.12 STANDARD API DEFINITION */
+/* libpng 1.6.13 STANDARD API DEFINITION */
 
 /* pnglibconf.h - library build configuration */
 
-/* Libpng version 1.6.12 - June 12, 2014 */
+/* Libpng version 1.6.13 - August 21, 2014 */
 
 /* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
 
diff --git a/scripts/symbols.def b/scripts/symbols.def
index 8cc25de..48a41b0 100644
--- a/scripts/symbols.def
+++ b/scripts/symbols.def
@@ -1,4 +1,4 @@
-;Version 1.6.12
+;Version 1.6.13
 ;--------------------------------------------------------------
 ; LIBPNG symbol list as a Win32 DEF file
 ; Contains all the symbols that can be exported from libpng