Skip to content

Commit

Permalink
Simplify makefile, make build_only work when set to any value.
Browse files Browse the repository at this point in the history
  • Loading branch information
JosBritton committed Oct 8, 2023
1 parent a9f7133 commit e325841
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ SHELL := /usr/bin/env sh

-include config/config.mak

build_only ?= 0
build_only=

platform_ve ?= proxmox
parallel_builds ?= $(shell nproc || sysctl -n hw.ncpu || echo 1)

Expand All @@ -12,14 +13,6 @@ ifeq ($(ansible_groups),)
$(error ansible_groups is not defined)
endif

define assert_boolean
$(if $(filter 1 0,$(value $(1))),,\
$(error $(1) is not a boolean value (1 or 0))\
)
endef

$(call assert_boolean,build_only)

post_build_targets = $(foreach group,$(sort $(ansible_groups)),phony/$(group)/post_build)

all: $(sort $(ansible_groups))
Expand All @@ -31,7 +24,7 @@ sources = main.pkr.hcl sources.pkr.hcl variables.pkr.hcl \

# allow build aliases for ansible groups and optionally skipping post-build tasks
$(ansible_groups): %: output/%/packer-kvm.img \
$(if $(filter 0,$(build_only)),phony/%/post_build)
$(if $(build_only),,phony/%/post_build)

.SECONDARY: output/%/packer-kvm.img
output/%/packer-kvm.img: $(sources) config/ansible/%.yaml \
Expand Down

0 comments on commit e325841

Please sign in to comment.