summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsource4/script/lex_compile.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/script/lex_compile.sh b/source4/script/lex_compile.sh
index f655f81f2d..9bba7257b1 100755
--- a/source4/script/lex_compile.sh
+++ b/source4/script/lex_compile.sh
@@ -35,8 +35,14 @@ if cd $dir && $LEX $ARGS $file; then
if [ -r $base.yy.c ];then
# we must guarantee that config.h comes first
echo "#include \"config.h\"" > $base.c
- sed '/^#/ s|$base.yy\.c|$DEST|' $base.yy.c >> $base.c
+ sed -e "s|$base\.yy\.c|$DEST|" $base.yy.c >> $base.c
rm -f $base.yy.c
+ elif [ -r $base.c ];then
+ # we must guarantee that config.h comes first
+ mv $base.c $base.c.tmp
+ echo "#include \"config.h\"" > $base.c
+ sed -e "s|$base\.yy\.c|$DEST|" $base.c.tmp >> $base.c
+ rm -f $base.c.tmp
elif [ ! -r base.c ]; then
echo "$base.c nor $base.yy.c generated."
exit 1