forked from sysown/proxysql
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
135 lines (113 loc) · 4.72 KB
/
Makefile
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
O0=-O0
O2=-O2
O1=-O1
O3=-O3 -mtune=native
#OPTZ=$(O2)
EXTRALINK=#-pg
ALL_DEBUG=-ggdb -DDEBUG
NO_DEBUG=
DEBUG=${ALL_DEBUG}
#export DEBUG
#export OPTZ
#export EXTRALINK
.PHONY: default
default: build_deps build_lib build_src
.PHONY: debug
debug: build_deps_debug build_lib_debug build_src_debug
.PHONY: build_deps
build_deps:
cd deps && OPTZ="${O2} -ggdb" CC=${CC} CXX=${CXX} ${MAKE}
.PHONY: build_lib
build_lib:
cd lib && OPTZ="${O2} -ggdb" CC=${CC} CXX=${CXX} ${MAKE}
.PHONY: build_src
build_src:
cd src && OPTZ="${O2} -ggdb" CC=${CC} CXX=${CXX} ${MAKE}
.PHONY: build_deps_debug
build_deps_debug:
cd deps && OPTZ="${O0} -ggdb -DDEBUG" CC=${CC} CXX=${CXX} ${MAKE}
.PHONY: build_lib_debug
build_lib_debug:
cd lib && OPTZ="${O0} -ggdb -DDEBUG" CC=${CC} CXX=${CXX} ${MAKE}
.PHONY: build_src_debug
build_src_debug:
cd src && OPTZ="${O0} -ggdb -DDEBUG" CC=${CC} CXX=${CXX} ${MAKE}
.PHONY: clean
clean:
cd lib && ${MAKE} clean
cd src && ${MAKE} clean
packages: centos7 ubuntu14 debian7 debian8
.PHONY: packages
centos7: binaries/proxysql-1.0.1-1.x86_64.rpm
.PHONY: centos
ubuntu14: binaries/proxysql_1.1.0-ubuntu14_amd64.deb
.PHONY: ubuntu14
debian7: binaries/proxysql_1.1.0-debian7_amd64.deb
.PHONY: debian7
debian8: binaries/proxysql_1.1.0-debian8_amd64.deb
.PHONY: debian8
binaries/proxysql-1.0.1-1.x86_64.rpm:
# Create CentOS 7 rpm file by creating docker image, running a container and extracting the RPM from the temp container
docker build -t centos7_proxysql --no-cache=true ./docker/images/proxysql/centos7-build
docker run -i --name=centos7_build centos7_proxysql bash &
sleep 5
docker cp centos7_build:/root/rpmbuild/RPMS/x86_64/proxysql-1.0.1-1.x86_64.rpm ./binaries
# docker kill centos7_build
docker rm centos7_build
binaries/proxysql_1.1.0-ubuntu14_amd64.deb:
docker stop ubuntu14_build || true
docker rm ubuntu14_build || true
docker create --name ubuntu14_build renecannao/proxysql:build-ubuntu14 bash -c "while : ; do sleep 10 ; done"
docker start ubuntu14_build
docker exec ubuntu14_build bash -c "cd /opt; git clone https://github.com/sysown/proxysql.git proxysql"
docker exec ubuntu14_build bash -c "cd /opt/proxysql; ${MAKE} clean && ${MAKE} -j 4 build_deps && ${MAKE} -j 4"
docker cp docker/images/proxysql/ubuntu-14.04-build/proxysql.ctl ubuntu14_build:/opt/proxysql/
docker exec ubuntu14_build bash -c "cd /opt/proxysql; cp src/proxysql . ; equivs-build proxysql.ctl"
docker cp ubuntu14_build:/opt/proxysql/proxysql_1.1.0_amd64.deb ./binaries/proxysql_1.1.0-ubuntu14_amd64.deb
docker stop ubuntu14_build
docker rm ubuntu14_build
binaries/proxysql_1.1.0-debian7_amd64.deb:
docker stop debian7_build || true
docker rm debian7_build || true
docker create --name debian7_build renecannao/proxysql:build-debian7 bash -c "while : ; do sleep 10 ; done"
docker start debian7_build
docker exec debian7_build bash -c "cd /opt; git clone https://github.com/sysown/proxysql.git proxysql"
docker exec debian7_build bash -c "cd /opt/proxysql; ${MAKE} clean && ${MAKE} -j 4 build_deps && ${MAKE} -j 4"
docker cp docker/images/proxysql/debian-7.8-build/proxysql.ctl debian7_build:/opt/proxysql/
docker exec debian7_build bash -c "cd /opt/proxysql; cp src/proxysql . ; equivs-build proxysql.ctl"
docker cp debian7_build:/opt/proxysql/proxysql_1.1.0_amd64.deb ./binaries/proxysql_1.1.0-debian7_amd64.deb
docker stop debian7_build
docker rm debian7_build
binaries/proxysql_1.1.0-debian8_amd64.deb:
docker stop debian8_build || true
docker rm debian8_build || true
docker create --name debian8_build renecannao/proxysql:build-debian8 bash -c "while : ; do sleep 10 ; done"
docker start debian8_build
docker exec debian8_build bash -c "cd /opt; git clone https://github.com/sysown/proxysql.git proxysql"
docker exec debian8_build bash -c "cd /opt/proxysql; ${MAKE} clean && ${MAKE} -j 4 build_deps && ${MAKE} -j 4"
docker cp docker/images/proxysql/debian-8.2-build/proxysql.ctl debian8_build:/opt/proxysql/
docker exec debian8_build bash -c "cd /opt/proxysql; cp src/proxysql . ; equivs-build proxysql.ctl"
docker cp debian8_build:/opt/proxysql/proxysql_1.1.0_amd64.deb ./binaries/proxysql_1.1.0-debian8_amd64.deb
docker stop debian8_build
docker rm debian8_build
.PHONY: cleanall
cleanall:
cd deps && ${MAKE} cleanall
cd lib && ${MAKE} clean
cd src && ${MAKE} clean
rm binaries/*deb || true
rm binaries/*rpm || true
install: src/proxysql
install -m 0755 src/proxysql /usr/local/bin
install -m 0600 etc/proxysql.cnf /etc
install -m 0755 etc/init.d/proxysql /etc/init.d
if [ ! -d /var/run/proxysql ]; then mkdir /var/run/proxysql ; fi
update-rc.d proxysql defaults
.PHONY: install
uninstall:
rm /etc/init.d/proxysql
rm /etc/proxysql.cnf
rm /usr/local/bin/proxysql
rmdir /var/run/proxysql 2>/dev/null || true
update-rc.d proxysql remove
.PHONY: uninstall