Fallback to compile.sh if single file and Makefile dont' exist

This commit is contained in:
Austen Adler 2015-01-07 20:54:31 -05:00
parent 5d8cdac5f9
commit 84f30510ab
2 changed files with 6 additions and 5 deletions

View File

@ -8,9 +8,9 @@ add-apt-repository -y ppa:byteit101/frc-toolchain
apt-get update apt-get update
apt-get install -y frc-toolchain apt-get install -y frc-toolchain
# Compiles code in the /vagrant/src folder # Compiles code in the /vagrant/src folder
echo "echo 'Starting build';(test -d /vagrant/src/Debug&&test -f /vagrant/src/Debug/makefile&&(cd /vagrant/src/Debug/&&make -f makefile clean;make -f makefile);cd -)||(test -f /vagrant/build/FRCUserProgram&&rm /vagrant/build/FRCUserProgram;arm-frc-linux-gnueabi-g++ -std=c++1y -I/vagrant/wpilib/include '-I/vagrant/src' -O0 -g3 -Wall -c -fmessage-length=0 -o /vagrant/build/Robot.o /vagrant/src/\`cat /vagrant/config/buildfile|head -n 1\`&&arm-frc-linux-gnueabi-g++ -L/vagrant/wpilib/lib -Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a -o /vagrant/build/FRCUserProgram /vagrant/build/Robot.o -lwpi;rm /vagrant/build/Robot.o);echo 'Done'" > /usr/local/bin/build echo "echo 'Starting build';(test -d /vagrant/src/Debug&&test -f /vagrant/src/Debug/makefile&&(cd /vagrant/src/Debug/&&make -f makefile clean;make -f makefile;cd -))||(test -f /vagrant/build/FRCUserProgram&&rm /vagrant/build/FRCUserProgram;test -f \`cat /vagrant/config/buildfile|head -n 1\`&&(arm-frc-linux-gnueabi-g++ -std=c++1y -I/vagrant/wpilib/include '-I/vagrant/src' -O0 -g3 -Wall -c -fmessage-length=0 -o /vagrant/build/Robot.o /vagrant/src/\`cat /vagrant/config/buildfile|head -n 1\`&&arm-frc-linux-gnueabi-g++ -L/vagrant/wpilib/lib -Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a -o /vagrant/build/FRCUserProgram /vagrant/build/Robot.o -lwpi;rm /vagrant/build/Robot.o))||(/home/vagrant/compile.sh);echo 'Done'" > /usr/local/bin/build
# Uploads the code to the rRIO based on /vagrant/config/host file # Uploads the code to the rRIO based on /vagrant/config/host file
echo "cat /vagrant/FRCUserProgram | ssh \`cat /vagrant/config/host|head -n 1\` 'cat > /home/lvuser/FRCUserProgram2&&rm /home/lvuser/FRCUserProgram;mv /home/lvuser/FRCUserProgram2 /home/lvuser/FRCUserProgram&&. /etc/profile.d/natinst-path.sh;chmod a+x /home/lvuser/FRCUserProgram;/usr/local/frc/bin/frcKillRobot.sh -t -r'||echo 'You probably haven\'t succesfully built yet. Run build to compile the program''" > /usr/local/bin/deploy echo "cat /vagrant/build/FRCUserProgram | ssh \`cat /vagrant/config/host|head -n 1\` 'cat > /home/lvuser/FRCUserProgram2&&rm /home/lvuser/FRCUserProgram;mv /home/lvuser/FRCUserProgram2 /home/lvuser/FRCUserProgram&&. /etc/profile.d/natinst-path.sh;chmod a+x /home/lvuser/FRCUserProgram;/usr/local/frc/bin/frcKillRobot.sh -t -r'||echo 'You probably haven\'t succesfully built yet. Run build to compile the program''" > /usr/local/bin/deploy
# Creates ssh key if it doesn't exist and cats the public key to the rRIO # Creates ssh key if it doesn't exist and cats the public key to the rRIO
echo "test -d ~/.ssh||mkdir ~/.ssh;test -f ~/.ssh/id_rsa||ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -q -N '';cat ~/.ssh/id_rsa.pub|ssh \`cat /vagrant/config/host|head -n 1\` 'cat >> ~/.ssh/authorized_keys'" > /usr/local/bin/putkey echo "test -d ~/.ssh||mkdir ~/.ssh;test -f ~/.ssh/id_rsa||ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -q -N '';cat ~/.ssh/id_rsa.pub|ssh \`cat /vagrant/config/host|head -n 1\` 'cat >> ~/.ssh/authorized_keys'" > /usr/local/bin/putkey
chmod +x /usr/local/bin/build /usr/local/bin/deploy /usr/local/bin/putkey chmod +x /usr/local/bin/build /usr/local/bin/deploy /usr/local/bin/putkey

View File

@ -12,11 +12,12 @@ for DIR in $TMP;do
done done
for SRC in $SRCS;do 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 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//')" echo "Compiling $(echo -n $SRC|sed -e 's/.+\/\(.+\)\.cpp//')" to "$SRC.o"
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 #echo 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/$(echo $SRC|cut -b "1 2" --complement)"
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/$(echo $SRC|cut -b "1 2" --complement)"||exit 1
done done
COMPILED=$(find -type f -name \*.cpp.o|sed -e 's/\(.+\)\.cpp\.o$/\1/') COMPILED=$(find -type f -name \*.cpp.o|sed -e 's/\(.+\)\.cpp\.o$/\1/')
#echo $COMPILED #echo $COMPILED
echo Linked echo Linking
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 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 - cd -