-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (34 loc) · 1.04 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
FILES := '*.c' '*.h'
FORMAT := clang-format
IMAGE = alpine
VM_DIR = vagrant
VM_NAME := Kernel
.DEFAULT_GOAL := help
.ONESHELL:
help:
@echo "Usage: make <target> IMAGE=<image>"
@echo "Targets:"
@echo " help Display this help message"
@echo " base Deploy base VM for specified image. Default is Alpine"
@echo " build Deploy VM and build kernel with defconfig for specified image"
@echo " custom Deploy VM with misc tools for specified image"
@echo " all Execute base, build, and custom for specified image"
@echo " format Format all .c, .h files with clang-format"
@echo "Example:"
@echo " make build IMAGE=arch"
base:
@cd $(VM_DIR)/$(IMAGE)
@vagrant up
@vagrant halt
build:
@cd $(VM_DIR)/$(IMAGE)
@export VAGRANT_KERNEL=true && vagrant up --provision
@vagrant halt
custom:
@cd $(VM_DIR)/$(IMAGE)
@export VAGRANT_CUSTOM=true && vagrant up --provision
@vagrant halt
all: base build custom
format:
git ls-files $(FILES) | xargs $(FORMAT) -i
.PHONY: help base build custom all format