-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (32 loc) · 1.12 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
-include ../.config
-include ../config.mk
AR = $(CROSS)ar
CXX = $(CROSS)g++
ARFLAGS = rcv
CPPFLAGS = -Wall -fPIC
LDSHFLAGS = -rdynamic -shared
SOURCES = tinyxml2.cpp xmlParser.cpp
OBJECTS = $(SOURCES:.cpp=.o)
TARGETS = test unittest libxmlparser.a libxmlparser.so
LDSHFLAGS = -rdynamic -shared
.PHONY:all clean install style
all:$(TARGETS)
clean:
rm -rf *.o $(TARGETS) a.out depend.d
test: test.o $(OBJECTS)
$(CXX) $(CPPFLAGS) -o $@ $^
unittest: unittest.o $(OBJECTS)
$(CXX) $(CPPFLAGS) -o $@ $^
style:
@find -regex '.*/.*\.\(c\|cpp\|h\)$$' | xargs astyle --align-pointer=name --align-reference=name --suffix=none --break-blocks --pad-oper --pad-header --break-blocks --keep-one-line-blocks --indent-switches --indent=spaces
libxmlparser.a:$(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
libxmlparser.so:$(OBJECTS)
$(CXX) $(LDSHFLAGS) -o $@ $^
install:libxmlparser.so
@echo "Install xmlParser dynamic lib..."
@mkdir -p $(LOCAL_PACK_PATH)/$(LIB_PATH)
$(if ${LOCAL_PACK_PATH},@cp $^ $(LOCAL_PACK_PATH)/$(LIB_PATH),@cp $^ /usr/local/lib)
depend.d:$(wildcard *.cpp) $(wildcard *.h)
$(CXX) -MM $(CPPFLAGS) $^ > $@
-include depend.d