-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathall_project_build.sh
106 lines (100 loc) · 2.07 KB
/
all_project_build.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
CMDNAME=`basename $0`
if [[ $1 = "-help" ]]; then
echo "Usage: $CMDNAME options [clean]"
echo " -debug debug build, 'OPTIMIZE=-O0'"
echo ""
exit
fi
# analize options
MAKE_OPTION=""
BUILD="release"
if [[ $1 = "-debug" ]]; then
MAKE_OPTION="-e"
export BUILD="debug"
shift
fi
RED=`tput setaf 1`
GREEN=`tput setaf 2`
PINK=`tput setaf 5`
LIGHTBLUE=`tput setaf 6`
YELLO=`tput setaf 3`
NOCOLOR=`tput sgr0`
# make clean func
make_clean()
{
cd "$2"
echo "${GREEN}Clean project (${BUILD}): " $1 $2 "${NOCOLOR}"
make ${MAKE_OPTION} clean >& /dev/null
if [ $? -ne 0 ]; then
echo "${RED}Clean Error: " $1 $2 "${NOCOLOR}"
echo ""
exit 1
fi
cd ..
}
# make clean
if [[ $1 = "clean" ]]; then
for file in `ls -d *`;
do
if [ ${file} = "legacy" ]; then
echo "${YELLO}Legacy project: pass..." "${NOCOLOR}"
elif [ ${file} = "common" ]; then
echo "${YELLO}common: pass..." "${NOCOLOR}"
elif [ -e "${file}/Makefile" ]; then
make_clean "" "${file}"
elif [ -d "${file}" ]; then
cd "${file}"
for proj in `ls -d *`;
do
if [ -e "${proj}/Makefile" ]; then
make_clean "${file}" "${proj}"
fi
done
cd ..
fi
done
exit
fi
# make_main func
make_main()
{
echo "${PINK}Start project (${BUILD}): " $1 $2 "${NOCOLOR}"
cd $2
make ${MAKE_OPTION} > /dev/null
if [ $? -ne 0 ]; then
echo "${RED}Compile error: " $1 $2 "${NOCOLOR}"
echo ""
exit 1
fi
cd ..
echo "${LIGHTBLUE}Build project: " $1 $2 "${NOCOLOR}"
}
# make
# first build drw2d library
for file in `ls -d RX600/drw2d`;
do
if [ -e "${file}/Makefile" ]; then
make_main "" ${file}
cd ..
fi
done
for file in `ls -d *`;
do
if [ ${file} = "legacy" ]; then
echo "${YELLO}Legacy project: pass..." "${NOCOLOR}"
elif [ ${file} = "common" ]; then
echo "${YELLO}common: pass..." "${NOCOLOR}"
elif [ -e "${file}/Makefile" ]; then
make_main "" ${file}
elif [ -d "${file}" ]; then
cd "${file}"
for proj in `ls -d *`;
do
if [ -e "${proj}/Makefile" ]; then
make_main "${file}" "${proj}"
fi
done
cd ..
fi
done