forked from kata-containers/osbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (48 loc) · 1.63 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
61
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
DISTRO ?= centos
DISTRO_ROOTFS := $(PWD)/$(DISTRO)_rootfs
DISTRO_ROOTFS_MARKER := .$(shell basename $(DISTRO_ROOTFS)).done
IMAGE := kata-containers.img
INITRD_IMAGE := kata-containers-initrd.img
IMG_SIZE=500
AGENT_INIT ?= no
VERSION_FILE := ./VERSION
VERSION := $(shell grep -v ^\# $(VERSION_FILE))
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
COMMIT := $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO})
VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
.PHONY: all
all: image initrd
.PHONY: rootfs
rootfs: $(DISTRO_ROOTFS_MARKER)
$(DISTRO_ROOTFS_MARKER):
@echo Creating rootfs based on "$(DISTRO)"
"$(MK_DIR)/rootfs-builder/rootfs.sh" -o $(VERSION_COMMIT) -r $(DISTRO_ROOTFS) $(DISTRO)
touch $@
.PHONY: image
image: $(IMAGE)
$(IMAGE): rootfs
@echo Creating image based on "$(DISTRO_ROOTFS)"
"$(MK_DIR)/image-builder/image_builder.sh" -s "$(IMG_SIZE)" "$(DISTRO_ROOTFS)"
.PHONY: initrd
initrd: $(INITRD_IMAGE)
$(INITRD_IMAGE): rootfs
@echo Creating initrd image based on "$(DISTRO_ROOTFS)"
"$(MK_DIR)/initrd-builder/initrd_builder.sh" "$(DISTRO_ROOTFS)"
.PHONY: test
test:
"$(MK_DIR)/tests/test_images.sh" "$(DISTRO)"
.PHONY: test-image-only
test-image-only:
"$(MK_DIR)/tests/test_images.sh" --test-images-only "$(DISTRO)"
.PHONY: test-initrd-only
test-initrd-only:
"$(MK_DIR)/tests/test_images.sh" --test-initrds-only "$(DISTRO)"
.PHONY: clean
clean:
rm -rf $(DISTRO_ROOTFS_MARKER) $(DISTRO_ROOTFS) $(IMAGE) $(INITRD_IMAGE)