Skip to contentSkip to conversation

config.mk: Rerun configure when it is newer than config.mk

PATCH In review David Ahern 2 participants 2 messages May 15, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config.mk: Rerun configure when it is newer than config.mk

config.mk needs to be re-generated any time configure is changed. Rename the existing make target and add a check that the config.mk file needs to exist and must be newer than configure script.

---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Makefile +5 -3
index 19bd163e2e04..5bc11477ab7a 100644
@@ -60,7 +60,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
 LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
 LDLIBS += $(LIBNETLINK)
 
-all: config.mk
+all: config
 	@set -e; \
 	for i in $(SUBDIRS); \
 	do echo; echo $$i; $(MAKE) -C $$i; done
@@ -80,8 +80,10 @@ all: config.mk
 	@echo "Make Arguments:"
 	@echo " V=[0|1]             - set build verbosity level"
 
-config.mk:
-	sh configure $(KERNEL_INCLUDE)
+config:
+	@if [ ! -f config.mk -o configure -nt config.mk ]; then \
+		sh configure $(KERNEL_INCLUDE); \
+	fi
 
 install: all
 	install -m 0755 -d $(DESTDIR)$(SBINDIR)
Signature · 1 line
2.27.0
Tested-by on v1 1/1
#1 lore raw

Hi David,

Quoted 6 lines

config.mk needs to be re-generated any time configure is changed. Rename the existing make target and add a check that the config.mk file needs to exist and must be newer than configure script.

Thanks!

Kind regards,
Petr

Quoted 30 lines
---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Makefile +5 -3
index 19bd163e2e04..5bc11477ab7a 100644
@@ -60,7 +60,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
 LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
 LDLIBS += $(LIBNETLINK)
 
-all: config.mk
+all: config
 	@set -e; \
 	for i in $(SUBDIRS); \
 	do echo; echo $$i; $(MAKE) -C $$i; done
@@ -80,8 +80,10 @@ all: config.mk
 	@echo "Make Arguments:"
 	@echo " V=[0|1]             - set build verbosity level"
 
-config.mk:
-	sh configure $(KERNEL_INCLUDE)
+config:
+	@if [ ! -f config.mk -o configure -nt config.mk ]; then \
+		sh configure $(KERNEL_INCLUDE); \
+	fi
 
 install: all
 	install -m 0755 -d $(DESTDIR)$(SBINDIR)