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

klibc-bot for Ben Hutchings ben at decadent.org.uk
Sat Mar 28 14:48:05 PDT 2020


Commit-ID:  dd7eb2c9e0faf742a9a2ce45629514c151348915
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=dd7eb2c9e0faf742a9a2ce45629514c151348915
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: Sat, 28 Mar 2020 20:30:01 +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/README.dash | 1 -
 usr/dash/mktokens    | 2 +-
 3 files changed, 2 insertions(+), 3 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/README.dash b/usr/dash/README.dash
index e33335a5..f45d28be 100644
--- a/usr/dash/README.dash
+++ b/usr/dash/README.dash
@@ -14,7 +14,6 @@ Several changes have been made for klibc:
 * The signal_names[] array is replaced by a signal_name() function using
   klibc's own signal name array.  decode_signal() is changed similarly.
 * The read built-in implements the -t option like bash
-* mktokens is modified to support out-of-tree builds
 * Some header files have header guards added
 * Changelog and some manual pages are omitted
 * Automatic whitespace fixups
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