From e084c896173f5b511a9a0c82f8c16cf605ee18ca Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Wed, 4 Jan 2012 15:23:58 +0100 Subject: [PATCH] adjustment for different build dir --- Makefile.am | 63 ++++-------------------------------------- Makefile.files | 5 ++++ config/bison-c++.sh | 38 ++++++++++--------------- config/build_header.sh | 8 +++--- config/flex-c++.sh | 25 +++++++---------- config/flex-c.sh | 29 ++++++++----------- config/js2c.sh | 2 +- 7 files changed, 51 insertions(+), 119 deletions(-) diff --git a/Makefile.am b/Makefile.am index 26c1acd000..3898493308 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,73 +19,22 @@ include Makefile.files ## FLEX ################################################################################ -if ENABLE_FLEX - -@srcdir@/%.c: @srcdir@/%.l - @top_srcdir@/config/flex-c.sh $(LEX) `dirname $@` `basename $^ .l` - -else - -@srcdir@/%.c: @srcdir@/%.l - @echo '+---------------------------------------------------------------+' - @echo '| WARNING: required FLEX version not found, cannot update files |' - @echo '+---------------------------------------------------------------+' - -endif +JsonParser/%.c: @srcdir@/JsonParser/%.l + @top_srcdir@/config/flex-c.sh $(LEX) "$@" "$^" ################################################################################ ## FLEX++ ################################################################################ -if ENABLE_FLEX - -@srcdir@/%.cpp: @srcdir@/%.ll - @top_srcdir@/config/flex-c++.sh $(LEX) `dirname $@` `basename $^ .ll` - -else - -@srcdir@/%.cpp: @srcdir@/%.ll - @echo '+---------------------------------------------------------------+' - @echo '| WARNING: required FLEX version not found, cannot update files |' - @echo '+---------------------------------------------------------------+' - -endif - -################################################################################ -## BISON -################################################################################ - -if ENABLE_BISON - -@srcdir@/%.cpp: @srcdir@/%.yy - @top_srcdir@/config/bison-c.sh $(BISON) `dirname $@` `basename $^ .yy` - -else - -@srcdir@/%.cpp: @srcdir@/%.yy - @echo '+----------------------------------------------------------------+' - @echo '| WARNING: required BISON version not found, cannot update files |' - @echo '+----------------------------------------------------------------+' - -endif +V8/%.cpp: @srcdir@/V8/%.ll + @top_srcdir@/config/flex-c++.sh $(LEX) "$@" "$^" ################################################################################ ## BISON++ ################################################################################ -if ENABLE_BISON - -@srcdir@/%.cpp: @srcdir@/%.yy - @top_srcdir@/config/bison-c++.sh $(BISON) `dirname $@` `basename $^ .yy` - -else - -@srcdir@/%.cpp: @srcdir@/%.yy - @echo '+----------------------------------------------------------------+' - @echo '| WARNING: required BISON version not found, cannot update files |' - @echo '+----------------------------------------------------------------+' - -endif +JsonParserX/%.cpp: @srcdir@/JsonParserX/%.yy + @top_srcdir@/config/bison-c++.sh $(BISON) "$@" "$^" ################################################################################ ## build information diff --git a/Makefile.files b/Makefile.files index 5296c692d1..3fe1a2ba49 100644 --- a/Makefile.files +++ b/Makefile.files @@ -219,18 +219,23 @@ BUILT_SOURCES += \ @builddir@/js/js-modules.h @builddir@/js/js-modules.h: @srcdir@/js/modules.js + @test -d @builddir@/js || mkdir @builddir@/js || true @top_srcdir@/config/js2c.sh $^ > $@ @builddir@/js/js-json.h: @srcdir@/js/json.js + @test -d @builddir@/js || mkdir @builddir@/js || true @top_srcdir@/config/js2c.sh $^ > $@ @builddir@/js/js-graph.h: @srcdir@/js/graph.js + @test -d @builddir@/js || mkdir @builddir@/js || true @top_srcdir@/config/js2c.sh $^ > $@ @builddir@/js/js-shell.h: @srcdir@/js/shell.js + @test -d @builddir@/js || mkdir @builddir@/js || true @top_srcdir@/config/js2c.sh $^ > $@ @builddir@/js/js-actions.h: @srcdir@/js/actions.js + @test -d @builddir@/js || mkdir @builddir@/js || true @top_srcdir@/config/js2c.sh $^ > $@ ################################################################################ diff --git a/config/bison-c++.sh b/config/bison-c++.sh index 1841009064..0f3ed89d6a 100755 --- a/config/bison-c++.sh +++ b/config/bison-c++.sh @@ -1,22 +1,11 @@ #!/bin/sh BISON="$1" -SRC="$2" -DST="$2" -FILE="$3" +OUTPUT="$2" +INPUT="$3" -if test "x$BISON" = x -o "x$SRC" = x -o "x$DST" = x -o "x$FILE" = x; then - echo "usage: $0 " - exit 1 -fi - -if test ! -d "$SRC"; then - echo "$0: expecting '$SRC' to be a directory" - exit 1 -fi - -if test ! -d "$DST"; then - echo "$0: expecting '$DST' to be a directory" +if test "x$BISON" = x -o "x$OUTPUT" = x -o "x$INPUT" = x; then + echo "usage: $0 " exit 1 fi @@ -24,33 +13,34 @@ fi ## bison ############################################################################# -${BISON} -l -d -ra -S lalr1.cc -o "${DST}/${FILE}.cpp" "${SRC}/${FILE}.yy" +${BISON} -l -d -ra -S lalr1.cc -o ${OUTPUT} ${INPUT} ############################################################################# ## sanity checks ############################################################################# -test -f ${SRC}/${FILE}.hpp || exit 1 -test -f ${SRC}/${FILE}.cpp || exit 1 -test -f ${SRC}/position.hh || exit 1 +PREFIX=`echo ${OUTPUT} | sed -e 's:\.cpp$::'` + +test -f ${PREFIX}.hpp || exit 1 +test -f ${PREFIX}.cpp || exit 1 ############################################################################# ## rename file ############################################################################# -mv ${SRC}/${FILE}.hpp ${SRC}/${FILE}.h || exit 1 +mv ${PREFIX}.hpp ${PREFIX}.h || exit 1 ############################################################################# ## fix header file name in source, fix defines ############################################################################# -sed -e 's:\.hpp:.h:' < ${SRC}/${FILE}.cpp \ +sed -e 's:\.hpp:.h:' < ${OUTPUT} \ | sed -e 's:# if YYENABLE_NLS:# if defined(YYENABLE_NLS) \&\& YYENABLE_NLS:' \ - > ${SRC}/${FILE}.cpp.tmp + > ${OUTPUT}.tmp # give some information -diff -u ${SRC}/${FILE}.cpp ${SRC}/${FILE}.cpp.tmp +diff -u ${OUTPUT} ${OUTPUT}.tmp # and move the files to the final destination -mv ${SRC}/${FILE}.cpp.tmp ${SRC}/${FILE}.cpp || exit 1 +mv ${OUTPUT}.tmp ${OUTPUT} || exit 1 diff --git a/config/build_header.sh b/config/build_header.sh index 164a1a0679..556f383089 100755 --- a/config/build_header.sh +++ b/config/build_header.sh @@ -11,11 +11,11 @@ if test -d .svn; then revision=`svnversion` else if test ! -f "$INFO"; then - echo "$0: cannot open info file $INFO" - exit 1 + echo "WARNING: cannot open info file $INFO" + revision="exported" + else + revision=`grep 'Revision:' $INFO | awk '{print $2}'` fi - - revision=`grep 'Revision:' $INFO | awk '{print $2}'` fi if test -z "$revision"; then diff --git a/config/flex-c++.sh b/config/flex-c++.sh index 9f1920607a..4574a27b87 100755 --- a/config/flex-c++.sh +++ b/config/flex-c++.sh @@ -1,16 +1,11 @@ #!/bin/sh FLEX="$1" -DIR="$2" -FILE="$3" +OUTPUT="$2" +INPUT="$3" -if test "x$FLEX" = "x" -o "x$DIR" = "x" -o "x$FILE" = "x" -o ! -d "$DIR"; then - echo "usage: $0 " - exit 1 -fi - -if test ! -d "$DIR"; then - echo "$0: expecting '$DIR' to be a directory" +if test "x$FLEX" = "x" -o "x$OUTPUT" = "x" -o "x$INPUT" = "x"; then + echo "usage: $0 " exit 1 fi @@ -18,24 +13,24 @@ fi ## flex ############################################################################# -${FLEX} -L -o${DIR}/${FILE}.cpp ${DIR}/${FILE}.ll +${FLEX} -L -o${OUTPUT} ${INPUT} ############################################################################# ## sanity checks ############################################################################# -test -f ${DIR}/${FILE}.cpp || exit 1 +test -f ${OUTPUT} || exit 1 ############################################################################# ## fix casts ############################################################################# -cat ${DIR}/${FILE}.cpp \ +cat ${OUTPUT} \ | sed -e 's:(yy_n_chars), (size_t) num_to_read );:(yy_n_chars), (int) num_to_read );:' \ - > ${DIR}/${FILE}.cpp.tmp + > ${OUTPUT}.tmp # give some information -diff -u ${DIR}/${FILE}.cpp ${DIR}/${FILE}.cpp.tmp +diff -u ${OUTPUT} ${OUTPUT}.tmp # and move the files to the final destination -mv ${DIR}/${FILE}.cpp.tmp ${DIR}/${FILE}.cpp || exit 1 +mv ${OUTPUT}.tmp ${OUTPUT} || exit 1 diff --git a/config/flex-c.sh b/config/flex-c.sh index e014159d8f..75aec2240f 100755 --- a/config/flex-c.sh +++ b/config/flex-c.sh @@ -1,16 +1,11 @@ #!/bin/sh FLEX="$1" -DIR="$2" -FILE="$3" +OUTPUT="$2" +INPUT="$3" -if test "x$FLEX" = "x" -o "x$DIR" = "x" -o "x$FILE" = "x" -o ! -d "$DIR"; then - echo "usage: $0 " - exit 1 -fi - -if test ! -d "$DIR"; then - echo "$0: expecting '$DIR' to be a directory" +if test "x$FLEX" = "x" -o "x$OUTPUT" = "x" -o "x$INPUT" = "x"; then + echo "usage: $0 " exit 1 fi @@ -18,27 +13,25 @@ fi ## flex ############################################################################# -${FLEX} -L -o${DIR}/${FILE}.c ${DIR}/${FILE}.l +${FLEX} -L -o${OUTPUT} ${INPUT} ############################################################################# ## sanity checks ############################################################################# -test -f ${DIR}/${FILE}.c || exit 1 +test -f ${OUTPUT} || exit 1 ############################################################################# ## fix casts ############################################################################# -cat ${DIR}/${FILE}.c \ +cat ${OUTPUT} \ | sed -e 's:yy_n_chars, (size_t) num_to_read );:yy_n_chars, (int) num_to_read );:' \ - | sed -e 's:extern int isatty (int );:#ifndef _WIN32\ -\0\ -#endif:' \ - > ${DIR}/${FILE}.c.tmp + | awk '$0 == "extern int isatty (int );" {print "#ifndef _WIN32"; print $0; print "#endif"; next;} {print $0}' \ + > ${OUTPUT}.tmp # give some information -diff -u ${DIR}/${FILE}.c ${DIR}/${FILE}.c.tmp +diff -u ${OUTPUT} ${OUTPUT}.tmp # and move the files to the final destination -mv ${DIR}/${FILE}.c.tmp ${DIR}/${FILE}.c || exit 1 +mv ${OUTPUT}.tmp ${OUTPUT} || exit 1 diff --git a/config/js2c.sh b/config/js2c.sh index b219b89abb..3168fb5e57 100755 --- a/config/js2c.sh +++ b/config/js2c.sh @@ -3,4 +3,4 @@ NAME=`basename $1 .js` cat $1 \ | sed -e 's:\(["\]\):\\\0:g' \ - | awk 'BEGIN {print "static string JS_'$NAME' = " } { print " \"" $$0 "\\n\"" } END { print ";"}' \ No newline at end of file + | awk 'BEGIN {print "static string JS_'$NAME' = " } { print " \"" $0 "\\n\"" } END { print ";"}'