-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
49 lines (42 loc) · 1.31 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
.DEFAULT_GOAL = help
.SHELL = bash
.PHONY: require-%
## Used as dependency with other targets to ensure variables are available in the environment
require-%:
@if [ "${${*}}" = "" ]; then \
echo "ERROR: Environment variable not set: \"$*\""; \
exit 1; \
fi
PACKER_TEMPLATE = windows_2019.json
BOX_NAME = windows_2019_virtualbox
BOX_FILE = windows_2019_virtualbox.box
VAGRANT_TEMPLATE = vagrantfile-windows_2019.template
.PHONY: packer-build-box
## Use Packer to build an windows vagrant box based on windows server 2019
packer-build-box:
@packer build $(PACKER_TEMPLATE)
.PHONY: vagrant-add-box
## Add the box to vagrant
vagrant-add-box:
@vagrant box add $(BOX_NAME) $(BOX_FILE)
.PHONY: vagrant-init
## Initilize Vagrant with the target box using our template
make vagrant-init:
@vagrant init --template $(VAGRANT_TEMPLATE) $(BOX_NAME)
.PHONY: vagrant-up
## Start the Vagrant box
make vagrant-up:
@vagrant up
.PHONY: help
## Show help screen.
help:
@echo "Please use \`make <target>' where <target> is one of\n\n"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf "%-30s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)