forked from agones-dev/agones
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (66 loc) · 2.6 KB
/
Copy pathMakefile
File metadata and controls
77 lines (66 loc) · 2.6 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
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for testing and building the C++ SDK
#
# __ __ _ _ _
# \ \ / /_ _ _ __(_) __ _| |__ | | ___ ___
# \ \ / / _` | '__| |/ _` | '_ \| |/ _ \ __|
# \ V / (_| | | | | (_| | |_) | | __\__ \
# \_/ \__,_|_| |_|\__,_|_.__/|_|\___|___/
#
CXX = g++
CPPFLAGS += -I/usr/local/include -pthread -fPIC
CXXFLAGS += -std=c++11
LDFLAGS += -L/usr/local/lib -lgrpc++_unsecure -lgrpc -lprotobuf -lpthread -ldl
# Directory that this Makefile is in.
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
build_path := $(dir $(mkfile_path))
# _____ _
# |_ _|_ _ _ __ __ _ ___| |_ ___
# | |/ _` | '__/ _` |/ _ \ __/ __|
# | | (_| | | | (_| | __/ |_\__ \
# |_|\__,_|_| \__, |\___|\__|___/
# |___/
# build the library
build: ensure-bin libagonessdk
# install into /usr/local in the appropriate places
# make sure to install protoc and grpc from source first to build dependencies
install:
cp $(build_path)/bin/libagonessdk.* /usr/local/lib
-mkdir -p /usr/local/include/agones
cp $(build_path)/*.h /usr/local/include/agones/
ldconfig
# make the .so build
libagonessdk: sdk.grpc.pb.o sdk.pb.o sdk.o
$(CXX) $^ $(LDFLAGS) -shared -o $(build_path)/bin/$@.so
ar rcs $(build_path)/bin/$@.a $^
# make sure the bin directory exists
ensure-bin:
-mkdir $(build_path)/bin
# build dev and runtime tarballs
archive: VERSION = "dev"
archive:
-rm $(build_path)/bin/agonessdk-$(VERSION)-dev-linux-arch_64.tar.gz
-rm $(build_path)/bin/agonessdk-$(VERSION)-runtime-linux-arch_64.tar.gz
cp /usr/local/lib/libgrpc.so.5 $(build_path)/bin/
cp /usr/local/lib/libprotobuf.so.15 $(build_path)/bin/
cp /usr/local/lib/libagonessdk.so $(build_path)/bin/
cp /usr/local/lib/libgpr.so.5 $(build_path)/bin/
cp /usr/local/lib/libgrpc_unsecure.so.5 $(build_path)/bin/
cd $(build_path)/bin && tar cvf agonessdk-$(VERSION)-runtime-linux-arch_64.tar.gz *
cd /usr/local && tar cvf $(build_path)/bin/agonessdk-$(VERSION)-dev-linux-arch_64.tar.gz lib include
clean:
-rm -r $(build_path)/bin
-rm *.o