-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
59 lines (48 loc) · 1.76 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
OPENWRT_DIR := /home/au/all/openwrt/attitude_adjustment
STAGING_DIR := $(OPENWRT_DIR)/staging_dir
CROSS_DIR := $(STAGING_DIR)/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin
export PATH := $(PATH):$(CROSS_DIR)
export STAGING_DIR
HOST:=mips-openwrt-linux-
#XMLRPC-C-CONFIG-PREFIX=/home/bobo/work/485/xmlrpc-openwrt-ar71xx/bin/
XMLRPC-C-CONFIG-PREFIX=./xmlrpc-openwrt-ar71xx/bin/
SRC_DIR:=src src/protocol
CPPFLAGS+=-Wall
#CPPFLAGS+=-Wall -g -D_DEBUG
#CPPFLAGS+=-Wall -g -D_DEBUG -D_TEST
#CPPFLAGS+=-Wall -O2 -DNDEBUG
CPPFLAGS+=-Isrc -Ilib-linux/src -Isrc/protocol -I./xmlrpc-openwrt-ar71xx/include
CPPFLAGS+=$(shell $(XMLRPC-C-CONFIG-PREFIX)xmlrpc-c-config c++2 abyss-server --cflags)
CPPFILES:=$(shell find $(SRC_DIR) -maxdepth 1 -name "*.cpp")
CPPOBJS:=$(CPPFILES:%.cpp=%.o)
LIBS+= $(filter-out -lpthread, $(shell $(XMLRPC-C-CONFIG-PREFIX)xmlrpc-c-config c++2 abyss-server --libs))\
lib-linux/liblinux_tool_mips.a -lpthread \
-L./xmlrpc-openwrt-ar71xx/lib/ -lxmlrpc \
-lxmlrpc_util \
-lxmlrpc_xmlparse \
-lxmlrpc_xmltok \
-lxmlrpc_server \
-lxmlrpc_abyss \
-lxmlrpc_server_abyss
TARGET:=server485
LDFLAGS:=-lm -ldl
ZIP_NAME:=Hukong
ZIP_FILES:=$(addsuffix /*.[hc]*, $(SRC_DIR) client/src client/test) client/Makefile Makefile
all:lib-linux $(TARGET)
-include $(addsuffix /*.d, $(SRC_DIR))
lib-linux:
make HOST="$(HOST)" -C lib-linux
$(TARGET):$(CPPOBJS) lib-linux/liblinux_tool_mips.a
$(HOST)g++ $(LDFLAGS) -o $@ $^ $(LIBS)
$(HOST)strip $(TARGET)
#sudo cp $(TARGET) openwrt/
cp $(TARGET) openwrt/
$(CPPOBJS):%.o:%.cpp
$(HOST)g++ -c $(CPPFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -o $@ $<
clean:
-rm -f $(addsuffix /*.[do], $(SRC_DIR)) $(TARGET)
zip:
-rm -rf $(ZIP_NAME).zip
zip -r $(ZIP_NAME).zip $(ZIP_FILES)
.PHONY:
all clean zip lib-linux