1
0
Fork 0

adjustment for different build dir

This commit is contained in:
Frank Celler 2012-01-04 15:23:58 +01:00
parent fd52e86702
commit e084c89617
7 changed files with 51 additions and 119 deletions

View File

@ -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

View File

@ -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 $^ > $@
################################################################################

View File

@ -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 <bison> <directory> <file-prefix>"
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 <bison> <output> <input>"
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

View File

@ -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

View File

@ -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 <flex> <directory> <file-prefix>"
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 <flex> <output> <input>"
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

View File

@ -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 <flex> <directory> <file-prefix>"
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 <flex> <output> <input>"
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

View File

@ -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 ";"}'
| awk 'BEGIN {print "static string JS_'$NAME' = " } { print " \"" $0 "\\n\"" } END { print ";"}'