diff options
author | Demi Obenour <demiobenour@gmail.com> | 2017-05-03 10:29:01 -0400 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2017-05-03 13:24:09 -0400 |
commit | 2f21edac99b5efc432417233e6e53326d630e08f (patch) | |
tree | fe5ac80946642004a477f2949a1b5d2ba0d09311 /src/mkskel.sh | |
parent | 259257623937630bb22cabf29f9897270aa62ce0 (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-x | src/mkskel.sh | 22 |
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/.*/ "&",/' |