comparison scripts/build_project.sh @ 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 a430a16d2c02
comparison
equal deleted inserted replaced
369:75689b7cd57b 370:137a87b745d2
32 32
33 By default, the project runs in the foreground of the current terminal, 33 By default, the project runs in the foreground of the current terminal,
34 within a screen session that can be detached later. The -f argument runs 34 within a screen session that can be detached later. The -f argument runs
35 the project in the foreground of the current terminal, without screen, so 35 the project in the foreground of the current terminal, without screen, so
36 the output can be piped to another destination. The -b argument runs it 36 the output can be piped to another destination. The -b argument runs it
37 in a screen in the background, so no output is shown." 37 in a screen in the background, so no output is shown. The -m argument allows
38 to pass arguments to the Makefile before the run target. For instance,
39 pass -m \`"projectclean"\` or \`-m "distclean"\` to clean project-specific pre-built
40 objects, or all the pre-built objects, respectively."
38 } 41 }
39 42
40 OPTIND=1 43 OPTIND=1
41 44
42 while getopts "bc:nfFhp:" opt; do 45 while getopts "bc:m:nfFhp:" opt; do
43 case $opt in 46 case $opt in
44 c) COMMAND_ARGS=$OPTARG 47 c) COMMAND_ARGS=$OPTARG
45 ;; 48 ;;
46 b) RUN_IN_FOREGROUND=0 49 b) RUN_IN_FOREGROUND=0
47 ;; 50 ;;
49 ;; 52 ;;
50 n) RUN_PROJECT=0 53 n) RUN_PROJECT=0
51 ;; 54 ;;
52 p) BBB_PROJECT_NAME=$OPTARG 55 p) BBB_PROJECT_NAME=$OPTARG
53 ;; 56 ;;
57 m) BBB_MAKEFILE_OPTIONS=$OPTARG
58 ;;
54 h|\?) usage 59 h|\?) usage
55 exit 1 60 exit 1
56 esac 61 esac
57 done 62 done
58 63
109 #rsync 114 #rsync
110 # --delete makes sure it removes files that are not in the origin folder 115 # --delete makes sure it removes files that are not in the origin folder
111 # -c evaluates changes using md5 checksum instead of file date, so we don't care about time skews 116 # -c evaluates changes using md5 checksum instead of file date, so we don't care about time skews
112 # --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 117 # --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
113 # 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. 118 # 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.
114 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 119
120 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
121 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
115 fi; 122 fi;
116 123
117 if [ $? -ne 0 ] 124 if [ $? -ne 0 ]
118 then 125 then
119 echo "Error while copying files" 126 echo "Error while copying files"
120 exit 127 exit
121 fi 128 fi
122 129
123 # Make new BeagleRT executable and run 130 # Make new BeagleRT executable and run
124 MAKE_COMMAND="make -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS'" 131 MAKE_COMMAND="make -C $BBB_BELA_HOME PROJECT='$BBB_PROJECT_NAME' CL='$COMMAND_ARGS' $BBB_MAKEFILE_OPTIONS"
125 if [ $RUN_PROJECT -eq 0 ] 132 if [ $RUN_PROJECT -eq 0 ]
126 then 133 then
127 echo "Building project..." 134 echo "Building project..."
128 ssh $BBB_ADDRESS "$MAKE_COMMAND" 135 ssh $BBB_ADDRESS "$MAKE_COMMAND"
129 else 136 else