-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
123 lines (102 loc) · 3.19 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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
CC=g++
BITS?=64
SHELL:=/bin/bash
UNAME:=$(shell uname | tr '[A-Z]' '[a-z]')
PWD:=$(shell pwd)
TARGET=liblagent.so
PLATFORM_COPTS:=-mfpmath=sse \
-std=gnu++0x
PLATFORM_WARNINGS:=-Wframe-larger-than=16384 \
-Wno-unused-but-set-variable \
-Wunused-but-set-parameter \
-Wvla \
-Wno-conversion-null \
-Wno-builtin-macro-redefined
LIBS=-ldl -lpthread
SRC_DIR:=$(PWD)/src/native
BUILD_DIR?=$(shell mkdir build-$(BITS) 2> /dev/null; echo $(PWD)/build-$(BITS))
OPT?=-O3
GLOBAL_WARNINGS=-Wformat-security \
-Wformat \
-Wno-char-subscripts \
-Wno-sign-compare \
-Wno-strict-overflow \
-Wnon-virtual-dtor \
-Woverloaded-virtual \
-Wwrite-strings
GLOBAL_COPTS=-fdiagnostics-show-option \
-fexceptions \
-fno-asynchronous-unwind-tables \
-fno-omit-frame-pointer \
-fno-strict-aliasing \
-fPIC \
-funsigned-char \
-Fvisibility=hidden \
-m$(BITS) \
-msse2 \
-g \
-D__STDC_FORMAT_MACROS
COPTS:=$(PLATFORM_COPTS) \
$(GLOBAL_COPTS) \
$(PLATFORM_WARNINGS) \
$(GLOBAL_WARNINGS) \
$(OPT)
JAVA_HOME:=$(shell \
[[ -n "$${JAVA_HOME}" ]] || \
JAVA_HOME=$$(dirname $$(readlink -f $$(which java)))/..; \
[[ "$${JAVA_HOME}" =~ /jre ]] && JAVA_HOME=$${JAVA_HOME}/..; \
[[ -n "$${JAVA_HOME}" ]] || (echo "Cannot find JAVA_HOME" && exit); \
echo $${JAVA_HOME})
INCLUDES=-I$(JAVA_HOME)/include \
-I$(JAVA_HOME)/include/$(UNAME) \
-I/usr/include
SOURCES=$(wildcard $(SRC_DIR)/*.cc)
_OBJECTS=$(SOURCES:.cc=.pic.o)
OBJECTS = $(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(_OBJECTS))
$(BUILD_DIR)/%.pic.o: $(SRC_DIR)/%.cc
$(CC) $(INCLUDES) $(COPTS) -c $< -o $@
all: native java tests
native: $(OBJECTS)
$(CC) $(COPTS) -shared \
-o $(BUILD_DIR)/$(TARGET) \
-Bsymbolic $(OBJECTS) $(LIBS)
java:
mvn -f src/java/pom.xml install
tests: java
javac src/java/src/test/java/test/*.java -cp src/java/target/client*dependencies.jar
clean:
rm -rf $(BUILD_DIR)/*
rm -rf src/java/src/test/java/test/*.class
rm -rf src/java/target
run-workload:
cd src/java/src/test/java/; \
java \
-agentpath:$(BUILD_DIR)/liblagent.so \
-cp $$(readlink -f ../../../target/client*dependencies.jar):. \
test.TestThreadSerial --fast
run-rmi-host:
java \
-cp $$(readlink -f ./src/java/target/client-*-jar-with-dependencies.jar):$(JAVA_HOME)/lib/tools.jar \
jcoz.service.JCozService
run-profiler:
cd src/java/src/test/java/; \
java \
-agentpath:$(BUILD_DIR)/liblagent.so \
-cp $$(readlink -f ../../../target/client*dependencies.jar):. \
test.JCozServiceTest