-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (63 loc) · 2.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
##
## Top-level makefile for example (template) VM
##
# First, define VM framework's directory & include it!
# Our example is a subdirectory inside framework's dir!
FRAMEWORK_DIR ?= ..
# TODO: you might want it to point to the submodule's subdirectory:
#FRAMEWORK_DIR ?= ./framework
# you can also modify USER_CONFIG_DIR (where config.local.mk is loaded from)
USER_CONFIG_DIR = ..
# Include framework + all libraries / layers
include $(FRAMEWORK_DIR)/framework.mk
include $(FRAMEWORK_DIR)/lib/inc_all.mk
# set default goals
DEFAULT_GOAL = main
INIT_GOAL = main
# Ubuntu Server 22.04 base VM
$(call vm_new_base_ubuntu,base)
base-ver = 22
# example versioning & unified prefix scheme
vm-ver = 2024.01
vm-prefix = example_$(vm-ver)
# Example generic VM with customizations
# [re]build with `make main_clean main`
$(call vm_new_layer_generic,main)
main-name = $(vm-prefix)_main
# always update scripts from framework (prevent re-building base on changes)
main-copy-scripts = $(abspath $(FRAMEWORK_DIR)/scripts)/
main-copy-scripts += $(abspath ./main/scripts)/
# the generic layer allows us to specify custom environment variables, but it
# has a special format (comma-separated quoted strings):
main-extra-envs += "VM_EXAMPLE=TEST", "VM_TEST=New Test",
main-extra-envs += "VM_TEST=New Test",
# Example VM starting from the full-featured layer
# [re]build with `make full_clean full`
$(call vm_new_layer_full_featured,full)
full-name = $(vm-prefix)_full
# same as above, include scripts from framework, full layer + our own overrides
full-copy-scripts = $(abspath $(FRAMEWORK_DIR)/scripts)/
full-copy-scripts += $(VM_FULL_FEATURED_SCRIPTS_DIR)
# also add our main scripts (since we can ;) )
full-copy-scripts += $(abspath ./main/scripts)/
# Export the main VM to both VirtualBox & VMware using the ComboVM rules
# [re]build with `make exported_clean exported`
exported-name = $(vm-prefix)_exported
# must change the target's type to `vm-combo` for combo export rules
exported-type = vm-combo
exported-vmname = Example ComboVM
exported-src-from = main
# Cloud image based on full VM
# [re]build with `make full_cloud_clean full_cloud`
$(call vm_new_layer_cloud,full_cloud)
full_cloud-name = $(vm-prefix)_full_cloud
full_cloud-src-from = full
full_cloud-copy-scripts = $(abspath $(FRAMEWORK_DIR)/scripts)/
full_cloud-copy-scripts += $(VM_CLOUD_SCRIPTS_DIR)
full_cloud-copy-scripts += $(abspath ./cloud/script-overrides)/
# use `make full_cloud_compact` to run zerofree on its image
full_cloud-extra-rules += $(vm_zerofree_rule)
# List of targets to generate rules for (note: must manually order them
# topologically, i.e. build dependencies before their targets)
build-vms = base main full exported full_cloud
$(call vm_eval_all_rules)