97 lines
2.9 KiB
Bash
Executable File
97 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# build source code and run
|
|
|
|
RelSrcName=${1##[^ ]*/}
|
|
|
|
# C++ make and run
|
|
if [ "`expr match "$1" ".*\(.[Cc][Pp][Pp]$\)"`" != "" ]; then
|
|
RelProgName=${RelSrcName%.[Cc][Pp][Pp]}
|
|
if [ "`echo $1| grep /`" != "" ]; then
|
|
DirName=${1%/*.[Cc][Pp][Pp]}
|
|
cd "$DirName"
|
|
fi
|
|
rm -f "$RelProgName"
|
|
g++ "$RelSrcName" -o "$RelProgName" -lglut
|
|
echo ---------------- C++ -------------------------
|
|
"./$RelProgName"
|
|
echo ----------------------------------------------
|
|
rm -f "$RelProgName"
|
|
|
|
# C make and run
|
|
elif [ "`expr match "$1" ".*\(.[Cc]$\)"`" != "" ]; then
|
|
RelProgName=${RelSrcName%.[Cc]}
|
|
if [ "`echo $1| grep /`" != "" ]; then
|
|
DirName=${1%/*.[Cc]}
|
|
cd "$DirName"
|
|
fi
|
|
rm -f "$RelProgName"
|
|
gcc "$RelSrcName" -o "$RelProgName" -lglut
|
|
echo ------------------ C -------------------------
|
|
"./$RelProgName"
|
|
echo ----------------------------------------------
|
|
rm -f "$RelProgName"
|
|
|
|
# Java make and run
|
|
elif [ "`expr match "$1" ".*\(.[Jj][Aa][Vv][Aa]$\)"`" != "" ]; then
|
|
RelProgName=${RelSrcName%.[Jj][Aa][Vv][Aa]}
|
|
if [ "`echo $1| grep /`" != "" ]; then
|
|
DirName=${1%/*.[Jj][Aa][Vv][Aa]}
|
|
cd "$DirName"
|
|
fi
|
|
rm -f "$RelProgName"
|
|
javac "$RelSrcName" >/dev/null
|
|
echo ---------------- Java ------------------------
|
|
java "$RelProgName"
|
|
echo ----------------------------------------------
|
|
rm -f "$RelProgName"
|
|
|
|
# Free Pascal make and run
|
|
elif [ "`expr match "$1" ".*\(.[Pp][Aa][Ss]$\)"`" != "" ]; then
|
|
RelProgName=${RelSrcName%.[Pp][Aa][Ss]}
|
|
if [ "`echo $1| grep /`" != "" ]; then
|
|
DirName=${1%/*.[Pp][Aa][Ss]}
|
|
cd "$DirName"
|
|
fi
|
|
rm -f "$RelProgName"
|
|
fpc "$RelSrcName"
|
|
echo ------------ Free Pascal ---------------------
|
|
"./$RelProgName"
|
|
echo ----------------------------------------------
|
|
rm -f "$RelProgName.o"
|
|
rm -f "$RelProgName"
|
|
|
|
# Python
|
|
elif [ "`expr match "$1" ".*\(.[Pp][Yy]$\)"`" != "" ];
|
|
then
|
|
echo --------------- Python -----------------------
|
|
/usr/bin/python "$1"
|
|
echo ----------------------------------------------
|
|
|
|
# Perl
|
|
elif [ "`expr match "$1" '.*\(.[Pp][Ll]$\)'`" != "" ];
|
|
then
|
|
echo ---------------- Perl ------------------------
|
|
/usr/bin/perl "$1"
|
|
echo ----------------------------------------------
|
|
|
|
# Simple Bash script
|
|
elif [ "`expr match "$1" '.*\(.sh$\)'`" != "" ];
|
|
then
|
|
echo --------------- Bash Script ------------------
|
|
/bin/bash "$1"
|
|
echo ----------------------------------------------
|
|
|
|
# CUDA/CUBLAS project
|
|
else
|
|
echo --------- CUDA/CUBLAS project ----------------
|
|
if [ "`echo $1| grep /`" != "" ]; then
|
|
DirName=${1%/*.[Cc][Uu]}
|
|
cd "$DirName"
|
|
fi
|
|
make
|
|
# RelProgName=${RelSrcName%.cu}
|
|
RelProgName=`grep EXECUTABLE Makefile | cut -f2 | cut -d " " -f2`
|
|
~/NVIDIA_CUDA_SDK/bin/linux/release/"$RelProgName"
|
|
echo ----------------------------------------------
|
|
fi
|