-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile.gcc
29 lines (26 loc) · 911 Bytes
/
Makefile.gcc
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
# Debug/optimization flags (optimized by default)
ifeq ($(CFG),debug)
CFLAGS += -O0 -ggdb3
else
CFLAGS += -O2
CFLAGS += -march=native
endif
# Disable strict aliasing
# TODO: no-strict-aliasing removes some optimizations but seems required for correctness. need more investigation.
CFLAGS += -fno-strict-aliasing
# Disable stack smashing protector (__stack_chk_fail)
CFLAGS += -fno-stack-protector
# Enable all warnings but unsused functions and labels
CFLAGS += -Wall -Wno-unused-function -Wno-unused-label
# Enable extra warnings
# CFLAGS += -Wextra
# Link Time Optimization (LDFLAGS also requires optimization flags)
# CFLAGS += -flto
# LDFLAGS += $(CFLAGS) -fwhole-program -fuse-linker-plugin
# Enable profiling mode
# CFLAGS += -fprofile-generate
# LDFLAGS += -fprofile-generate
# Run typical program
# Use the profiling information to compile
# CFLAGS += -fprofile-use
# LDFLAGS += -fprofile-use