-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
67 lines (53 loc) · 2.3 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
66
67
CXX ?= g++
LDPATH := -L$(shell root-config --libdir) \
-L/cvmfs/sft.cern.ch/lcg/views/LCG_95/x86_64-slc6-gcc8-opt/lib
LIBS := $(shell root-config --libs)
LDFLAGS := -rdynamic ${LDPATH} ${LIBS} \
-Wl,-Rlib,-R../lib,-R${PWD}/lib,--enable-new-dtags
TARGET_EXEC ?= eta
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS)) -isystem${CPATH}
CXXFLAGS ?= $(INC_FLAGS) -MMD -MP -std=c++17 -march=native -mtune=native -pipe \
-O3
ifeq ($(CXX),g++)
CXXFLAGS += -Wall -Wextra -Wpedantic -Wcast-align -Wcast-qual \
-Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self \
-Wlogical-op -Wmissing-declarations -Wmissing-include-dirs \
-Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls \
-Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel \
-Wstrict-overflow=5 -Wswitch-default -Wundef \
-Wuseless-cast -Wzero-as-null-pointer-constant -Wduplicated-cond \
-Wduplicated-branches -Wrestrict -Wnull-dereference -Wswitch-enum \
-Wswitch-bool -Wswitch-unreachable -Wno-coverage-mismatch \
-Wimplicit-fallthrough=5 -Wsync-nand -Wunknown-pragmas \
-Wstringop-overflow=4 -Wstringop-truncation -Wsuggest-final-types \
-Wsuggest-final-methods -Wsuggest-override -Walloc-zero -Walloca \
-Wtrampolines -Wfloat-equal -Wunsafe-loop-optimizations \
-Wplacement-new=2 -Wunused-macros -Wconditionally-supported \
-Wconversion -Wsubobject-linkage -Wdate-time -Wextra-semi \
-Wno-aggressive-loop-optimizations -Wpacked -Winline -Winvalid-pch \
-Wvector-operation-performance -Wdisabled-optimization \
-Wstack-protector -Whsa -Wsuggest-attribute=const \
-Wsuggest-attribute=pure -Wsuggest-attribute=noreturn \
-Wsuggest-attribute=format -Wsuggest-attribute=cold
else ifeq ($(CXX),clang++)
CXXFLAGS += -Weverything -Wno-c++98-compat -Wno-double-promotion \
-Wno-covered-switch-default
else
CXXFLAGS += $(UNKNOWN_CXXFLAGS)
endif
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS)
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CXXFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p