]> granicus.if.org Git - flex/commitdiff
build: Delete comments from skeleton file.
authorDemi Obenour <demiobenour@gmail.com>
Wed, 3 May 2017 14:29:01 +0000 (10:29 -0400)
committerWill Estes <westes575@gmail.com>
Wed, 3 May 2017 17:24:09 +0000 (13:24 -0400)
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.

src/Makefile.am
src/misc.c
src/mkskel.sh

index 7ecbf526bde5ce92b2cfa5e278f491406c18af52..e379692c7d742b26ca3c0a003f6bde3bfbe7e96c 100644 (file)
@@ -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
index cb7dba4cff055687289effacd0a4578dc4a56584..ef27833c3ea71a0da8779b5c5e38e44a61c2180c 100644 (file)
@@ -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"));
                        }
index 512f1f9b4831eade859b176ad2ae1d230c71dbf8..1aa59e1a0e6bd677b1220b6eeeab4cb6f232e5a5 100755 (executable)
 #  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/.*/  "&",/'