aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-01-25 00:18:21 +0000
committerBen Hutchings <ben@decadent.org.uk>2020-03-28 20:30:01 +0000
commitdd7eb2c9e0faf742a9a2ce45629514c151348915 (patch)
treed0c32b33b205f4405227700c4422a89967208c0d
parent67295677e7f4b89f55c484b44735728ea610edf4 (diff)
downloadklibc-dd7eb2c9e0faf742a9a2ce45629514c151348915.tar.gz
[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@decadent.org.uk>
-rw-r--r--usr/dash/Kbuild2
-rw-r--r--usr/dash/README.dash1
-rw-r--r--usr/dash/mktokens2
3 files changed, 2 insertions, 3 deletions
diff --git a/usr/dash/Kbuild b/usr/dash/Kbuild
index c0f8dcb5d26fb..23809a3af6b9d 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 e33335a5a7211..f45d28bef62d5 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 8fbcef1bba0c1..43d76ce13dc9d 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 */