-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
31 lines (26 loc) · 887 Bytes
/
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
BUILDER_TYPES = virtualbox
TEMPLATE_DIRS := $(wildcard template/*)
TEMPLATE_FILES := $(patsubst %, %/template.json, ${TEMPLATE_DIRS})
BOX_FILENAMES := $(patsubst template/%, %.box, ${TEMPLATE_DIRS})
BOX_FILES := $(foreach builder, $(BUILDER_TYPES), $(foreach box_filename, $(BOX_FILENAMES), $(builder)/$(box_filename)))
RM = rm -f
.PHONY: all
all: $(BOX_FILES)
virtualbox/%.box: template/%/template.json
cp variables.json $(dir $<)variables.json
cd $(dir $<); \
rm -rf output-virtualbox; \
mkdir -p ../../virtualbox; \
packer build -var-file=../../variables.json -only=virtualbox $(notdir $<)
.PHONY: list
list:
@for builder in $(BUILDER_TYPES) ; do \
for box_filename in $(BOX_FILENAMES) ; do \
echo $$builder/$$box_filename ; \
done ; \
done
variables:
./script/create_env.py
.PHONY: clean
clean:
$(foreach builder_type,$(BUILDER_TYPES),$(RM) -r $(builder_type);)