-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (39 loc) · 790 Bytes
/
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
VERBOSE ?=
DEBUG ?=
ifeq ($(VERBOSE),1)
Q =
else
Q = @
endif
CXXSRC = $(wildcard *.cpp)
EXECUTABLES = $(CXXSRC:.cpp=)
TESTS = $(CXXSRC:.cpp=.test)
CC = g
GCC = $(Q)$(CC)cc
GXX = $(Q)$(CC)++
ECHO = @echo -e
ifeq ($(VERBOSE),1)
RM = rm -v
else
RM = @rm
endif
ifeq ($(DEBUG),1)
DBGFLAGS = -g
else
DBGFLAGS =
endif
OPTFLAGS= -O3
IFLAGS =
WFLAGS = -Wall -Wextra -Wpedantic -Wnull-dereference -Wshadow
WFLAGS += -Wdouble-promotion -Winit-self -Wswitch-default -Wswitch-enum
WFLAGS += -Wundef -Wconversion -Winline -Waddress
COMFLAGS= $(WFLAGS)
GCCFLAGS= $(OPTFLAGS) $(IFLAGS) $(COMFLAGS) $(DFLAGS)
CXXFLAGS= $(GCCFLAGS) -std=c++17
all: $(EXECUTABLES)
%: %.cpp
$(ECHO) "G++\t$@"
$(GXX) $(CXXFLAGS) $< -o $@
.PHONY: clean
clean:
$(RM) -f $(EXECUTABLES)