changeset 370:137a87b745d2 prerelease

Now possible to pass options to the Makefile from build_project.sh
author Giulio Moro <giuliomoro@yahoo.it>
date Thu, 09 Jun 2016 17:28:01 +0100
parents 75689b7cd57b
children 361d0c2335cf
files scripts/build_project.sh
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/build_project.sh	Thu Jun 09 02:48:58 2016 +0100
+++ b/scripts/build_project.sh	Thu Jun 09 17:28:01 2016 +0100
@@ -34,12 +34,15 @@
     within a screen session that can be detached later. The -f argument runs
     the project in the foreground of the current terminal, without screen, so
     the output can be piped to another destination. The -b argument runs it
-    in a screen in the background, so no output is shown."
+    in a screen in the background, so no output is shown. The -m argument allows
+    to pass arguments to the Makefile before the run target. For instance,
+    pass -m \`"projectclean"\` or \`-m "distclean"\` to clean project-specific pre-built
+    objects, or all the pre-built objects, respectively."
 }
 
 OPTIND=1
 
-while getopts "bc:nfFhp:" opt; do
+while getopts "bc:m:nfFhp:" opt; do
     case $opt in
         c)            COMMAND_ARGS=$OPTARG
                       ;;
@@ -51,6 +54,8 @@
                       ;;
 	p)            BBB_PROJECT_NAME=$OPTARG
 		      ;;	
+	m)            BBB_MAKEFILE_OPTIONS=$OPTARG
+	              ;;
         h|\?)         usage
                       exit 1
     esac
@@ -111,7 +116,9 @@
     # -c evaluates changes using md5 checksum instead of file date, so we don't care about time skews 
     # --no-t makes sure file timestamps are not preserved, so that the Makefile will not think that targets are up to date when replacing files on the BBB
     #  with older files from the host. This will solve 99% of the issues with Makefile thinking a target is up to date when it is not.
-    rsync -avc --no-t --delete-after --exclude=build $HOST_SOURCE_PATH"/" "$BBB_NETWORK_TARGET_FOLDER/" #trailing slashes used here make sure rsync does not create another folder inside the target folder
+
+   echo rsync -avc --no-t --delete-after --exclude=$BBB_PROJECT_NAME --exclude=build $HOST_SOURCE_PATH"/" "$BBB_NETWORK_TARGET_FOLDER/" #trailing slashes used here make sure rsync does not create another folder inside the target folder
+    rsync -avc --no-t --delete-after --exclude=$BBB_PROJECT_NAME --exclude=build $HOST_SOURCE_PATH"/" "$BBB_NETWORK_TARGET_FOLDER/" #trailing slashes used here make sure rsync does not create another folder inside the target folder
 fi;
 
 if [ $? -ne 0 ]
@@ -121,7 +128,7 @@
 fi
 
 # Make new BeagleRT executable and run
-MAKE_COMMAND="make -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'"
+MAKE_COMMAND="make -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS' $BBB_MAKEFILE_OPTIONS"
 if [ $RUN_PROJECT -eq 0 ]
 then
     echo "Building project..."