-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathMakefile.globals
151 lines (129 loc) · 3.57 KB
/
Makefile.globals
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# This file gets included by platform (cam) builds
# and module builds.
#
# It should only contain things common for both.
# Parts shared within platform or module code, but no further,
# should be in platform/Makefile and modules/Makefile,
# respectively.
ifndef TOP_DIR
# don't error for tcc builds
ifndef TOP
$(error TOP_DIR not set - did you run or include this file from somewhere unexpected?)
endif
endif
ARM_BINPATH = /usr/bin
ARM_ABI = none-eabi
CROSS_COMPILE = $(ARM_BINPATH)/arm-$(ARM_ABI)-
HOST_CC = gcc
HOST_AR=$(shell which ar)
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
OBJCOPY = $(CROSS_COMPILE)objcopy
STRIP = $(CROSS_COMPILE)strip
STAT_CMD = stat -c "%n: %s bytes"
GREP = grep
READELF = readelf
AWK = awk
DATE = date -u
CP = cp
MV = mv
PYTHON = python3
PYTHON3 = python3
XOR_CHK=$(BUILD_TOOLS_DIR)/xor_chk
DIETLIB_VERSION=0.33
DIETLIBC_OPT_LEVEL=Os
NEWLIB_OPT_LEVEL=O3
NEWLIB_PATH=$(SRC_DIR)/libs/arm-$(ARM_ABI)-$(NEWLIB_OPT_LEVEL)
DIETLIBC_PATH=$(SRC_DIR)/libs/dietlib-$(DIETLIB_VERSION)-$(ARM_ABI)-$(DIETLIBC_OPT_LEVEL)
# Static libraries used
ARM_LIBGCC_A=$(shell $(CC) -print-libgcc-file-name)
NEWLIB_LIBM_A=$(NEWLIB_PATH)/libm.a
NEWLIB_LIBC_A=$(NEWLIB_PATH)/libc.a
DIETLIBC_A=$(DIETLIBC_PATH)/dietlibc.a
BUILD_TOOLS_DIR = $(TOP_DIR)/build_tools
MODULES_DIR = $(TOP_DIR)/modules
INSTALLER_FIR = ML-SETUP.FIR
ML_LIBC = dietlibc.a newlib-libc.a newlib-libm.a gcc-libgcc.a
CFLAGS = -Os -D__ARM__ \
-Wp,-MMD,$(patsubst %.o,%.d,$(dir $@)$(notdir $@)) \
-Wp,-MT,$@ \
-nostdlib \
-I$(TOP_DIR)/include \
-Wall \
-Wextra \
-Werror-implicit-function-declaration \
-Wdouble-promotion \
-Winline \
-Wundef \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-format \
-fomit-frame-pointer \
-fno-strict-aliasing \
-ffast-math \
-fsingle-precision-constant \
-fno-builtin-printf \
-fno-common \
-fno-extended-identifiers \
-std=gnu99 \
-I$(SRC_DIR) \
-ggdb3
CFLAGS += \
-DCONFIG_MAGICLANTERN=1 \
-DCONFIG_DEBUGMSG=$(CONFIG_DEBUGMSG) \
CDEPS_FLAGS = -MP -MD
ifeq ($(CONFIG_QEMU),y)
CFLAGS += -DCONFIG_QEMU
endif
# Allow devs to make warnings break builds
ifeq ($(FATAL_WARNINGS),y)
CFLAGS += -Werror
endif
ifeq ($(CONFIG_GDB),y)
CFLAGS += -DCONFIG_GDB
ML_OBJS += $(BUILD_DIR)/gdb.o
endif
ifeq ($(CONFIG_GDBSTUB),y)
CFLAGS += -DCONFIG_GDB -DCONFIG_GDBSTUB
endif
# This looks like some PTP client-server hack allowing
# USB control of ML including some debug functionality.
ifeq ($(CONFIG_PTP),y)
CFLAGS += -DCONFIG_PTP
ML_OBJS += $(BUILD_DIR)/ptp.o
endif
ifeq ($(CONFIG_PTP_CHDK),y)
ML_OBJS += $(BUILD_DIR)/ptp-chdk.o
endif
ifeq ($(CONFIG_PTP_ML),y)
ML_OBJS += $(BUILD_DIR)/ptp-ml.o
endif
ifeq ($(CONFIG_CONSOLE),y)
CFLAGS += -DCONFIG_CONSOLE
ML_OBJS += $(BUILD_DIR)/console.o
endif
ifeq ($(CONFIG_TCC),y)
ifneq ($(CONFIG_CONSOLE),y)
$(error CONFIG_TCC requires CONFIG_CONSOLE = y, please enable it)
endif
CFLAGS += -DCONFIG_TCC
ML_OBJS += $(BUILD_DIR)/tcc-glue.o \
$(BUILD_DIR)/tcc/libtccx.o
endif
ifeq ($(CONFIG_TINYPY),y)
LFLAGS += -u pow -u qsort -u strstr -u atof
endif
# This var is sometimes set on a per cam basis,
# we don't want to use it uninit
ifdef CONFIG_LVAPP_HACK_RELOC
ifeq ($(CONFIG_LVAPP_HACK_RELOC),y)
ML_OBJS += $(BUILD_DIR)/liveview.o $(BUILD_DIR)/reloc.o
endif
endif
# evaluate once and only when used
# https://stackoverflow.com/a/28542922
# example: FOO = $(call eval_once,FOO,$(shell command))
define eval_once
$(eval $1 := $2)$(value $1)
endef