From 5d894620b437a28a3742df35cbdd2b7d2f2cdea7 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Fri, 17 Jan 2025 16:48:08 +0000 Subject: [PATCH] Extend build fingerprinting to include CFLAGS. If the value of CFLAGS is changed between builds, the makefile will rebuid, in the same way as for COPTS. --- Makefile | 4 ++-- src/config.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5a9025b..9158050 100644 --- a/Makefile +++ b/Makefile @@ -71,8 +71,8 @@ nft_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_NFTSET $(PKG_CONFIG nft_libs = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_NFTSET $(PKG_CONFIG) --libs libnftables` version = -DVERSION='\"`$(top)/bld/get-version $(top)`\"' -sum?=$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ') -sum!=$(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ' +sum?=$(shell echo $(CC) -DDNSMASQ_COMPILE_FLAGS="$(CFLAGS)" -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ') +sum!=echo $(CC) -DDNSMASQ_COMPILE_FLAGS="$(CFLAGS)" -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ' copts_conf = .copts_$(sum) objs = cache.o rfc1035.o util.o option.o forward.o network.o \ diff --git a/src/config.h b/src/config.h index 5e65df6..6f89b71 100644 --- a/src/config.h +++ b/src/config.h @@ -362,6 +362,11 @@ HAVE_SOCKADDR_SA_LEN #define HAVE_INOTIFY #endif +/* This never compiles code, it's only used by the makefile to fingerprint builds. */ +#ifdef DNSMASQ_COMPILE_FLAGS +static char *compile_flags = DNSMASQ_COMPILE_FLAGS; +#endif + /* Define a string indicating which options are in use. DNSMASQ_COMPILE_OPTS is only defined in dnsmasq.c */