-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompiler.mk
52 lines (39 loc) · 1 KB
/
compiler.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
# GCC Compiler
################################################################################
# Ccache
#
export CCACHE_DIR=/tmp/ccache/makefile/$(PROJ_NAME)
CCACHE=ccache
################################################################################
# Toolchain
#
AS = $(CCACHE) gcc -x assembler-with-cpp
CC = $(CCACHE) gcc
CXX = $(CCACHE) g++
LD = gcc
AR = ar
SZ = size
OC = objcopy
NM = nm
################################################################################
# Flags
#
# Compiler errors and warnings
CPPFLAGS += -w -Werror -Wall -pedantic-errors -Wshadow -Wextra
# C language specification
CFLAGS += -std=c99
# C++ language specification
CXXFLAGS += -std=c++98
# Autodependency
CPPFLAGS += -MT $@ -MMD -MP -MF $(@:%.o=%.Td)
# Generate listing
CPPFLAGS += -Wa,-a,-ad,-alms=$(@:%.o=%.lst)
# Use colors with logs
CPPFLAGS += -DLOG_USE_COLOR
# Debug/Release flags
ifeq ($(TARGET),dbg)
CPPFLAGS+=-g3 -Og -gdwarf-2 -DDEBUG
endif
ifeq ($(TARGET),rel)
CPPFLAGS+=-O3 -DNDEBUG
endif