[v3,02/19] Allow make-link-multidir to make subdirectories

Message ID 20171227060534.3998-3-palmer@dabbelt.com
State New, archived
Headers

Commit Message

Palmer Dabbelt Dec. 27, 2017, 6:05 a.m. UTC
  The RISC-V Linux ABI doesn't define any libraries that go directly in
lib, instead they go into lib/ilp32 or lib/lp64.  This casuse
make-link-multidir to fail when attempting to make library directories
when building a static libc on multilib RISC-V systems.

This patch adds '-p' to mkdir so it will make subdirectories.  I've
added "." as an argument so mkdir won't error out if no directories are
provided -- I think "mkdir -p ." should always do nothing.
---
 Makerules | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Joseph Myers Jan. 1, 2018, 1:59 a.m. UTC | #1
On Tue, 26 Dec 2017, Palmer Dabbelt wrote:

> The RISC-V Linux ABI doesn't define any libraries that go directly in
> lib, instead they go into lib/ilp32 or lib/lp64.  This casuse
> make-link-multidir to fail when attempting to make library directories
> when building a static libc on multilib RISC-V systems.
> 
> This patch adds '-p' to mkdir so it will make subdirectories.  I've
> added "." as an argument so mkdir won't error out if no directories are
> provided -- I think "mkdir -p ." should always do nothing.

OK, please commit, with an appropriate ChangeLog entry.
  
Andreas Schwab Jan. 1, 2018, 9:35 a.m. UTC | #2
On Dez 26 2017, Palmer Dabbelt <palmer@dabbelt.com> wrote:

> This patch adds '-p' to mkdir so it will make subdirectories.  I've
> added "." as an argument so mkdir won't error out if no directories are
> provided -- I think "mkdir -p ." should always do nothing.

You can use $(addprefix) like make-target-directory.

Andreas.
  

Patch

diff --git a/Makerules b/Makerules
index 522de25cfddb..ec0f93e0b493 100644
--- a/Makerules
+++ b/Makerules
@@ -1081,6 +1081,7 @@  mv -f $@.new $@
 endef
 define make-link-multidir
 $(patsubst %/,cd %,$(objpfx)); \
+  mkdir -p -- . $(dir $(multidir)); \
   $(LN_S) . $(multidir) 2> /dev/null; \
   test -L $(multidir)
 endef