-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
55 lines (41 loc) · 1.3 KB
/
Makefile
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
# various configurations
ARCH = cortex-m4
BUILDDIR = target/$(TARGET)/release/
PACKAGE_NAME ?= tock-template
TARGET = thumbv7em-tock-eabi
# verbose/quiet mode. If environment variable V is non-empty, be verbose
ifneq ($(V),)
Q=
VERBOSE = --verbose
else
Q=@
VERBOSE =
endif
# create_tab script
CREATE_TAB ?= tools/tab/create_tab.py
# ELF2TBF tool and arguments
ELF2TBF ?= cargo run --manifest-path tools/elf2tbf/Cargo.toml --
ELF2TBF_ARGS += -n $(PACKAGE_NAME)
# xargo tool
XARGO ?= xargo
# build rules
.PHONY: all
all: $(BUILDDIR)/$(PACKAGE_NAME).tab
# Make can't reasonably find all dependencies (i.e. changhing Cargo.toml
# requires a rebuild), just let xargo do it's job every time
.PHONY: FORCE_XARGO
.PHONY: clean
clean:
$(Q)$(XARGO) clean $(VERBOSE)
.PHONY: debug
debug:
@echo Sorry, relocation-aware debug information is only available for the
@echo C runtime presently. Apologies for the misleading kernel message
$(BUILDDIR)/$(PACKAGE_NAME): src/main.rs FORCE_XARGO
$(Q)$(XARGO) build --target $(TARGET) $(VERBOSE) --release
$(BUILDDIR)/$(PACKAGE_NAME).elf: $(BUILDDIR)/$(PACKAGE_NAME)
$(Q)cp $< $@
$(BUILDDIR)/$(ARCH).bin: $(BUILDDIR)/$(PACKAGE_NAME).elf
$(Q)$(ELF2TBF) $(ELF2TBF_ARGS) -o $@ $< $(VERBOSE)
$(BUILDDIR)/$(PACKAGE_NAME).tab: $(BUILDDIR)/$(ARCH).bin
$(Q)$(CREATE_TAB) $@ $(PACKAGE_NAME) $^