diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-12-06 06:42:54 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2024-01-17 10:33:57 -0300 |
commit | 5b1ce32bbced20b01be2dcea4ecca510a7194b75 (patch) | |
tree | b914170c00fec607ab43f09d3eaf0fc5bd0a6296 | |
parent | build(deps): bump github/codeql-action from 3.22.12 to 3.23.0 (diff) | |
download | firejail-5b1ce32bbced20b01be2dcea4ecca510a7194b75.tar.gz firejail-5b1ce32bbced20b01be2dcea4ecca510a7194b75.tar.zst firejail-5b1ce32bbced20b01be2dcea4ecca510a7194b75.zip |
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.
-rw-r--r-- | config.mk.in | 1 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/prog.mk | 2 | ||||
-rw-r--r-- | src/so.mk | 2 |
5 files changed, 5 insertions, 2 deletions
diff --git a/config.mk.in b/config.mk.in index 958efdb34..403d78e37 100644 --- a/config.mk.in +++ b/config.mk.in | |||
@@ -76,6 +76,7 @@ MANFLAGS = \ | |||
76 | # https://www.gnu.org/software/automake/manual/1.16.5/html_node/User-Variables.html | 76 | # https://www.gnu.org/software/automake/manual/1.16.5/html_node/User-Variables.html |
77 | CC=@CC@ | 77 | CC=@CC@ |
78 | CFLAGS=@CFLAGS@ | 78 | CFLAGS=@CFLAGS@ |
79 | CPPFLAGS=@CPPFLAGS@ | ||
79 | LDFLAGS=@LDFLAGS@ | 80 | LDFLAGS=@LDFLAGS@ |
80 | 81 | ||
81 | # Project variables | 82 | # Project variables |
@@ -5308,6 +5308,7 @@ cat <<EOF | |||
5308 | Compile options: | 5308 | Compile options: |
5309 | CC: $CC | 5309 | CC: $CC |
5310 | CFLAGS: $CFLAGS | 5310 | CFLAGS: $CFLAGS |
5311 | CPPFLAGS: $CPPFLAGS | ||
5311 | LDFLAGS: $LDFLAGS | 5312 | LDFLAGS: $LDFLAGS |
5312 | EXTRA_CFLAGS: $EXTRA_CFLAGS | 5313 | EXTRA_CFLAGS: $EXTRA_CFLAGS |
5313 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS | 5314 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS |
diff --git a/configure.ac b/configure.ac index fc99820de..d3b05d839 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -276,6 +276,7 @@ cat <<EOF | |||
276 | Compile options: | 276 | Compile options: |
277 | CC: $CC | 277 | CC: $CC |
278 | CFLAGS: $CFLAGS | 278 | CFLAGS: $CFLAGS |
279 | CPPFLAGS: $CPPFLAGS | ||
279 | LDFLAGS: $LDFLAGS | 280 | LDFLAGS: $LDFLAGS |
280 | EXTRA_CFLAGS: $EXTRA_CFLAGS | 281 | EXTRA_CFLAGS: $EXTRA_CFLAGS |
281 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS | 282 | EXTRA_LDFLAGS: $EXTRA_LDFLAGS |
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) | |||
13 | all: $(TARGET) | 13 | all: $(TARGET) |
14 | 14 | ||
15 | %.o : %.c $(HDRS) $(ROOT)/config.mk | 15 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
16 | $(CC) $(PROG_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@ | 16 | $(CC) $(PROG_CFLAGS) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
17 | 17 | ||
18 | $(PROG): $(OBJS) $(ROOT)/config.mk | 18 | $(PROG): $(OBJS) $(ROOT)/config.mk |
19 | $(CC) $(PROG_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) | 19 | $(CC) $(PROG_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
@@ -13,7 +13,7 @@ OBJS := $(SRCS:.c=.o) $(EXTRA_OBJS) | |||
13 | all: $(TARGET) | 13 | all: $(TARGET) |
14 | 14 | ||
15 | %.o : %.c $(HDRS) $(ROOT)/config.mk | 15 | %.o : %.c $(HDRS) $(ROOT)/config.mk |
16 | $(CC) $(SO_CFLAGS) $(CFLAGS) $(INCLUDE) -c $< -o $@ | 16 | $(CC) $(SO_CFLAGS) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
17 | 17 | ||
18 | $(SO): $(OBJS) $(ROOT)/config.mk | 18 | $(SO): $(OBJS) $(ROOT)/config.mk |
19 | $(CC) $(SO_LDFLAGS) -shared $(LDFLAGS) -o $@ $(OBJS) -ldl | 19 | $(CC) $(SO_LDFLAGS) -shared $(LDFLAGS) -o $@ $(OBJS) -ldl |