build: Update the makefiles for the benefit of cross-compilation

Split AR_RC into AR and ARFLAGS. The variables AR and ARFLAGS are
de-facto standards (like CC and CFLAGS, LD and LDFLAGS, etc.) that
may be overridden when running make. Moreover, configuring CC, LD,
AR, etc., to point to a cross-platform compiler, linker, librarian,
etc., is a de-facto standard practice as well.

Also remove the MKDIR_P variable definitions from all makefiles.
They've been leftovers from the removal of the "install*" targets.
This commit is contained in:
Cosmin Truta
2024-02-11 23:14:09 +02:00
parent 8120345c89
commit 1cdde11877
27 changed files with 105 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
# makefile for libpng
# Copyright (C) 2020-2022 Cosmin Truta
# Copyright (C) 2020-2024 Cosmin Truta
# Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
@@ -16,9 +16,8 @@ ZLIBINC=../zlib
CC = cc
CPP = $(CC) -E
LD = $(CC)
AR_RC = ar rc
AR = ar
RANLIB = ranlib
MKDIR_P = mkdir
MV_F = mv -f
RM_F = rm -f
AWK = awk
@@ -29,6 +28,7 @@ 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
CFLAGS = -O # -g
ARFLAGS = rc
LDFLAGS = -L$(ZLIBLIB) # -g
LIBS = -lz -lm
@@ -66,7 +66,7 @@ pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa
$(MV_F) pnglibconf.tmp $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
$(RANLIB) $@
pngtest: pngtest.o libpng.a