forked from Omega-Numworks/Omega
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules.mk
82 lines (71 loc) · 1.68 KB
/
rules.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Define standard compilation rules
$(eval $(call rule_for, \
AS, %.o, %.s, \
$$(CC) $$(SFLAGS) -c $$< -o $$@, \
global local \
))
$(eval $(call rule_for, \
CC, %.o, %.c, \
$$(CC) $$(CFLAGS) $$(SFLAGS) -c $$< -o $$@, \
global local \
))
$(eval $(call rule_for, \
CPP, %, %.inc, \
$$(CPP) -P $$< $$@, \
global \
))
$(eval $(call rule_for, \
CXX, %.o, %.cpp, \
$$(CXX) $$(CXXFLAGS) $$(SFLAGS) -c $$< -o $$@, \
global local \
))
$(eval $(call rule_for, \
DFUSE, %.dfu, %.elf, \
$$(PYTHON) build/device/elf2dfu.py $$< $$@, \
local \
))
$(eval $(call rule_for, \
OBJCOPY, %.hex, %.elf, \
$$(OBJCOPY) -O ihex $$< $$@, \
local \
))
$(eval $(call rule_for, \
OBJCOPY, %.bin, %.elf, \
$$(OBJCOPY) -O binary $$< $$@, \
local \
))
$(eval $(call rule_for, \
OCC, %.o, %.m, \
$$(CC) $$(CFLAGS) $$(SFLAGS) -c $$< -o $$@, \
global \
))
$(eval $(call rule_for, \
OCC, %.o, %.mm, \
$$(CXX) $$(CXXFLAGS) $$(SFLAGS) -c $$< -o $$@, \
global \
))
$(eval $(call rule_for, \
WINDRES, %.o, %.rc, \
$$(WINDRES) $$(WRFLAGS) $$< -O coff -o $$@, \
global \
))
ifdef EXE
ifeq ($(OS),Windows_NT)
# Work around command-line length limit
# On Msys2 the max command line is 32 000 characters. Our standard LD command
# can be longer than that because we have quite a lot of object files. To work
# around this issue, we write the object list in a "target.objs" file, and tell
# the linker to read its arguments from this file.
$(eval $(call rule_for, \
LD, %.$$(EXE), , \
echo $$^ > [email protected] && $$(LD) @[email protected] $$(LDFLAGS) -o $$@ && rm [email protected], \
global \
))
else
$(eval $(call rule_for, \
LD, %.$$(EXE), , \
$$(LD) $$^ $$(LDFLAGS) -o $$@, \
global \
))
endif
endif