summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/Makefile.am7
-rw-r--r--src/misc.c3
-rwxr-xr-xsrc/mkskel.sh22
3 files changed, 21 insertions, 11 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ecbf52..e379692 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -92,12 +92,7 @@ CLEANFILES = stage1scan.c stage1flex$(EXEEXT)
MAINTAINERCLEANFILES = skel.c
skel.c: flex.skl mkskel.sh flexint.h tables_shared.h tables_shared.c
- sed 's/4_/a4_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | \
- $(m4) -P -I $(srcdir) \
- -DFLEX_MAJOR_VERSION=` echo $(VERSION)|cut -f 1 -d .` \
- -DFLEX_MINOR_VERSION=` echo $(VERSION)|cut -f 2 -d .` \
- -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | \
- $(SHELL) $(srcdir)/mkskel.sh > $@.tmp
+ $(SHELL) $(srcdir)/mkskel.sh $(srcdir) $(m4) $(VERSION) > $@.tmp
mv $@.tmp $@
if ENABLE_BOOTSTRAP
diff --git a/src/misc.c b/src/misc.c
index cb7dba4..ef27833 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -791,9 +791,6 @@ void skelout (void)
/* %e end linkage-only code. */
OUT_END_CODE ();
}
- else if (buf[1] == '#') {
- /* %# a comment in the skel. ignore. */
- }
else {
flexfatal (_("bad line in skeleton file"));
}
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/.*/ "&",/'