From 60a95f00bb1a3185fce4bacb5367201685767444 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Wed, 19 Oct 2022 14:06:16 -0300 Subject: makefiles: expand HDRS, SRCS and OBJS immediately Use immediate expansion of the right-hand side (with `:=`) to set the variables to the output of the commands rather than to the (text of the) commands themselves. This should prevent deferred/lazy evaluation, which is something that might potentially result in the relevant files being looked up each time that HDRS and SRCS are evaluated. Commands used to search and replace: git grep -Ilz '^SRCS' -- src | xargs -0 -I '{}' \ sh -c "printf '%s\n' \"\$(sed \ -e 's/^HDRS =/HDRS :=/' \ -e 's/^SRCS =/SRCS :=/' \ -e 's/^OBJS =/OBJS :=/' '{}')\" >'{}'" --- src/libpostexecseccomp/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libpostexecseccomp') diff --git a/src/libpostexecseccomp/Makefile b/src/libpostexecseccomp/Makefile index 284e0973b..c0cab45fb 100644 --- a/src/libpostexecseccomp/Makefile +++ b/src/libpostexecseccomp/Makefile @@ -1,9 +1,9 @@ ROOT = ../.. -include $(ROOT)/config.mk -HDRS = $(sort $(wildcard *.h)) -SRCS = $(sort $(wildcard *.c)) -OBJS = $(SRCS:.c=.o) +HDRS := $(sort $(wildcard *.h)) +SRCS := $(sort $(wildcard *.c)) +OBJS := $(SRCS:.c=.o) CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC -Wformat -Wformat-security LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now -- cgit v1.2.3-54-g00ecf