-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake
executable file
·70 lines (58 loc) · 1.37 KB
/
make
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
#!/bin/bash
Core_number=15
Orange="\e[0;33m"
Green="\e[0;32m"
Reset='\e[m'
Red='\e[0;31m'
# Handle arguments..
if [ "$1" ]
then
if [ "$1" = "clean" ]
then
if [ ! -d build -o ! -f build/Makefile ]
then
printf "${Red}Nothing to clean !${Reset}\n"
else
printf "${Green}Cleaning build folder${Reset}\n"
cd build
make clean
cd ../
fi
exit 0
elif [ "$1" = "fclean" ]
then
if [ ! -d build ]
then
printf "${Red}No build folder to delete${Reset}\n"
else
printf "${Green}Removing the build folder${Reset}\n"
rm -rf build/
fi
exit 0
else
printf "${Red}Arguments not exist - compiling...${Reset}\n"
fi
fi
# compilation
project=$(grep project CMakeLists.txt | cut -d '(' -f2 | cut -d ')' -f1)
printf "${Green}Compiling : ${project}${Reset}\n"
if [ ! -d build ]
then
printf "${Orange}Creating build folder${Reset}\n"
mkdir build
fi
cd build
if [ ! -f Makefile ]
then
printf "${Orange}Create compilation files${Reset}\n"
emcmake cmake .. -DCMAKE_TOOLCHAIN_FILE=/home/jserin/src/vcpkg/scripts/buildsystems/vcpkg.cmake
fi
make -j $Core_number
if [ ! -f $project ]
then
printf "${Red}error durring compilation${Reset}\n"
else
mv $project ../
fi
cd ../
exit 0