-
Notifications
You must be signed in to change notification settings - Fork 84
/
Makefile.defs
104 lines (87 loc) · 3.2 KB
/
Makefile.defs
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
MASTER_DIR := $(TC_DIR)/firmware/master
INCLUDES += \
-Isrc \
-I$(MASTER_DIR)/common \
-I$(MASTER_DIR)/sim \
-I$(TC_DIR)/firmware/include \
-I$(TC_DIR)/sdk/include \
# Relocated listings from the earlier Cube firmware build
FIRMWARE_RST := ../firmware/cube/src/*.rst
# Non-userspace simulator build
FLAGS += -DNOT_USERSPACE -DSIFTEO_SIMULATOR -D__STDC_FORMAT_MACROS
# Versioning
FLAGS += -DSDK_VERSION=$(shell git describe --tags)
OSVERSION := $(shell python $(TC_DIR)/tools/osversion.py)
FLAGS += -DOS_VERSION=$(OSVERSION)
# Disable unwanted warnings, but be generally pretty pedantic
WARNFLAGS += -Wall -Werror -Wno-unused -Wno-strict-aliasing -Wno-uninitialized
# ensure STATIC_ASSERT() functions in as many cases as possible
WARNFLAGS += -Wvla
# Resources
ifeq ($(BUILD_PLATFORM), windows32)
OBJS += resources/winres.o
endif
# Need to set -march in order to use atomic op intrinsics, but we
# should be relatively conservative about CPU type so that this runs
# everywhere. In particular, -march=native is very much NOT what we
# want, since we need to avoid using Intel-only or AMD-only extensions
# like LZCNT.
#
# Looks like we currently only need to specify this explicitly on Win32.
# Keep in mind that 64-bit platforms will need different flags!
#
# XXX: i686 is possibly way too conservative. We were using pentium4
# here for a while, but the mingw32 GCC apparently has some really
# boneheaded stack alignment bugs with SSE2 instructions, in which
# it over-eagerly uses SSE2 moves/fills on data that doesn't meet
# the minimum 16-byte alignment.
ifeq ($(BUILD_PLATFORM), windows32)
FLAGS += -march=i686 -mtune=core2
endif
# Linker flags
ifneq ($(BUILD_PLATFORM),Darwin)
# Not supported on Apple's LLVM GCC frontend
LIBS += -Wl,--gc-sections
endif
# Config options
ifeq ($(MOTHERSHIP),1)
FLAGS += -DMOTHERSHIP
endif
ifeq ($(DEBUG),1)
FLAGS += -DDEBUG
endif
ifeq ($(CODEC_DEBUG),1)
FLAGS += -DDEBUG -DCODEC_DEBUG
endif
# Debug / optimization
#
# Unsurprisingly, compiler optimization produces a very dramatic
# difference in performance. Leave these options on at all times
# unless you have a very good reason to do otherwise.
#
# Do NOT publish unoptimized builds. Besides running several times
# slower, they will reveal too much about how our firmware works. The
# optimized builds are significantly harder to reverse engineer.
# Please only use the REALLY_DEBUG_SIFTULATOR environment var to
# disable these options. Note that doing so will automatically
# change the name of the binary to help distinguish this from an
# optimized (and distributable) build.
#
# -fomit-frame-pointer is actually really important here. It helps
# a lot with our SBT code, since there are many tiny function calls.
#
# -O4 is like -O3, but includes link-time optimization on Mac OS.
# XXX: Currently, -O4 seems to break our GUI... not using it at the moment.
ifeq ($(REALLY_DEBUG_SIFTULATOR),1)
FLAGS += -g
BIN := siftulator-unoptimized
LOWERCASE_BIN := siftulator-unoptimized
else
FLAGS += -O3 -fomit-frame-pointer
endif
# Automatic dependency generation (*.d files)
FLAGS += -MMD
# Symbol table trimming
ifeq ($(BUILD_PLATFORM), Darwin)
LIBS += -Xlinker -unexported_symbol -Xlinker "*"
endif