summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am.inc10
-rw-r--r--cmake/modules/FindLEX.cmake4
-rw-r--r--tools/Makefile.am1
-rwxr-xr-xtools/runlex.sh166
4 files changed, 5 insertions, 176 deletions
diff --git a/Makefile.am.inc b/Makefile.am.inc
index 87ee199dd6..0b843619a3 100644
--- a/Makefile.am.inc
+++ b/Makefile.am.inc
@@ -27,8 +27,6 @@ LEMON = $(lemon_builddir)/lemon$(EXEEXT)
$(LEMON):
cd $(lemon_builddir) && $(MAKE)
-RUNLEX = $(top_srcdir)/tools/runlex.sh
-
INCLUDEDIRS = -I$(top_srcdir)
#AM_CPPFLAGS = $(INCLUDEDIRS) $(WS_CPPFLAGS)
@@ -55,9 +53,9 @@ AM_V_LEMON = $(am__v_LEMON_@AM_V@)
am__v_LEMON_ = $(am__v_LEMON_@AM_DEFAULT_V@)
am__v_LEMON_0 = @echo " LEMON " $@;
-AM_V_RUNLEX = $(am__v_RUNLEX_@AM_V@)
-am__v_RUNLEX_ = $(am__v_RUNLEX_@AM_DEFAULT_V@)
-am__v_RUNLEX_0 = @echo " RUNLEX " $@;
+AM_V_LEX = $(am__v_LEX_@AM_V@)
+am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@)
+am__v_LEX_0 = @echo " LEX " $@;
AM_V_SED = $(am__v_SED_@AM_V@)
am__v_SED_ = $(am__v_SED_@AM_DEFAULT_V@)
@@ -77,7 +75,7 @@ am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@)
am__v_YACC_0 = @echo " YACC " $@;
.l.c:
- $(AM_V_RUNLEX)$(RUNLEX) "$(LEX)" -o$@ $<
+ $(AM_V_LEX)$(LEX) -o$@ --header-file=$(@:.c=_lex.h) $<
# abi-compliance-checker descriptor
abi_incdirs = $(subst -I,NEWLINE,$(filter -I%,$(AM_CPPFLAGS) -I$(abs_top_srcdir) -I$(abs_srcdir)))
diff --git a/cmake/modules/FindLEX.cmake b/cmake/modules/FindLEX.cmake
index 28fc6678fb..3ec7db30c5 100644
--- a/cmake/modules/FindLEX.cmake
+++ b/cmake/modules/FindLEX.cmake
@@ -36,9 +36,7 @@ MACRO(ADD_LEX_FILES _source _generated)
ADD_CUSTOM_COMMAND(
OUTPUT ${_outc} ${_outh}
- COMMAND ${SH_EXECUTABLE} ${SH_FLAGS1} ${SH_FLAGS2} ${CMAKE_SOURCE_DIR}/tools/runlex.sh ${LEX_EXECUTABLE}
- -o${_outc}
- ${_in}
+ COMMAND ${LEX_EXECUTABLE} -o${_outc} --header-file=${_outh} ${_in}
DEPENDS ${_in}
)
LIST(APPEND ${_source} ${_in})
diff --git a/tools/Makefile.am b/tools/Makefile.am
index decfc97d30..3b2291a5b9 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -84,7 +84,6 @@ EXTRA_DIST = \
rdps.py \
rpm_setup.sh \
runa2x.sh \
- runlex.sh \
setuid-root.pl.in \
test-common.sh \
test-captures.sh \
diff --git a/tools/runlex.sh b/tools/runlex.sh
deleted file mode 100755
index cc77d31543..0000000000
--- a/tools/runlex.sh
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/bin/sh
-
-#
-# runlex.sh
-# Script to run Flex.
-# First argument is the (quoted) name of the command; if it's null, that
-# means that Flex wasn't found, so we report an error and quit.
-#
-# Wireshark - Network traffic analyzer
-# By Gerald Combs <gerald@wireshark.org>
-# Copyright 2007 Gerald Combs
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-#
-# Get the name of the command to run, and then shift to get the arguments.
-#
-if [ $# -lt 1 ]
-then
- echo "Usage: runlex <Flex command to run> [ arguments ]" 1>&2
- exit 1
-fi
-
-case "$OS" in
-
-Windows*)
- PATH=$PATH:/bin
- LEX=`cygpath --unix $1`
- echo "$1 -> $LEX"
- ;;
-
-*)
- LEX="$1"
- ;;
-esac
-
-shift
-#
-# Check whether we have Flex.
-#
-if [ -z "${LEX}" ]
-then
- echo "Flex was not found" 1>&2
- exit 1
-fi
-
-#
-# Process the flags. We don't use getopt because we don't want to
-# embed complete knowledge of what options are supported by Flex.
-#
-flags=""
-outfile=lex.yy.c
-while [ $# -ne 0 ]
-do
- case "$1" in
-
- -o*)
- #
- # Set the output file name.
- #
- # remove the -o prefix using POSIX sh parameter expansion
- outfile="${1#-o}"
- ;;
-
- -*)
- #
- # Add this to the list of flags.
- #
- flags="$flags $1"
- ;;
-
- --|*)
- #
- # End of flags.
- #
- break
- ;;
- esac
- shift
-done
-
-#
-# We make Flex generate a header file declaring the relevant functions
-# defined by the .c file, using the --header-file= flag; if the .c file
-# is .../foo.c, the header file will be .../foo_lex.h.
-#
-#echo "Getting header file name"
-header_file="${outfile%.c}_lex.h"
-
-#
-# OK, run Flex.
-#
-#echo "Running ${LEX} -o\"$outfile\" --header-file=\"$header_file\" $flags \"$@\""
-${LEX} -o"$outfile" --header-file="$header_file" $flags "$@"
-
-#
-# Did it succeed?
-#
-exitstatus=$?
-if [ $exitstatus -ne 0 ]
-then
- #
- # No. Exit with the failing exit status.
- #
- echo "${LEX} failed: exit status $exitstatus"
- exit $exitstatus
-fi
-
-#
-# Flex has the annoying habit of stripping all but the last component of
-# the "-o" flag argument and using that as the place to put the output.
-# This gets in the way of building in a directory different from the
-# source directory. Try to work around this.
-#
-# XXX - where is this an issue?
-#
-#
-# Is the outfile where we think it is?
-#
-outfile_base=`basename "$outfile"`
-if [ "$outfile_base" != "$outfile" -a \( ! -r "$outfile" \) -a -r "$outfile_base" ]
-then
- #
- # No, it's not, but it is in the current directory. Put it
- # where it's supposed to be.
- #
-echo "Moving $outfile_base to $outfile"
- mv "$outfile_base" "$outfile"
- if [ $? -ne 0 ]
- then
- echo $?
- fi
-fi
-
-#
-# Is the header file where we think it is?
-#
-header_file_base=`basename "$header_file"`
-if [ "$header_file_base" != "$header_file" -a \( ! -r "$header_file" \) -a -r "$header_file_base" ]
-then
- #
- # No, it's not, but it is in the current directory. Put it
- # where it's supposed to be.
- #
-echo "Moving $header_file_base to $header_file"
- mv "$header_file_base" "$header_file"
- if [ $? -ne 0 ]
- then
- echo $?
- fi
-fi
-
-echo "Wrote $outfile and $header_file"