forked from chenshuo/muduo
-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathbuild.sh
executable file
·103 lines (93 loc) · 2.49 KB
/
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
#!/bin/sh
#!/usr/bin/env bash
# ******************************************************
# DESC : zookeeper devops script
# AUTHOR : Alex Stocks
# VERSION : 1.0
# LICENCE : LGPL V3
# EMAIL : alexstocks@foxmail.com
# MOD : 2016-05-13 02:01
# FILE : load.sh
# ******************************************************
name="zookeeper"
base=muduo/base/tests/lib
net=muduo/net/tests/lib
contrib=contrib
build=build
usage() {
echo "Usage: $0 build [base | net | hiredis | all] # in default, build all."
echo " $0 clean [base | net | hiredis | all] # in default, clean all."
}
build() {
target=$1
echo "target:" $target
# make build dir.
if [ ! -d "build" ]; then
mkdir -p $build/lib
fi
if [ ! -d "bin" ]; then
mkdir -p $build/bin
fi
case C"$target" in
Cbase)
cd muduo/base/tests && make -f makefile && cd -
cp $base/libmuduo_base.a $build/lib
;;
Cnet)
cd muduo/net/tests && make -f makefile && cd -
cp $net/libmuduo.a $build/lib
;;
Chiredis)
cd $contrib/hiredis && make -f makefile && cd -
cp $contrib/hiredis/bin/* $build/bin
;;
C*)
cd muduo/base/tests && make -f makefile && cd -
cp $base/libmuduo_base.a $build/lib
cd muduo/net/tests && make -f makefile && cd -
cp $net/libmuduo.a $build/lib
cd $contrib/hiredis && make -f makefile && cd -
cp $contrib/hiredis/bin/* $build/bin
;;
esac
}
clean() {
target=$1
echo "target:" $target
case C"$target" in
Cbase)
cd muduo/base/tests && make -f makefile clean && cd -
rm -rf $build/lib/libmuduo_base.a
;;
Cnet)
cd muduo/net/tests && make -f makefile clean && cd -
rm -rf $build/lib/libmuduo.a
;;
Chiredis)
cd $contrib/hiredis && make -f makefile clean && cd -
rm -rf $build/bin/*
;;
C*)
cd muduo/base/tests && make -f makefile clean && cd -
cd muduo/net/tests && make -f makefile clean && cd -
cd $contrib/hiredis && make -f makefile clean && cd -
rm -rf $build
;;
esac
}
opt=$1
target="all"
if [ $# == 2 ]; then
target=$2
fi
case C"$opt" in
Cbuild)
build $target
;;
Cclean)
clean $target
;;
C*)
usage
;;
esac