-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
60 lines (47 loc) · 1.68 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
55
56
57
58
59
60
TOP := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
TOOLS_DIR := $(TOP)tools
TWOLITER_DIR := $(TOOLS_DIR)/twoliter
TWOLITER := $(TWOLITER_DIR)/twoliter
CARGO_HOME := $(TOP).cargo
TWOLITER_VERSION ?= "0.6.0"
TWOLITER_SHA256_AARCH64 ?= "73a961ff8b9e829b764a86e096b9c2630b452dadc2099f678d57b2146f6a18f9"
TWOLITER_SHA256_X86_64 ?= "739c5ed0bbd9b0f50ca641964e03b1a92ae9b2c814b1c3463e22f54bc8968e35"
KIT ?= bottlerocket-kernel-kit
UNAME_ARCH = $(shell uname -m)
ARCH ?= $(UNAME_ARCH)
VENDOR ?= bottlerocket
ifeq ($(UNAME_ARCH), aarch64)
TWOLITER_SHA256=$(TWOLITER_SHA256_AARCH64)
else
TWOLITER_SHA256=$(TWOLITER_SHA256_X86_64)
endif
all: build
prep:
@mkdir -p $(TWOLITER_DIR)
@mkdir -p $(CARGO_HOME)
@$(TOOLS_DIR)/install-twoliter.sh \
--repo "https://github.com/bottlerocket-os/twoliter" \
--version v$(TWOLITER_VERSION) \
--directory $(TWOLITER_DIR) \
--reuse-existing-install \
--allow-binary-install $(TWOLITER_SHA256) \
--allow-from-source
update: prep
@$(TWOLITER) update
fetch: prep
@$(TWOLITER) fetch --arch $(ARCH)
build: fetch
@$(TWOLITER) build kit $(KIT) --arch $(ARCH)
publish: prep
@$(TWOLITER) publish kit $(KIT) $(VENDOR)
TWOLITER_MAKE = $(TWOLITER) make --cargo-home $(CARGO_HOME) --arch $(ARCH)
# Treat any targets after "make twoliter" as arguments to "twoliter make".
ifeq (twoliter,$(firstword $(MAKECMDGOALS)))
TWOLITER_MAKE_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(TWOLITER_MAKE_ARGS):;@:)
endif
# Transform "make twoliter" into "twoliter make", for access to tasks that are
# only available through the embedded Makefile.toml.
twoliter: prep
@$(TWOLITER_MAKE) $(TWOLITER_MAKE_ARGS)
.PHONY: prep update fetch build publish twoliter