diff options
author | Manuel Messner | 2018-05-04 15:02:34 +0200 |
---|---|---|
committer | Manuel Messner | 2018-05-04 15:50:06 +0200 |
commit | 874d3dfbdd9f6a8a8a158b53f714b8dbce7bfe1b (patch) | |
tree | 84230bad9873618df4401716ab5aa12627fd58e9 /Makefile | |
parent | Makefile: differentiate between ISO and provisioning builders (diff) | |
download | packer-templates-874d3dfbdd9f6a8a8a158b53f714b8dbce7bfe1b.tar.gz packer-templates-874d3dfbdd9f6a8a8a158b53f714b8dbce7bfe1b.tar.xz packer-templates-874d3dfbdd9f6a8a8a158b53f714b8dbce7bfe1b.zip |
Makefile: simplify provisioner and builder selection
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -24,19 +24,23 @@ BUILDER_VIRTUALBOX_PROV := virtualbox-ovf BUILDERS := QEMU VMWARE VIRTUALBOX -ifndef BUILDER - $(foreach cur, $(BUILDERS),\ - $(if $(shell command -v $(BUILDER_$(cur)_EXE)),\ - $(eval AVAILABLE_BUILDERS += $(BUILDER_$(cur)_NAME)))) - BUILDER := $(firstword $(AVAILABLE_BUILDERS)) -endif +$(foreach cur, $(BUILDERS),\ + $(if $(shell command -v $(BUILDER_$(cur)_EXE)),\ + $(eval AVAILABLE_BUILDERS += $(cur)))) -ifndef PROVISIONER - $(foreach cur, $(BUILDERS),\ - $(if $(filter $(BUILDER),$(BUILDER_$(cur)_NAME)),\ - $(eval PROVISIONER := $(BUILDER_$(cur)_PROV)))) -endif + +# If now BUILDER or PROVISIONER was specified on the command line, take the +# first available one; otherwise use that specified one. +BUILDER_SELECTED := $(strip $(if $(filter $(BUILDER),$(AVAILABLE_BUILDERS)),\ + $(BUILDER),\ + $(firstword $(AVAILABLE_BUILDERS)))) +PROVISIONER_SELECTED := $(strip $(if $(filter $(PROVISIONER),$(AVAILABLE_BUILDERS)),\ + $(PROVISIONER),\ + $(BUILDER_SELECTED))) + +override BUILDER = $(BUILDER_$(BUILDER_SELECTED)_NAME) +override PROVISIONER = $(BUILDER_$(PROVISIONER_SELECTED)_PROV) # The packer templates, detected as *.json (excluding base.json) |