Skip to contentSkip to conversation

mk: allow renaming of build directories

PATCH Superseded Bruce Richardson 2 participants 4 messages Feb 28, 2018 – Nov 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mk: allow renaming of build directories

When building using make, the Makefile in the build directory contained the name of the build directory to be passed as an "O=" parameter to the DPDK SDK makefiles. Unfortunately, this meant that the compilation would always fail if the build directory was renamed. To remove this limitation, we can use $(CURDIR) instead of the directory name.

---
 buildtools/gen-build-mk.sh | 4 ++--
 mk/rte.sdkconfig.mk        | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)
buildtools/gen-build-mk.sh +2 -2
index c18b205e3..a61c4d6cf 100755
@@ -18,7 +18,7 @@ echo
 echo "MAKEFLAGS += --no-print-directory"
 echo
 echo "all:"
-echo "	@\$(MAKE) -C $1 O=$2"
+echo "	@\$(MAKE) -C $1 O=\$(CURDIR)"
 echo
 echo "%::"
-echo "	@\$(MAKE) -C $1 O=$2 \$@"
+echo "	@\$(MAKE) -C $1 O=\$(CURDIR) \$@"
mk/rte.sdkconfig.mk +1 -2
index 0664725ee..ade681ffd 100644
@@ -105,8 +105,7 @@ SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \
 OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \
 				$(abspath $(RTE_SRCDIR)))
 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
-	$(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
-		> $(RTE_OUTPUT)/Makefile
+	$(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) > $@
 
 # clean installed files, and generate a new config header file
 # if NODOTCONF variable is defined, don't try to rebuild .config
Signature · 1 line
2.14.3
#1 lore raw

28/02/2018 18:11, Bruce Richardson:

Quoted 18 lines

When building using make, the Makefile in the build directory contained the name of the build directory to be passed as an "O=" parameter to the DPDK SDK makefiles. Unfortunately, this meant that the compilation would always fail if the build directory was renamed. To remove this limitation, we can use $(CURDIR) instead of the directory name.

---

buildtools/gen-build-mk.sh +2 -2
-echo "	@\$(MAKE) -C $1 O=$2"
+echo "	@\$(MAKE) -C $1 O=\$(CURDIR)"
 echo
 echo "%::"
-echo "	@\$(MAKE) -C $1 O=$2 \$@"
+echo "	@\$(MAKE) -C $1 O=\$(CURDIR) \$@"

mk/rte.sdkconfig.mk SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \ · line 108

Quoted 3 lines
mk/rte.sdkconfig.mk +1 -2
-	$(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
-		> $(RTE_OUTPUT)/Makefile
+	$(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) > $@

You need to remove the comment about the 2nd argument of the script:
# $2: path of build dir (can be relative to $1)

#2 lore raw

PATCH v2 1/1 mk: allow renaming of build directories

In reply to Bruce Richardson

When building using make, the Makefile in the build directory contained the name of the build directory to be passed as an "O=" parameter to the DPDK SDK makefiles. Unfortunately, this meant that the compilation would always fail if the build directory was renamed. To remove this limitation, we can use $(CURDIR) instead of the directory name.

---
v2: remove comment at the top of the script about the now-deleted
second parameter.

---
 buildtools/gen-build-mk.sh | 5 ++---
 mk/rte.sdkconfig.mk        | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)
buildtools/gen-build-mk.sh +2 -3
index c18b205e3..636920b63 100755
@@ -5,7 +5,6 @@
 # Auto-generate a Makefile in build directory
 # Args:
 #   $1: path of project src root
-#   $2: path of build dir (can be relative to $1)
 
 echo "# Automatically generated by gen-build-mk.sh"
 echo
@@ -18,7 +17,7 @@ echo
 echo "MAKEFLAGS += --no-print-directory"
 echo
 echo "all:"
-echo "	@\$(MAKE) -C $1 O=$2"
+echo "	@\$(MAKE) -C $1 O=\$(CURDIR)"
 echo
 echo "%::"
-echo "	@\$(MAKE) -C $1 O=$2 \$@"
+echo "	@\$(MAKE) -C $1 O=\$(CURDIR) \$@"
mk/rte.sdkconfig.mk +1 -2
index d90d62cc6..fa77331cb 100644
@@ -114,8 +114,7 @@ SDK_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_SRCDIR)) \
 OUTPUT_RELPATH=$(shell $(RTE_SDK)/buildtools/relpath.sh $(abspath $(RTE_OUTPUT)) \
 				$(abspath $(RTE_SRCDIR)))
 $(RTE_OUTPUT)/Makefile: | $(RTE_OUTPUT)
-	$(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) $(OUTPUT_RELPATH) \
-		> $(RTE_OUTPUT)/Makefile
+	$(Q)$(RTE_SDK)/buildtools/gen-build-mk.sh $(SDK_RELPATH) > $@
 
 # clean installed files, and generate a new config header file
 # if NODOTCONF variable is defined, don't try to rebuild .config
Signature · 1 line
2.19.1
#3 lore raw

12/11/2018 13:26, Bruce Richardson:

Quoted 7 lines

When building using make, the Makefile in the build directory contained the name of the build directory to be passed as an "O=" parameter to the DPDK SDK makefiles. Unfortunately, this meant that the compilation would always fail if the build directory was renamed. To remove this limitation, we can use $(CURDIR) instead of the directory name.

Applied, thanks