forked from xrayio/libxray
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (52 loc) · 2.23 KB
/
Makefile
File metadata and controls
67 lines (52 loc) · 2.23 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
ifeq ("${V}","1")
Q :=
else
Q := @
endif
WORK_DIR:=.
SRC_DIR:=${WORK_DIR}/src
TEST_DIR:=${SRC_DIR}/tests
INSTALL_DIR:=${WORK_DIR}/dist
PKG_DIR:=${WORK_DIR}/pkgs
PKG_INSTALL_DIR:=${PKG_DIR}/install
ZMQ_DIR:=${PKG_DIR}/libzmq
TSL_DIR:=${PKG_DIR}/tsl
ZMQPP_DIR:=${PKG_DIR}/cppzmq
JSON_DIR:=${PKG_DIR}/json
DEBUG_SANITIZE:=-fsanitize=address -fno-omit-frame-pointer # -fsanitize=undefined
SYS_INC:=-I/usr/include -I/usr/local/include
SYS_LIB:=-L//usr/lib/x86_64-linux-gnu/ -L/usr/local/lib
.PHONY: all pull debug clean libxray test-app xraycli test test-in-docker
all: libxray
${Q}echo "\033[32mXRAY: done!\033[0m"
init-ubuntu14.04:
sudo add-apt-repository -y ppa:chris-lea/libsodium
sudo echo "deb http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/chris-lea/libsodium/ubuntu trusty main" >> /etc/apt/sources.list
sudo apt-get update -y
sudo apt-get -y --force-yes install libsodium-dev
sudo apt-get install -y --force-yes libzmq3 libzmq3-dev
sudo apt-get install -y --force-yes libpgm-dev
clean:
${Q}rm -rf ${INSTALL_DIR}/*
run-test-app: test-app
./dist/test-app
libxray:
${Q}g++ -c -g -O2 -I${PKG_INSTALL_DIR} ${SYS_INC} -std=c++11 -fPIC -pthread -o ${INSTALL_DIR}/xray.o ${SRC_DIR}/xray.cpp
${Q}ar rcs ${INSTALL_DIR}/libxray.a ${INSTALL_DIR}/xray.o
${Q}#g++ -shared -o ${INSTALL_DIR}/libxray.so -lzmq -L${INSTALL_DIR} -L/usr/lib/x86_64-linux-gnu/ ${INSTALL_DIR}/xray.o
${Q}ln -sf ../${SRC_DIR}/xray.h ${INSTALL_DIR}/xray.h
${Q}#gcc -g -O0 -L${INSTALL_DIR} -fsanitize=address -lxray -o ${INSTALL_DIR}/xray-ctest ${SRC_DIR}/xray-c.c
libxray-debug:
${Q}g++ -c -g -O0 -I${PKG_INSTALL_DIR} ${SYS_INC} ${DEBUG_SANITIZE} -std=c++11 -fPIC -pthread -o ${INSTALL_DIR}/xray.o ${SRC_DIR}/xray.cpp
${Q}ar rcs ${INSTALL_DIR}/libxray.a ${INSTALL_DIR}/xray.o
${Q}ln -sf ../${SRC_DIR}/xray.h ${INSTALL_DIR}/xray.h
xraycli:
${Q} pip install -e .
test-app: libxray-debug
gcc -g -O0 -L${INSTALL_DIR} -I${INSTALL_DIR} ${SYS_INC} ${SYS_LIB} ${DEBUG_SANITIZE} -o ${INSTALL_DIR}/test-app ${SRC_DIR}/test-app.c -lxray -lstdc++ -lzmq
test: test-app xraycli
${Q}export XRAY_ROOT=$(abspath ${WORK_DIR}); \
python test/xray-test.py
test-in-docker:
docker-compose -f docker-test.yml up