-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (68 loc) · 2.56 KB
/
Makefile
File metadata and controls
84 lines (68 loc) · 2.56 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
82
83
84
# stereOS Makefile
# "$ make help" to see available targets
#
# Based around the auto-documented Makefile:
# http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
# -- Image builds ------------------------------------------------------------
#
# The "ARCH" env var must be specified for image builds.
MIXTAPE ?= coder
ARCH ?=
SSH_PORT ?= 2222
define require-arch
$(if $(ARCH),,$(error ARCH is required. Use ARCH=aarch64-linux or ARCH=x86_64-linux))
endef
.PHONY: dist
dist: ## Build all formats and assemble dist/ for publishing
$(call require-arch)
nix build .#packages.$(ARCH).$(MIXTAPE)-dist --impure
.PHONY: build
build: ## Build the default base mixtape (raw image)
$(call require-arch)
nix build .#packages.$(ARCH).$(MIXTAPE) --impure
.PHONY: build-qcow2
build-qcow2: ## Build the default mixtape (qcow2 image)
$(call require-arch)
nix build .#packages.$(ARCH).$(MIXTAPE)-qcow2 --impure
.PHONY: build-kernel
build-kernel: ## Build kernel artifacts for kernel boot
$(call require-arch)
nix build .#packages.$(ARCH).$(MIXTAPE)-kernel-artifacts --impure
# -- VM development operations ------------------------------------------------
.PHONY: run
run: ## Launch the built qcow2 image in QEMU (auto-builds kernel artifacts for direct boot)
@if [ ! -f result/stereos.qcow2 ]; then \
echo "No qcow2 image found. Building..."; \
$(MAKE) build-qcow2; \
fi
@if [ ! -f result-kernel/bzImage ]; then \
echo "No kernel artifacts found. Building for direct boot..."; \
$(MAKE) build-kernel; \
fi
./scripts/run-vm.sh result/stereos.qcow2 $(SSH_PORT)
.PHONY: ssh-admin
ssh-admin: ## SSH into the running VM as admin
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $(SSH_PORT) admin@localhost
.PHONY: ssh-agent
ssh-agent: ## SSH into the running VM as agent
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p $(SSH_PORT) agent@localhost
# -- Dagger -------------------------------------------------------------------
.PHONY: dagger-check
dagger-check: ## Run Dagger CI checks
dagger check
# -- Utilities ----------------------------------------------------------------
.PHONY: help
.DEFAULT_GOAL := help
help: ## Show this help message
@echo "stereOS development targets:"
@echo ""
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo "Build development env variables:"
@echo " MIXTAPE=$(MIXTAPE)"
@echo " ARCH=$(ARCH)"
@echo " SSH_PORT=$(SSH_PORT)"
define print-target
@printf "Executing target: \033[36m$@\033[0m\n"
endef