escape $ properly, added 'update' support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@662 a1c6a512-1295-4272-9138-f99709370657
diff --git a/tools/configure b/tools/configure
index 282b625..5f08c65 100755
--- a/tools/configure
+++ b/tools/configure
@@ -9,6 +9,7 @@
#
target=$1
+debug=$2
input() {
read response
@@ -19,6 +20,17 @@
echo "http://bjorn.haxx.se/rockbox/"
echo ""
+if [ "$target" = "update" ]; then
+ target=""
+ if [ -f Makefile ]; then
+ if { grep "^## Auto" Makefile >/dev/null 2>&1 ; } then
+ echo "Existing generated Makefile found. Getting defaults from it."
+ target=`grep "^TARGET=" Makefile | cut -d= -f2-`
+ debug=`grep "^DEBUG=" Makefile | cut -d= -f2-`
+ fi
+ fi
+fi
+
if [ -z "$target" ]; then
##################################################################
@@ -53,23 +65,26 @@
fi
-##################################################################
-# Figure out debug on/off
-#
-echo ""
-echo "Build DEBUG version? (y/N)"
+if [ -z "$debug" ]; then
+ ##################################################################
+ # Figure out debug on/off
+ #
+ echo ""
+ echo "Build DEBUG version? (y/N)"
-option=`input`;
+ option=`input`;
-case $option in
- [Yy])
- debug="DEBUG=1"
- ;;
- *)
- debug=""
- ;;
+ case $option in
+ [Yy])
+ debug="DEBUG=1"
+ ;;
+ *)
+ debug=""
+ ;;
-esac
+ esac
+fi
+
##################################################################
# Figure out where the firmware code is!
@@ -120,6 +135,8 @@
-e "s,@TARGET@,${target},g" \
-e "s,@PWD@,${pwd},g" \
<<EOF
+## Automaticly generated. http://bjorn.haxx.se/rockbox/
+
FIRMDIR=@FIRMDIR@
APPSDIR=@APPSDIR@
DEBUG=@DEBUG@
@@ -127,8 +144,8 @@
THISDIR="@PWD@"
all:
- make -C \$(FIRMDIR) TARGET=\$(TARGET) $(DEBUG) OBJDIR=\$(THISDIR)
- make -C \$(APPSDIR) TARGET=\$(TARGET) $(DEBUG) OBJDIR=\$(THISDIR)
+ make -C \$(FIRMDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR)
+ make -C \$(APPSDIR) TARGET=\$(TARGET) \$(DEBUG) OBJDIR=\$(THISDIR)
EOF