Skip to contentSkip to conversation

Makefile: make $(BUILD_DIR)/.root rule idempotent

PATCH New Thomas Petazzoni 2 participants 2 messages Sep 15, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makefile: make $(BUILD_DIR)/.root rule idempotent

The $(BUILD_DIR)/.root rule is executed as part of the 'dirs' target. The 'dirs' target is re-executed at every execution of 'make external-deps', and make external-deps explicitly tells make to ignore targets that have already been made (through the -B option). This means that the $(BUILD_DIR)/.root rule has to be idempotant, which was not the case this the introduction of the lib32/lib64 symbolic link.

Running 'make external-deps' three times in a row was sufficient to trigger an error due to symbolic links being incorrectly created. This patch fixes that.

---
This should probably be taken for 2013.08.1 as a fix of 'make external-deps'.

Changes since v1:

* Posted separately from the toolchain source patch set
* Use ln -snf instead of if tests.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 8610592..2163e95 100644
@@ -448,9 +448,9 @@ $(BUILD_DIR)/.root:
 		--exclude .hg --exclude=CVS --exclude '*~' \
 		$(TARGET_SKELETON)/ $(TARGET_DIR)/
 	cp support/misc/target-dir-warning.txt $(TARGET_DIR_WARNING_FILE)
-	@ln -s lib $(TARGET_DIR)/$(LIB_SYMLINK)
+	@ln -snf lib $(TARGET_DIR)/$(LIB_SYMLINK)
 	@mkdir -p $(TARGET_DIR)/usr
-	@ln -s lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
+	@ln -snf lib $(TARGET_DIR)/usr/$(LIB_SYMLINK)
 	touch $@
 
 $(TARGET_DIR): $(BUILD_DIR)/.root
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH v2 1/1 Makefile: make $(BUILD_DIR)/.root rule idempotent

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> The $(BUILD_DIR)/.root rule is executed as part of the 'dirs' Thomas> target. The 'dirs' target is re-executed at every execution of 'make Thomas> external-deps', and make external-deps explicitly tells make to ignore Thomas> targets that have already been made (through the -B option). This Thomas> means that the $(BUILD_DIR)/.root rule has to be idempotant, which was Thomas> not the case this the introduction of the lib32/lib64 symbolic link.

Thomas> Running 'make external-deps' three times in a row was sufficient to Thomas> trigger an error due to symbolic links being incorrectly created. This Thomas> patch fixes that.

Thomas> Signed-off-by: Thomas Petazzoni <[email protected]> Thomas> ---
Thomas> This should probably be taken for 2013.08.1 as a fix of 'make Thomas> external-deps'.

Thomas> Changes since v1:

Thomas> * Posted separately from the toolchain source patch set Thomas> * Use ln -snf instead of if tests.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard