-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
73 lines (54 loc) · 1.75 KB
/
makefile
File metadata and controls
73 lines (54 loc) · 1.75 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
68
69
70
71
72
CPP=g++
LIB_INSTALL_DIR = /usr/local/lib/
INCLUDE_INSTALL = /usr/local/include/mutlib
INCLUDE_DIR = -I.
LINK_LIBS := -lpthread -lboost_system -lboost_filesystem
LIB = libmut.so
SOURCE = logger.cpp config.cpp util.cpp
HEADER = logger.h config.h util.h
OBJS = $(SOURCE:.cpp=.o)
DEPS = $(SOURCE:.cpp=.d)
-include $(DEPS)
DEBUG = -g3 -DDEBUG
RELEASE = -O2 -DNDEBUG
RELEASESYMBOLS = -O2 -DNDEBUG -g2
FLAGS = -march=native -mtune=native -fno-default-inline -fno-stack-protector -pthread -Wall -pedantic -Wextra -Weffc++ -Waddress -Warray-bounds -Wno-builtin-macro-redefined -Wundef
FLAGS += -std=c++17
FLAGSDEBUG = $(FLAGS)
FLAGSDEBUG += $(DEBUG)
FLAGSRELEASE = $(FLAGS)
FLAGSRELEASE += $(RELEASE)
FLAGSREL_SYM = $(FLAGS)
FLAGSREL_SYM += $(RELEASESYMBOLS)
.PHONY: release
release: CFLAGS = $(FLAGSRELEASE) -c -fPIC
release: all
#release: install
.PHONY: debug
debug: CFLAGS = $(FLAGSDEBUG) -c -fPIC
debug: all
#debug: install
.PHONY: release_symbols
relsym: CFLAGS = $(RELEASESYMBOLS) -c -fPIC
relsym: all
all : $(OBJS)
$(CC) -shared -o $(LIB) $(OBJS) $(LINK_LIBS)
%.o: %.cpp
$(CPP) $(CFLAGS) -MMD -MP -c $< -o $@
#%.d: %.cpp
# $(CC) $(CFLAGS) -MM -MT $< -o $@
# -MF write the generated dependency rule to a file
# -MG assume missing headers will be generated and don't stop with an error
# -MM generate dependency rule for prerequisite, skipping system headers
# -MP add phony target for each header to prevent errors when header is missing
# -MT add a target to the generated dependency
clean :
rm -f *.o *.so *.d
install : all
install -d $(INCLUDE_INSTALL)
install -m 644 $(LIB) $(LIB_INSTALL_DIR)
install -m 644 $(HEADER) $(INCLUDE_INSTALL)
uninstall :
rm -f $(LIB_INSTALL_DIR)/$(LIB)
rm -f $(INCLUDE_INSTALL)/*.h
rmdir $(INCLUDE_INSTALL)