-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (59 loc) · 2.03 KB
/
Makefile
File metadata and controls
81 lines (59 loc) · 2.03 KB
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
include vars.mk
all: tools
# ================= Build Tools =================
OUTPUT_FILE := firmware/firmware.bin
BUILD_DIR ?= tmp/firmware
ifneq (,$(PROFILE))
PROFILE_MAIN := $(patsubst %-devel,%,$(PROFILE))
OVERLAYS += $(wildcard overlays/common/*/)
OVERLAYS += $(wildcard overlays/firmware-$(PROFILE_MAIN)/*/)
ifneq ($(filter %-devel,$(PROFILE)),)
OVERLAYS += $(wildcard overlays/devel/*/)
endif
endif
PROFILES := $(patsubst overlays/firmware-%,%,$(wildcard overlays/firmware-*))
PROFILES += $(patsubst overlays/firmware-%,%-devel,$(wildcard overlays/firmware-*))
$(OUTPUT_FILE): firmware/$(FIRMWARE_FILE) tools
ifeq (,$(PROFILE))
@echo "Please specify a profile using 'make PROFILE=<profile_name>'. Available profiles are: $(PROFILES)."
@exit 1
else ifeq (,$(filter $(PROFILE_MAIN),$(PROFILES)))
@echo "Invalid profile '$(PROFILE_MAIN)'. Available profiles are: $(PROFILES)."
@exit 1
endif
./scripts/create_firmware.sh $< $(BUILD_DIR) $@ $(OVERLAYS)
.PHONY: build
build: $(OUTPUT_FILE)
EXTRACT_DIR := tmp/extracted
.PHONY: extract
extract: firmware/$(FIRMWARE_FILE) tools
./scripts/extract_squashfs.sh $< $(EXTRACT_DIR)
.PHONY: overlays
overlays:
@echo $(OVERLAYS)
.PHONY: profiles
profiles:
@echo "Available profiles: $(PROFILES)"
# ================= Tools =================
.PHONY: tools
tools: tools/rk2918_tools tools/upfile tools/resource_tool
tools/%: FORCE
make -C $@
# =============== Firmware ===============
.PHONY: firmware
firmware: firmware/$(FIRMWARE_FILE)
firmware/$(FIRMWARE_FILE):
@mkdir -p firmware
wget -O $@.tmp "https://public.resource.snapmaker.com/firmware/U1/$(FIRMWARE_FILE)"
echo "$(FIRMWARE_SHA256) $@.tmp" | sha256sum -c --quiet
mv $@.tmp $@
# ================= Test =================
test: firmware/$(FIRMWARE_FILE)
make -C tools test FIRMWARE_FILE=$(CURDIR)/firmware/$(FIRMWARE_FILE)
# ================= Helpers =================
.PHONY: changelog
changelog:
@echo "## Changes since last release\n"
@git log $$(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s (%h) by @%an"
.PHONY: FORCE
FORCE: