-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinitializer.sh
61 lines (43 loc) · 1.1 KB
/
initializer.sh
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
#!/bin/bash
cmp_path=""
flag=$(type -p "gcc")
if [ "$flag" != "" ];
then
cmp_path=$flag;
fi
flag=$(type -p "g++")
if [ "$flag" != "" ];
then
cmp_path=$flag;
fi
flag=$(type -p "clang++")
if [ "$flag" != "" ];
then
cmp_path=$flag;
fi
cmp=""
if [ "$cmp_path" == "" ];
then
read -p "Cannot find cpp compiler. Please specify the path to the executable compiler: " cmp
else
confirm=""
cmp=$cmp_path
read -p "Compiler that was found '${cmp}' Use it? [y/n]: " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]]
if [[ $confirm != [yY] && $confirm != [yY][eE][sS] ]];
then
read -p "Specify the compiler's path: " cmp
fi
fi
if [ -d ./cpm ];
then
echo './cpm already exist. Compilation...'
else
mkdir cpm
fi
main_comp="${cmp} ./Compiler/src/main.cpp ./Compiler/AST/ast_nodes.cpp ./Compiler/helpers/char_source.cpp ./Compiler/src/lexer.cpp ./Compiler/src/parser.cpp ./Compiler/src/translator.cpp ./Compiler/src/compiler.cpp -lpthread -std=c++17 -o cpm/cpm"
$main_comp
if [ ! -d ./cpm/details ];
then
mkdir cpm/details
fi
echo "${cmp}" > cpm/details/cpp_compiler_path