summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Wiederhake <twied@gmx.net>2024-03-03 12:55:11 +0100
committerThomas E. Dickey <dickey@his.com>2024-03-07 00:42:09 +0000
commit9b9c0087c906193e5ac549f8203713fd4eedbf2a (patch)
treeb188d8061d3686ac83ddab846f59f4565902e5ec
parent73c4cf88f3bf4094fd12cffec0147b957ad1e9c6 (diff)
Simplify default twmrc generation
The logic to generate deftwmrc.c is currently split between Makefile.am and deftwmrc.sed. Consolidate into a single script. Signed-off-by: Tim Wiederhake <twied@gmx.net>
-rw-r--r--src/Makefile.am12
-rw-r--r--src/deftwmrc.sed4
-rwxr-xr-xsrc/gen_deftwmrc.sh17
3 files changed, 19 insertions, 14 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index c0e7994..5da94ea 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -74,14 +74,6 @@ twm_SOURCES = \
BUILT_SOURCES = gram.h deftwmrc.c
deftwmrc.c: system.twmrc
- $(AM_V_at)rm -f $@ ; \
- echo '/* ' >>$@ ; \
- echo ' * This file is generated automatically from the default' >>$@ ; \
- echo ' * twm bindings file system.twmrc by the twm Makefile.' >>$@ ; \
- echo ' */' >>$@ ; \
- echo '' >>$@ ; \
- echo 'const unsigned char *defTwmrc[] = {' >>$@ ; \
- $(SED) -f ${srcdir}/deftwmrc.sed < ${srcdir}/system.twmrc >>$@ ; \
- echo ' (const unsigned char *) 0 };' >>$@
+ $(srcdir)/gen_deftwmrc.sh $@ $<
-EXTRA_DIST = deftwmrc.sed siconify.bm
+EXTRA_DIST = siconify.bm
diff --git a/src/deftwmrc.sed b/src/deftwmrc.sed
deleted file mode 100644
index 30f8c27..0000000
--- a/src/deftwmrc.sed
+++ /dev/null
@@ -1,4 +0,0 @@
-/^#/d
-s/"/\\"/g
-s/^/ (const unsigned char *) "/
-s/$/",/
diff --git a/src/gen_deftwmrc.sh b/src/gen_deftwmrc.sh
new file mode 100755
index 0000000..ec7188c
--- /dev/null
+++ b/src/gen_deftwmrc.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+rm -f ${1}
+echo '/* ' >>${1}
+echo ' * This file is generated automatically from the default' >>${1}
+echo ' * twm bindings file system.twmrc by the twm Makefile.' >>${1}
+echo ' */' >>${1}
+echo '' >>${1}
+echo 'const unsigned char *defTwmrc[] = {' >>${1}
+sed \
+ -e '/^#/d' \
+ -e 's/"/\\"/g' \
+ -e 's/^/ (const unsigned char *) "/' \
+ -e 's/$/",/' \
+ <${2} \
+ >>${1}
+echo ' (const unsigned char *) 0 };' >>${1}