blob: fa2b74a98e1b1b4849710fc3f7d00ab5ed5720d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#!/usr/bin/env bash
RED='\033[0;31m\033[1m'
NC='\033[0m' # No Color
function iferrorcomp () {
if [[ error -eq 1 ]]; then
printf "$RED\nCrit: ERROR had occured during compile!!\n"
fi
}
if [[ ! -f $1 || ! $1 && ! -f Makefile ]]; then
printf "$RED No file/arguments given.\n"
exit 1
fi
if [[ ${1##*.} == "asm" ]]; then
printf "\$ nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o\n"
nasm -f elf64 -g -F dwarf $1 -l ${1%.*}.lst -o ${1%.*}.o || error=1
if [[ error -eq 1 ]]; then
printf "\n\$ nasm -f elf64 -g -F dwarf $1 -; ${1%.*}.lst -o ${1%.*}.o: $RED\error had occured\n"
exit 1
fi
printf "compiled into ${1%.*}.o\n"
printf "\$ ld ${1%.*}.o -o ${1%.*}" || error=1
if [[ error -eq 1 ]]; then
printf "\n\$ ld ${1%.*}.o -o ${1%.*}" || error=1
exit 1
fi
ld ${1%.*}.o -o ${1%.*}
printf "linked into ${1%.*}\n"
printf "compiled into executable"
elif [[ ${1##*.} == "c" || ${1##*.} == "cc" ]]; then
printf "\$ gcc $1 -o ${1%.*}\n"
gcc $1 -o ${1%.*} || error=1
if [[ error -eq 1 ]]; then
printf "\n\$ gcc $1 -o ${1%.*}: $RED\error had occured\n"
exit 1
fi
printf "compiled into ${1%.*}\n"
elif [[ ${1##*.} == "cpp" ]]; then
printf "\$ g++ $1 -o ${1%.*}\n"
g++ $1 -o ${1%.*} || error=1
if [[ error -eq 1 ]]; then
printf "\n\$ g++ $1 -o ${1%.*}: $RED\error had occured\n"
exit 1
fi
printf "compiled into ${1%.*}\n"
elif [[ ${1##*.} == "go" ]]; then
printf "\$ go build $1\n"
go build $1
printf "compiled into ${1%.*}\n"
elif [[ ${1##*.} == "cs" ]]; then
printf "\$ csc $1\n"
csc $1
printf "compiled into ${1%.*}.exe\n"
elif [[ ${1##*.} == "java" ]]; then
printf "\$ javac $1\n"
javac $1
printf "compiled into ${1%.*}.class\n"
elif [[ ${1##*.} == "py" ]]; then
printf "\$ pyinstaller -F $1\n"
#python -m py_compile $1
pyinstaller -F $1
printf "compiled into dist/${1%.*}\n"
elif [[ ${1##*.} == "rb" ]]; then
printf "\$ ruby -wc $1\n"
ruby -wc $1
printf "compiled into ${1%.*}\n"
elif [[ ${1##*.} == "js" ]]; then
printf "\$ node $1\n"
node $1
printf "compiled into ${1%.*}\n"
elif [[ ${1##*.} == "ts" ]]; then
printf "\$ tsc $1\n"
tsc $1
printf "compiled into ${1%.*}.js\n"
elif [[ ${1##*.} == "dart" ]]; then
printf "\$ dart compile exe $1\n"
dart compile exe $1
printf "compiled into ${1%.*}\n"
elif [[ ${1##*.} == "rs" ]]; then
printf "\$ rustc $1\n"
rustc $1
printf "compiled into ${1%.*}\n"
elif [ -e "Makefile" ]; then
make
sudo make install
else
printf "${RED}ERROR: nothing compiled.\n"
fi
|