forked from Beckhoff/ADS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (51 loc) · 1.32 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
OS_NAME ?=$(shell uname)
VPATH = AdsLib
LIBS = -lpthread
LIB_NAME = AdsLib-$(OS_NAME).a
OBJ_DIR = obj
CXX :=$(CROSS_COMPILE)$(CXX)
CXXFLAGS += -std=c++11
CXXFLAGS += -pedantic
CXXFLAGS += -Wall
CXXFLAGS += -Wextra
CXXFLAGS += -D_GNU_SOURCE
CXXFLAGS += $(ci_cxx_flags)
CPPFLAGS += -I AdsLib/
CPPFLAGS += -I tools/
SRC_FILES = AdsDef.cpp
SRC_FILES += AdsLib.cpp
SRC_FILES += AmsConnection.cpp
SRC_FILES += AmsPort.cpp
SRC_FILES += AmsRouter.cpp
SRC_FILES += Log.cpp
SRC_FILES += NotificationDispatcher.cpp
SRC_FILES += Sockets.cpp
SRC_FILES += Frame.cpp
OBJ_FILES = $(SRC_FILES:%.cpp=$(OBJ_DIR)/%.o)
ifeq ($(OS_NAME),Darwin)
LIBS += -lc++
endif
ifeq ($(OS_NAME),win32)
LIBS += -lws2_32
endif
all: $(LIB_NAME)
$(OBJ_DIR):
mkdir -p $@
$(OBJ_FILES): | $(OBJ_DIR)
$(OBJ_FILES): $(OBJ_DIR)/%.o: %.cpp
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
$(LIB_NAME): $(OBJ_FILES)
$(AR) rvs $@ $?
AdsLibTest.bin: AdsLibTest/main.cpp $(LIB_NAME)
$(CXX) $^ $(LIBS) $(CPPFLAGS) $(CXXFLAGS) -o $@
test: AdsLibTest.bin
./$<
clean:
rm -f *.a *.o *.bin AdsLibTest/*.o $(OBJ_DIR)/*.o
uncrustify:
uncrustify --no-backup -c tools/uncrustify.cfg AdsLib*/*.h AdsLib*/*.cpp example/*.cpp
prepare-hooks:
rm -f .git/hooks/pre-commit
ln -Fv tools/pre-commit.uncrustify .git/hooks/pre-commit
chmod a+x .git/hooks/pre-commit
.PHONY: clean uncrustify prepare-hooks