-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuildNative.mk
executable file
·59 lines (47 loc) · 1.33 KB
/
BuildNative.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
53
54
55
56
57
58
59
CC := gcc
AR := ar
OBJ-COPY := objcopy
OBJ-DUMP := objdump
OPTIONAL_SIZE_COMMAND :=
BASE_FLAGS := \
-std=gnu99 \
-fshort-enums \
-Wall \
-Wno-missing-braces # Generated in Unity/unity.c
# Compile & assemble, do not link yet
CFLAGS := $(BASE_FLAGS) -c
ifneq ($(NOOPT), true)
ifeq ($(SPEED), true)
CFLAGS += -O3
else
CFLAGS += -Os
endif
endif
ifeq ($(DEBUG), true)
CFLAGS += -g3
endif
LIB_SUFFIX := a
ifeq ($(OS),Windows_NT)
TARGET_SUFFIX := exe
else
TARGET_SUFFIX := out
endif
# the start-group/end-group flags cause the linker to handle circular dependencies.
# The objects/libraries are scanned multiple times, until all dependencies are resolved. Link-time is increased, but this is the only way.
LDFLAGS_START := -Wl,--start-group
ifneq ($(filter arm%,$(shell uname -m)),)
LDFLAGS_START := -Wl,--no-enum-size-warning $(LDFLAGS_START)
endif
# This part of the linker flags is split off to include the objects of the current project into the start-group/end-group closure
LDFLAGS_END := -Wl,--end-group -lm
DEPENDENCY_FLAGS := $(BASE_FLAGS) -MM
ARFLAGS := rcs
# Time: 670ms (!)
%.lss: %.$(TARGET_SUFFIX)
$(OBJ-DUMP) -h -S $< > $@
lss_$(project): $(foreach o, $(outputs), $(BUILDDIR)/$o.lss)
ifneq ($(LIBRARY), true)
ifeq ($(LSS), true)
$(project): lss_$(project)
endif
endif