From 5b1ce32bbced20b01be2dcea4ecca510a7194b75 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 6 Dec 2022 06:42:54 -0300 Subject: build: use CPPFLAGS instead of INCLUDE in compile targets With this, CFLAGS and CPPFLAGS are used when compiling and LDFLAGS when linking, just like in the built-in GNU make rules. From `make -p`: COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) LINK.o = $(CC) $(LDFLAGS) $(TARGET_ARCH) Note: It is unclear where the `INCLUDE` variable comes from; it is not documented in autoconf nor GNU make and automake (which itself is not used in this repository) only mentions `INCLUDES`: `INCLUDES` This does the same job as `AM_CPPFLAGS` (or any per-target `_CPPFLAGS` variable if it is used). It is an older name for the same functionality. This variable is deprecated; we suggest using `AM_CPPFLAGS` and per-target `_CPPFLAGS` instead. Environment: automake 1.16.5-2 and GNU make 4.4.1 on Artix Linux. See also commit 671c3f249 ("build: actually set LDFLAGS and LIBS in makefiles", 2022-11-30) / PR #5504. --- src/prog.mk | 2 +- src/so.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/prog.mk b/src/prog.mk index b7ac59785..426961c29 100644 --- a/src/prog.mk +++ b/src/prog.mk @@ -13,7 +13,7 @@ OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) all: $(TARGET) %.o : %.c $(HDRS) $(ROOT)/config.mk - $(CC) $(PROG_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@ + $(CC) $(PROG_CFLAGS) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(PROG): $(OBJS) $(ROOT)/config.mk $(CC) $(PROG_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) diff --git a/src/so.mk b/src/so.mk index c1913b794..27c5695a8 100644 --- a/src/so.mk +++ b/src/so.mk @@ -13,7 +13,7 @@ OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) all: $(TARGET) %.o : %.c $(HDRS) $(ROOT)/config.mk - $(CC) $(SO_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@ + $(CC) $(SO_CFLAGS) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(SO): $(OBJS) $(ROOT)/config.mk $(CC) $(SO_LDFLAGS) -shared $(LDFLAGS) -o $@ $(OBJS) -ldl -- cgit v1.2.3-54-g00ecf