[klibc] [klibc:update-dash] dash: Change mktokens back to creating token.h itself

klibc-bot for Ben Hutchings ben at decadent.org.uk
Thu Jan 24 19:15:03 PST 2019


Commit-ID:  4a3b69c08621b4cb3fa9a7d18d8864e0d33fe074
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=4a3b69c08621b4cb3fa9a7d18d8864e0d33fe074
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Fri, 25 Jan 2019 00:18:21 +0000
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000

[klibc] dash: Change mktokens back to creating token.h itself

This effectively reverts commit 984d40b0fc4c "[klibc] Make building
dash O= friendly".  Later upstream versions of mktokens create two
files, so there will be no reasonable way to redirect its output.

The if_changed macro assumes that the rebuild command does not change
the current directory, which is why out-of-tree builds broke here
prior to commit 984d40b0fc4c.  Since we do need to change the current
directory, do it in a subshell which won't affect the following
commands generated by if_changed.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/Kbuild   | 2 +-
 usr/dash/mktokens | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild
index c0f8dcb5..23809a3a 100644
--- a/usr/dash/Kbuild
+++ b/usr/dash/Kbuild
@@ -38,7 +38,7 @@ $(addprefix $(obj)/, $(static/sh-y)): $(addprefix $(obj)/, $(gen-h-files))
 # Generate token.h
 targets += token.h
 quiet_cmd_mktokens = GEN     $@
-      cmd_mktokens = sh $< > $@
+      cmd_mktokens = (cd $(obj) && sh $(srctree)/$(src)/mktokens)
 $(obj)/token.h: $(src)/mktokens
 	$(call if_changed,mktokens)
 
diff --git a/usr/dash/mktokens b/usr/dash/mktokens
index 8fbcef1b..43d76ce1 100644
--- a/usr/dash/mktokens
+++ b/usr/dash/mktokens
@@ -69,7 +69,7 @@ TBEGIN	0	"{"
 TEND	1	"}"
 !
 nl=`wc -l /tmp/ka$$`
-
+exec > token.h
 awk '{print "#define " $1 " " NR-1}' /tmp/ka$$
 echo '
 /* Array indicating which tokens mark the end of a list */


More information about the klibc mailing list