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 using emscripten
# Copyright (C) 2000, 2014, 2019-2022 Cosmin Truta
# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta
# Copyright (C) 2021 Kirk Roerig
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
@@ -15,13 +15,14 @@ ZLIBLIB = ../zlib
# Compiler, linker, lib and other tools
CC = emcc
LD = $(CC)
AR_RC = emar rcs
AR = emar
RANLIB = emranlib
CP = cp
RM_F = rm -f
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef
ARFLAGS = rc
LDFLAGS = -L$(ZLIBLIB)
PNGTEST_LDFLAGS = --preload-file=pngtest.png
LIBS = -lz -lm
@@ -51,7 +52,7 @@ shared:
@false
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
$(RANLIB) $@
test: pngtest