-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpmake
More file actions
executable file
·83 lines (73 loc) · 1.74 KB
/
pmake
File metadata and controls
executable file
·83 lines (73 loc) · 1.74 KB
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
#!/bin/bash
RED="\e[31m"
NOCOLOR="\e[0m"
CYAN="\e[36m"
wholedir="$(pwd)"
dirname="$(basename $wholedir)"
if [ -f go ]
then
if [ -f $dirname ]
then
rm $dirname
fi
echo -e "[$dirname] ${CYAN}Build: Starting${NOCOLOR}"
go build -o $dirname main.go
if (( $? > 0 ))
then
echo -e "[$dirname] ${RED}Build: Failed${NOCOLOR}"
exit 1
fi
echo -e "[$dirname] ${CYAN}Build: Done${NOCOLOR}"
elif [ -f asm ]
then
if [ -f $dirname ]
then
rm $dirname
fi
echo -e "[$dirname] ${CYAN}Build: Starting${NOCOLOR}"
gcc $dirname.s -c -g
if (( $? > 0 ))
then
echo -e "[$dirname] ${RED}Build: Failed on assembling${NOCOLOR}"
exit 1
fi
ld -o $dirname $dirname.o -nostdlib -static
if (( $? > 0 ))
then
rm $dirname.o
echo -e "[$dirname] ${RED}Build: Failed on linking${NOCOLOR}"
exit 1
fi
rm $dirname.o
echo -e "[$dirname] ${CYAN}Build: Done${NOCOLOR}"
else
if [ -f "build/Makefile" ]; then
echo -e "[$dirname] ${CYAN}Build: Starting${NOCOLOR}"
cd build
make -j `nproc`
if (( $? > 0 ))
then
echo -e "[$dirname] ${RED}Build: Failed${NOCOLOR}"
exit 1
fi
cd ..
echo -e "[$dirname] ${CYAN}Build: Done${NOCOLOR}"
else
echo -e "[$dirname] ${RED}No config files found, generate config? (y/n):${NOCOLOR} "
read yon
if [ $yon == "y" ]
then
pconfigure
echo -e "[$dirname] ${CYAN}Build: Starting${NOCOLOR}"
cd build
make -j `nproc`
if (( $? > 0 ))
then
echo -e "[$dirname] ${RED}Build: Failed${NOCOLOR}"
exit 1
fi
cd ..
echo -e "[$dirname] ${CYAN}Build: Done${NOCOLOR}"
fi
fi
fi