mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user