-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.mk
60 lines (41 loc) · 1.22 KB
/
config.mk
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
SRC=main.cpp
STD=c++17
BUILD_DIR=build
TARGET=fluke
# Include & Link
INCS=-I. -Isrc/ -Imodules/tinge/
LIBS=-lxcb -lxcb-util -lxcb-randr -lxcb-icccm -lxcb-keysyms $(LDLIBS)
# Options
PROGRAM_CPPFLAGS=$(CPPFLAGS)
PROGRAM_LDFLAGS=$(LIBS) $(LDFLAGS)
PROGRAM_WARNINGS=-Wall -Wextra -Wmissing-include-dirs -Wsign-conversion -Wshadow -Wundef -Wno-unused -Wno-unused-parameter -Wno-missing-braces $(CXXWARN)
# Make Flags
debug ?= yes
symbols ?= yes
sanitize ?= no
# Debugging
ifeq ($(debug),no)
symbols ?= no
PROGRAM_CXXFLAGS=-flto -Ofast -march=native -DNDEBUG $(CXXFLAGS)
else ifeq ($(debug),yes)
symbols ?= yes
ifeq ($(sanitize),yes)
PROGRAM_CXXFLAGS=-Og -march=native -fsanitize=address,undefined,leak
else ifeq ($(sanitize),no)
PROGRAM_CXXFLAGS=-Og -march=native
else
$(error sanitize should be either yes or no)
endif
else
$(error debug should be either yes or no)
endif
# Debugging Symbols
ifeq ($(symbols),yes)
PROGRAM_CXXFLAGS+=-g
else ifeq ($(symbols),no)
PROGRAM_CXXFLAGS+=-s
else
$(error symbols should be either yes or no)
endif
# Accumulate all flags
COMPILE_COMMAND=$(CXX) $(PROGRAM_LDFLAGS) -std=$(STD) $(PROGRAM_WARNINGS) -m64 $(PROGRAM_CXXFLAGS) $(INCS) $(PROGRAM_CPPFLAGS) -o $(BUILD_DIR)/$(TARGET) $(SRC)