-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
38 lines (27 loc) · 1.25 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
ROOT_TERRYWH=/data/wuhao/cpdocs/github.com/terrywh
EXTENSION_NAME=flame
EXTENSION_VERSION=0.1.0
ROOT_PROJECT=${ROOT_TERRYWH}/php-${EXTENSION_NAME}
VENDOR_LIBRARY= ${ROOT_TERRYWH}/libphpext/libphpext.a /data/vendor/boost/lib/libboost_system.a -lpthread
PHP=php
PHP_CONFIG=php-config
CXX?=g++
CXXFLAGS?= -g -O0
INCLUDE=-I${ROOT_TERRYWH}/libphpext `${PHP_CONFIG} --includes`
LIBRARY=${VENDOR_LIBRARY}
# SOURCES=$(wildcard src/*.cpp) $(wildcard src/**/*.cpp) $(wildcard src/**/**/*.cpp)
SOURCES=src/extension.cpp src/core.cpp src/net/init.cpp src/net/udp_socket.cpp src/net/tcp_socket.cpp src/net/tcp_server.cpp
OBJECTS=$(SOURCES:%.cpp=%.o)
EXTENSION=${EXTENSION_NAME}.so
.PHONY: install clean
# 暂时先将 libphpext.a 作为依赖(库还不稳定)
${EXTENSION}: ${OBJECTS} ${ROOT_TERRYWH}/libphpext/libphpext.a
${CXX} -shared ${OBJECTS} ${LIBRARY} -Wl,-rpath='$$ORIGIN/' -Wl,-rpath='/usr/local/gcc6/lib64/' -o ${EXTENSION_NAME}.so
%.o: %.cpp
${CXX} -std=c++11 -fPIC -DEXTENSION_NAME=\"${EXTENSION_NAME}\" -DEXTENSION_VERSION=\"${EXTENSION_VERSION}\" ${CXXFLAGS} ${INCLUDE} -c $^ -o $@
clean:
rm -f ${EXTENSION} ${OBJECTS}
install: ${EXTENSION}
cp -f ${EXTENSION} `${PHP_CONFIG} --extension-dir`
test:
${PHP} udp/server.php