From 9cc729b5235241a7594ae4ce932ea0878cb6dd5f Mon Sep 17 00:00:00 2001 From: Cosmin Truta Date: Tue, 21 Jan 2025 19:06:43 +0200 Subject: [PATCH] build: Update scripts/makefile.* Apply the following updates: * Tidy up the compiler flag definitions. * Update the Darwin, Linux and MSYS makefiles to match the compiler flags used in scripts/makefile.clang and scripts/makefile.gcc. * Add the `pngtest-static` target in the Darwin makefile, following on the Linux makefile. * Rewrite some of the implicit make rules to match one another more consistently. * Make corrections in the copyright years to match git log. --- scripts/makefile.32sunu | 11 +++----- scripts/makefile.64sunu | 11 +++----- scripts/makefile.aix | 7 +++-- scripts/makefile.atari | 4 +-- scripts/makefile.beos | 10 +++---- scripts/makefile.darwin | 56 ++++++++++++++++++++++++++-------------- scripts/makefile.dec | 6 ++--- scripts/makefile.dj2 | 6 ++--- scripts/makefile.freebsd | 4 +-- scripts/makefile.hp64 | 4 +-- scripts/makefile.hpgcc | 10 +++---- scripts/makefile.hpux | 4 +-- scripts/makefile.ibmc | 4 +-- scripts/makefile.linux | 38 +++++++++++++-------------- scripts/makefile.mips | 4 +-- scripts/makefile.msys | 25 +++++++++++------- scripts/makefile.netbsd | 4 +-- scripts/makefile.openbsd | 4 +-- scripts/makefile.sco | 4 +-- scripts/makefile.sggcc | 7 +++-- scripts/makefile.sgi | 9 +++---- scripts/makefile.so9 | 5 ++-- scripts/makefile.solaris | 9 +++---- scripts/makefile.std | 6 ++--- scripts/makefile.sunos | 4 +-- 25 files changed, 127 insertions(+), 129 deletions(-) diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu index 822e8a9235..2dd8877ed4 100644 --- a/scripts/makefile.32sunu +++ b/scripts/makefile.32sunu @@ -1,6 +1,6 @@ # makefile for libpng on Solaris 2.x with cc # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -36,13 +36,10 @@ SUN_LD_FLAGS=-fast -xtarget=ultra ZLIBLIB=/usr/lib ZLIBINC=/usr/include -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes # -Wconversion CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g +CFLAGS=$(SUN_CC_FLAGS) # -g ARFLAGS=rc -LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm +LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm # -g OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ @@ -53,7 +50,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu index 65414b6b57..932db02303 100644 --- a/scripts/makefile.64sunu +++ b/scripts/makefile.64sunu @@ -1,6 +1,6 @@ # makefile for libpng on Solaris 2.x with cc # Contributed by William L. Sebok, based on makefile.linux -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -36,13 +36,10 @@ SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9 ZLIBLIB=/usr/lib ZLIBINC=/usr/include -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes # -Wconversion CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g +CFLAGS=$(SUN_CC_FLAGS) # -g ARFLAGS=rc -LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm +LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # -g OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ @@ -53,7 +50,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c diff --git a/scripts/makefile.aix b/scripts/makefile.aix index 5b24f54fc7..98228693dc 100644 --- a/scripts/makefile.aix +++ b/scripts/makefile.aix @@ -1,5 +1,5 @@ # makefile for libpng using gcc (generic, static library) -# Copyright (C) 2000, 2020-2024 Cosmin Truta +# Copyright (C) 2000, 2020-2025 Cosmin Truta # Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. @@ -22,9 +22,8 @@ RM_F = rm -f LIBNAME = libpng16 PNGMAJ = 16 -WARNMORE = CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g +CFLAGS = -O2 # -g ARFLAGS = rc LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g @@ -35,7 +34,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ # Targets .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: $(LIBNAME).a pngtest diff --git a/scripts/makefile.atari b/scripts/makefile.atari index 6ed1f79900..02e137ac30 100644 --- a/scripts/makefile.atari +++ b/scripts/makefile.atari @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2022 Cosmin Truta +# Copyright (C) 2022-2025 Cosmin Truta # Copyright (C) 2002, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -28,7 +28,7 @@ OBJS = $(LBR)(png.o) $(LBR)(pngerror.o) $(LBR)(pngget.o) $(LBR)(pngmem.o) \ all: $(LBR) pngtest.ttp .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c $(LBR): $(OBJS) diff --git a/scripts/makefile.beos b/scripts/makefile.beos index fcc7f9caca..13f79cc2cc 100644 --- a/scripts/makefile.beos +++ b/scripts/makefile.beos @@ -1,6 +1,6 @@ # makefile for libpng on BeOS x86 ELF with gcc # modified from makefile.linux by Sander Stoks -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2020-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1999 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -33,14 +33,10 @@ 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 - # On BeOS, -O1 is actually better than -O3. This is a known bug but it's # still here in R4.5 CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=-O1 -funroll-loops $(ALIGN) -Wall -Wextra -Wundef # $(WARNMORE) -g +CFLAGS=-O1 -funroll-loops $(ALIGN) # -g ARFLAGS=rc # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz # -g @@ -58,7 +54,7 @@ OBJSDLL = $(OBJS) .SUFFIXES: .c .o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a $(LIBSO) pngtest diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin index e68797e5e1..3e42c5c8e9 100644 --- a/scripts/makefile.darwin +++ b/scripts/makefile.darwin @@ -1,5 +1,5 @@ # makefile for libpng on Darwin / macOS -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2014, 2018-2025 Cosmin Truta # Copyright (C) 2002, 2004, 2006, 2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 2001 Christoph Pfisterer # derived from makefile.linux: @@ -10,10 +10,6 @@ # For conditions of distribution and use, see the disclaimer # and license in png.h -# Where the zlib library and include files are located -ZLIBLIB=/usr/lib -ZLIBINC=/usr/include - # Library name: LIBNAME=libpng16 PNGMAJ=16 @@ -30,13 +26,22 @@ LN_SF=ln -sf CP=cp RM_F=rm -f -NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ - -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 -DEFS=$(NOHWOPT) -CPPFLAGS=-I$(ZLIBINC) $(DEFS) -CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef -ARFLAGS=rc -LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz +# Compiler and linker flags +NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ + -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 +STDC = -pedantic-errors +WARN = -Wall -Wextra -Wundef +WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \ + -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes +LOCAL_CPPFLAGS = $(NOHWOPT) +CPPFLAGS = # -DPNG_DEBUG=5 +ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) +LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE) +CFLAGS = -O3 -funroll-loops # -g +ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) +ARFLAGS = rc +LDFLAGS = -L. -lpng16 -lz # -g +LDFLAGS_A = libpng.a -lz -lm # -g # Pre-built configuration # See scripts/pnglibconf.mak for more options @@ -52,12 +57,12 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c .c.pic.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -fno-common -o $@ $*.c + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -fno-common -o $@ $*.c -all: libpng.a $(LIBSO) pngtest +all: libpng.a $(LIBSO) pngtest pngtest-static pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ @@ -71,15 +76,25 @@ $(LIBSO): $(LIBSOMAJ) $(LIBSOMAJ): $(OBJSDLL) $(CC) -dynamiclib \ - -current_version 16 -compatibility_version 16 \ - -o $(LIBSOMAJ) \ - $(OBJSDLL) -L$(ZLIBLIB) -lz + -current_version 16 -compatibility_version 16 \ + -o $(LIBSOMAJ) \ + $(OBJSDLL) -lz pngtest: pngtest.o $(LIBSO) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) -test: pngtest +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 "" ./pngtest + @echo "" + @echo " Running pngtest statically linked with libpng.a:" + @echo "" + ./pngtest-static install: @echo "The $@ target is no longer supported by this makefile." @@ -94,8 +109,9 @@ install-shared: @false clean: - $(RM_F) *.o libpng.a pngtest pngout.png + $(RM_F) $(OBJS) $(OBJSDLL) libpng.a $(RM_F) $(LIBNAME).*dylib pnglibconf.h + $(RM_F) pngtest*.o pngtest pngtest-static pngout.png # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/scripts/makefile.dec b/scripts/makefile.dec index 2cca020df6..6be1f65a7f 100644 --- a/scripts/makefile.dec +++ b/scripts/makefile.dec @@ -1,5 +1,5 @@ # makefile for libpng on DEC Alpha Unix -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2020-2025 Cosmin Truta # Copyright (C) 2000-2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -30,7 +30,7 @@ ZLIBLIB=../zlib ZLIBINC=../zlib CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=-std -w1 -O # -g +CFLAGS=-std -w1 -O ARFLAGS=rc LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm @@ -43,7 +43,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: $(LIBSO) libpng.a pngtest diff --git a/scripts/makefile.dj2 b/scripts/makefile.dj2 index 3767150978..04a12da085 100644 --- a/scripts/makefile.dj2 +++ b/scripts/makefile.dj2 @@ -1,5 +1,5 @@ # DJGPP (DOS gcc) makefile for libpng -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2020-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2009-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -11,7 +11,7 @@ CC=gcc AR=ar RANLIB=ranlib CPPFLAGS=-I../zlib -DPNG_NO_SNPRINTF -CFLAGS=-O +CFLAGS=-O2 -Wall -Wextra -Wundef ARFLAGS=rc LDFLAGS=-L. -L../zlib/ -lpng -lz -lm @@ -27,7 +27,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a pngtest diff --git a/scripts/makefile.freebsd b/scripts/makefile.freebsd index e4e96a14be..20a147dc3b 100644 --- a/scripts/makefile.freebsd +++ b/scripts/makefile.freebsd @@ -1,5 +1,5 @@ # makefile for libpng under FreeBSD -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2014 Glenn Randers-Pehrson and Andrey A. Chernov # Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov # @@ -35,7 +35,7 @@ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c .c.o: - ${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< + ${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $*.c pnglibconf.h: ${PNGLIBCONF_H_PREBUILT} cp ${PNGLIBCONF_H_PREBUILT} $@ diff --git a/scripts/makefile.hp64 b/scripts/makefile.hp64 index c974d2f334..971aadc8c4 100644 --- a/scripts/makefile.hp64 +++ b/scripts/makefile.hp64 @@ -1,5 +1,5 @@ # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 1999-2002, 2006, 2009, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard @@ -56,7 +56,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc index a24fb93398..1d00491b86 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) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 2001, Laurent faillie # Copyright (C) 1998, 1999 Greg Roelofs @@ -37,12 +37,8 @@ ZLIBINC=/opt/zlib/include # LDSHARED=ld -b # SHAREDLIB=libz.sl -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes # -Wconversion - CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g +CFLAGS=-O3 -funroll-loops # -g ARFLAGS=rc #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g @@ -56,7 +52,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux index c3950ae3f5..59f4334370 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) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42 # Contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard @@ -55,7 +55,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c diff --git a/scripts/makefile.ibmc b/scripts/makefile.ibmc index 95cd0d8b76..1bc95222ee 100644 --- a/scripts/makefile.ibmc +++ b/scripts/makefile.ibmc @@ -1,7 +1,7 @@ # Makefile for libpng (static) # IBM C version 3.x for Win32 and OS/2 # Copyright (C) 2006, 2014 Glenn Randers-Pehrson -# Copyright (C) 2000, 2020 Cosmin Truta +# Copyright (C) 2000, 2020-2025 Cosmin Truta # # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer @@ -46,7 +46,7 @@ LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A) # Targets .c$(O): - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c all: libpng$(A) pngtest$(E) diff --git a/scripts/makefile.linux b/scripts/makefile.linux index c49cdde9d2..09bbe24812 100644 --- a/scripts/makefile.linux +++ b/scripts/makefile.linux @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng16.so on Linux ELF with gcc -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and # Glenn Randers-Pehrson # Copyright (C) 1996, 1997 Andreas Dilger @@ -24,24 +24,22 @@ LN_SF=ln -sf CP=cp RM_F=rm -f -# Where the zlib library and include files are located. -#ZLIBLIB=/usr/local/lib -#ZLIBINC=/usr/local/include -ZLIBLIB=../zlib -ZLIBINC=../zlib - # Compiler and linker flags -NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ - -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes # -Wconversion -DEFS=$(NOHWOPT) -CPPFLAGS=-I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5 -CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g -ARFLAGS=rc -LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g -LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm # -g +NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ + -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 +STDC = -pedantic-errors +WARN = -Wall -Wextra -Wundef +WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \ + -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes +LOCAL_CPPFLAGS = $(NOHWOPT) +CPPFLAGS = # -DPNG_DEBUG=5 +ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) +LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE) +CFLAGS = -O3 -funroll-loops # -g +ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) +ARFLAGS = rc +LDFLAGS = -L. -Wl,-rpath,. -lpng16 -lz -lm # -g +LDFLAGS_A = libpng.a -lz -lm # -g # Pre-built configuration # See scripts/pnglibconf.mak for more options @@ -57,10 +55,10 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c .c.pic.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -fPIC -o $@ $*.c all: libpng.a $(LIBSO) pngtest pngtest-static diff --git a/scripts/makefile.mips b/scripts/makefile.mips index 45de36d46f..4822a7065e 100644 --- a/scripts/makefile.mips +++ b/scripts/makefile.mips @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 1998-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -26,7 +26,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a pngtest diff --git a/scripts/makefile.msys b/scripts/makefile.msys index 8ebcaab992..3951c7467d 100644 --- a/scripts/makefile.msys +++ b/scripts/makefile.msys @@ -1,5 +1,5 @@ # makefile for libpng using MSYS/gcc (shared, static library) -# Copyright (C) 2000, 2019-2024 Cosmin Truta +# Copyright (C) 2000, 2019-2025 Cosmin Truta # Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler # # Portions taken from makefile.linux and makefile.gcc: @@ -21,23 +21,28 @@ PNGMAJ=16 LIBSO=$(LIBNAME).dll LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ) -# Where the zlib library and include files are located. -#ZLIBLIB=../zlib -#ZLIBINC=../zlib -ZLIBLIB=/usr/local/lib -ZLIBINC=/usr/local/include - # Compiler, linker, lib and other tools CC = gcc LD = $(CC) AR = ar RANLIB = ranlib CP = cp -RM_F = rm -rf +RM_F = rm -f LN_SF = ln -sf +# Compiler and linker flags +NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ + -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 +STDC = -pedantic-errors +WARN = -Wall -Wextra -Wundef +WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \ + -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes +LOCAL_CPPFLAGS = $(NOHWOPT) CPPFLAGS = # -DPNG_DEBUG=5 -CFLAGS = -O2 -Wall -Wextra -Wundef # -g +ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) +LOCAL_CFLAGS = $(STDC) $(WARN) # $(WARNMORE) +CFLAGS = -O2 # -g +ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) ARFLAGS = rc LDFLAGS = # -g LIBS = -lz -lm @@ -61,7 +66,7 @@ pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) $(CP) $(PNGLIBCONF_H_PREBUILT) $@ .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) $< + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c static: libpng.a pngtest$(EXEEXT) diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd index d3419f29b5..72643df02a 100644 --- a/scripts/makefile.netbsd +++ b/scripts/makefile.netbsd @@ -1,5 +1,5 @@ # makefile for libpng on NetBSD -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson # Copyright (C) 2002 Patrick R.L. Welche # @@ -32,7 +32,7 @@ PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt # .endif .c.o: - ${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< + ${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $*.c pnglibconf.h: ${PNGLIBCONF_H_PREBUILT} cp ${PNGLIBCONF_H_PREBUILT} $@ diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd index 6bfeab7794..1b93f02fe8 100644 --- a/scripts/makefile.openbsd +++ b/scripts/makefile.openbsd @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2022 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -26,7 +26,7 @@ CLEANFILES+= pngtest.o pngtest pnglibconf.h PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt .c.o: - ${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $< + ${CC} -c ${CPPFLAGS} ${CFLAGS} -o $@ $*.c pnglibconf.h: ${PNGLIBCONF_H_PREBUILT} cp ${PNGLIBCONF_H_PREBUILT} $@ diff --git a/scripts/makefile.sco b/scripts/makefile.sco index 8a8e50ffc7..2054c5138b 100644 --- a/scripts/makefile.sco +++ b/scripts/makefile.sco @@ -1,7 +1,7 @@ # makefile for SCO OSr5 ELF and Unixware 7 with Native cc # Contributed by Mike Hopkirk (hops at sco.com) modified from Makefile.lnx # force ELF build dynamic linking, SONAME setting in lib and RPATH in app -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998 Greg Roelofs # Copyright (C) 1996, 1997 Andreas Dilger @@ -50,7 +50,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc index f694f6eedb..d8a6091ffa 100644 --- a/scripts/makefile.sggcc +++ b/scripts/makefile.sggcc @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc' -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2001-2002, 2006, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -35,9 +35,8 @@ ZLIBINC=../zlib # See "man abi". zlib must be built with the same ABI. ABI= -WARNMORE= CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g +CFLAGS=$(ABI) -O -fPIC -mabi=n32 # -g ARFLAGS=rc LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm # -g LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ @@ -53,7 +52,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a pngtest shared diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi index a60650c251..fb5350957d 100644 --- a/scripts/makefile.sgi +++ b/scripts/makefile.sgi @@ -1,5 +1,5 @@ # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc' -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2001-2002, 2006, 2007, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -35,11 +35,10 @@ ZLIBINC=../zlib # See "man abi". zlib must be built with the same ABI. ABI= -WARNMORE=-fullwarn # Note: -KPIC is the default anyhow CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -#CFLAGS= $(ABI) -O $(WARNMORE) -KPIC # -g -CFLAGS=$(ABI) -O $(WARNMORE) # -g +#CFLAGS=$(ABI) -O -fullwarn -KPIC # -g +CFLAGS=$(ABI) -O -fullwarn # -g ARFLAGS=rc LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng16 -lz -lm # -g LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm # -g @@ -56,7 +55,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a pngtest shared diff --git a/scripts/makefile.so9 b/scripts/makefile.so9 index 5af3ad9956..d856701764 100644 --- a/scripts/makefile.so9 +++ b/scripts/makefile.so9 @@ -1,7 +1,7 @@ # 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) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson # Copyright (C) 1998-2001 Greg Roelofs # Copyright (C) 1996-1997 Andreas Dilger @@ -19,7 +19,6 @@ LIBSO=$(LIBNAME).so LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) # Utilities: -# gcc 2.95 doesn't work. CC=cc AR=ar RANLIB=echo @@ -56,7 +55,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris index c4d7709785..3274830a90 100644 --- a/scripts/makefile.solaris +++ b/scripts/makefile.solaris @@ -1,5 +1,5 @@ # makefile for libpng on Solaris 2.x with gcc -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2004, 2006-2008, 2010-2014 Glenn Randers-Pehrson # Contributed by William L. Sebok, based on makefile.linux # Copyright (C) 1998 Greg Roelofs @@ -34,11 +34,8 @@ RM_F=/bin/rm -f ZLIBLIB=/usr/local/lib ZLIBINC=/usr/local/include -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes # -Wconversion CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5 -CFLAGS=-O -Wall -Wextra -Wundef # $(WARNMORE) -g +CFLAGS=-O # -g ARFLAGS=rc LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # -g @@ -55,7 +52,7 @@ OBJSDLL = $(OBJS:.o=.pic.o) .SUFFIXES: .c .o .pic.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c .c.pic.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c diff --git a/scripts/makefile.std b/scripts/makefile.std index 6d69bf586b..5c793eaf29 100644 --- a/scripts/makefile.std +++ b/scripts/makefile.std @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2015, 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -23,7 +23,7 @@ RM_F = rm -f AWK = awk NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ - -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 + -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build DFA_EXTRA = # extra files that can be used to control configuration CPPFLAGS = -I$(ZLIBINC) $(NOHWOPT) # -DPNG_DEBUG=5 @@ -41,7 +41,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a pngtest diff --git a/scripts/makefile.sunos b/scripts/makefile.sunos index e8c046bb00..2ce8ef42fc 100644 --- a/scripts/makefile.sunos +++ b/scripts/makefile.sunos @@ -1,5 +1,5 @@ # makefile for libpng -# Copyright (C) 2020-2024 Cosmin Truta +# Copyright (C) 2018-2025 Cosmin Truta # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # @@ -33,7 +33,7 @@ OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o .c.o: - $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< + $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $*.c all: libpng.a pngtest