From 5d8cdac5f9c72faa96f205c9b54c6a6218350d28 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 7 Jan 2015 02:03:02 +0000 Subject: [PATCH] Added compile.sh to compile and link all .cpp files in src/ --- compile.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 compile.sh diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..52c4fc9 --- /dev/null +++ b/compile.sh @@ -0,0 +1,22 @@ +#!/bin/bash +cd /vagrant/src +INCLUDE=$(find /vagrant/src -type d|sed -e 's/^/-I/'|paste -sd\ ) +TMP=$(find . -type d) +SRCS=$(find -type f -name \*.cpp|sed -e 's/\(.+\)\.cpp$/\1/') +#echo $INCLUDE +#echo $TMP +#echo $SRCS +cd;rm -rf ~/build/;mkdir -p ~/build/;cd ~/build +for DIR in $TMP;do + mkdir -p $DIR +done +for SRC in $SRCS;do + #echo arm-frc-linux-gnueabi-g++ -std=c++1y -I/vagrant/wpilib/include $INCLUDE -O0 -g3 -Wall -c -fmessage-length=0 -o /vagrant/src/"$SRC".o "$SRC" + echo "Compiling $(echo -n $SRC|sed -e 's/.+\/\(.+\)\.cpp//')" + arm-frc-linux-gnueabi-g++ -std=c++1y -I/vagrant/wpilib/include $INCLUDE -O0 -g3 -Wall -c -fmessage-length=0 -o "$SRC.o" "/vagrant/src/$SRC"||exit 1 +done +COMPILED=$(find -type f -name \*.cpp.o|sed -e 's/\(.+\)\.cpp\.o$/\1/') +#echo $COMPILED +echo Linked +arm-frc-linux-gnueabi-g++ -L/vagrant/wpilib/lib -Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a -o /vagrant/build/FRCUserProgram $COMPILED -lwpi +cd -