-
Notifications
You must be signed in to change notification settings - Fork 176
/
Makefile
63 lines (44 loc) · 1.26 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
# Compiler prefix, in case your default compiler does not implement all C++11 features:
#CROSS = /opt/toolchain/x86_64-pc-linux-gnu-gcc-4.7.0/bin/x86_64-pc-linux-gnu-
# HINT: g++ -Q -O2 --help=optimizers
OPTIMIZER = -Os
CC = $(CROSS)gcc
CXX = $(CROSS)g++
SIZE = size -d
RM = rm -f
SRC_DIRS = .
INCLUDE = -I ../../include
SRCS = $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS)))
OBJS = $(SRCS:.cpp=.o)
DEPENDS = $(OBJS:.o=.d)
EXE = $(SRCS:.cpp=)
#------------------------------------------------------------------------------
# flags
#
FLAGS += $(INCLUDE)
FLAGS += -MMD
CXXFLAGS = $(FLAGS)
CXXFLAGS += $(OPTIMIZER)
CXXFLAGS += -std=c++11
CXXFLAGS += -fno-exceptions
CXXFLAGS += -fno-rtti
CXXFLAGS += -Wall -Wextra
CXXFLAGS += -Wctor-dtor-privacy
CXXFLAGS += -Wcast-align -Wpointer-arith -Wredundant-decls
CXXFLAGS += -Wshadow -Wcast-qual -Wcast-align -pedantic
# Produce debugging information (for use with gdb)
#OPTIMIZER = -Og
#FLAGS += -g
# Use LLVM
#CXX = $(CROSS)clang++
#CXXFLAGS += -stdlib=libc++
#LDFLAGS += -lc++
.PHONY: all clean
all: $(EXE)
%: %.cpp
$(CXX) $(CXXFLAGS) -o $@ $<
$(SIZE) $@
clean:
$(RM) *.d
$(RM) $(EXE)
-include $(DEPENDS)