summaryrefslogtreecommitdiff
path: root/src/mkskel.sh
diff options
context:
space:
mode:
authorDemi Obenour <demiobenour@gmail.com>2017-05-03 10:29:01 -0400
committerWill Estes <westes575@gmail.com>2017-05-03 13:24:09 -0400
commit2f21edac99b5efc432417233e6e53326d630e08f (patch)
treefe5ac80946642004a477f2949a1b5d2ba0d09311 /src/mkskel.sh
parent259257623937630bb22cabf29f9897270aa62ce0 (diff)
build: Delete comments from skeleton file.
Since the comments in flex.skl are, by hypothesis, not needed in skel.c, we remove them. THis reduces the size of the resulting executable somewhat.
Diffstat (limited to 'src/mkskel.sh')
-rwxr-xr-xsrc/mkskel.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mkskel.sh b/src/mkskel.sh
index 512f1f9..1aa59e1 100755
--- a/src/mkskel.sh
+++ b/src/mkskel.sh
@@ -21,13 +21,31 @@
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE.
+if test ! $# = 3; then
+ echo 'Usage: mkskel.sh srcdir m4 version' >&2
+ exit 1
+fi
echo '/* File created from flex.skl via mkskel.sh */
#include "flexdef.h"
const char *skel[] = {'
-
-sed 's/m4_/m4preproc_/g
+srcdir=$1
+m4=$2
+VERSION=$3
+case $VERSION in
+ *[!0-9.]*) echo 'Invalid version number' >&2; exit 1;;
+esac
+IFS=.
+set $VERSION
+sed 's/4_/a4_/g
+s/m4preproc_/m4_/g
+' "$srcdir/flex.skl" |
+"$m4" -P -I "$srcdir" "-DFLEX_MAJOR_VERSION=$1" \
+ "-DFLEX_MINOR_VERSION=$2" \
+ "-DFLEX_SUBMINOR_VERSION=$3" |
+sed '/^%#/d
+s/m4_/m4preproc_/g
s/a4_/4_/g
s/[\\"]/\\&/g
s/.*/ "&",/'