wireguard-setup/packer/Makefile

56 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2020-09-29 23:02:32 +02:00
#!/usr/bin/make -f
SHELL := /bin/sh
2022-03-02 22:24:50 +01:00
.SHELLFLAGS := -euc
2020-09-29 23:02:32 +02:00
PACKER := $(shell command -v packer 2>/dev/null)
PACKER_WORK_DIR := ./
PACKER_CACHE_DIR := ./packer_cache/
PACKER_HCLOUD_OUT := ./dist/hcloud/wireguard.log
PACKER_DIGITALOCEAN_OUT := ./dist/digitalocean/wireguard.log
PACKER_QEMU_OUT := ./dist/qemu/wireguard.qcow2
##################################################
## "all" target
##################################################
.PHONY: all
all: build
##################################################
## "build" target
##################################################
.PHONY: build
build: build-hcloud build-digitalocean build-qemu
.PHONY: build-hcloud
build-hcloud: $(PACKER_HCLOUD_OUT)
$(PACKER_HCLOUD_OUT):
mkdir -p '$(dir $(PACKER_HCLOUD_OUT))'
'$(PACKER)' build -force -only=hcloud.main '$(PACKER_WORK_DIR)' 2>&1 | tee '$(PACKER_HCLOUD_OUT)'
.PHONY: build-digitalocean
2020-11-21 21:40:46 +01:00
build-digitalocean: $(PACKER_DIGITALOCEAN_OUT)
2020-09-29 23:02:32 +02:00
$(PACKER_DIGITALOCEAN_OUT):
mkdir -p '$(dir $(PACKER_DIGITALOCEAN_OUT))'
'$(PACKER)' build -force -only=digitalocean.main '$(PACKER_WORK_DIR)' 2>&1 | tee '$(PACKER_DIGITALOCEAN_OUT)'
.PHONY: build-qemu
build-qemu: $(PACKER_QEMU_OUT)
$(PACKER_QEMU_OUT):
mkdir -p '$(dir $(PACKER_QEMU_OUT))'
'$(PACKER)' build -force -only=qemu.main '$(PACKER_WORK_DIR)'
##################################################
## "clean" target
##################################################
.PHONY: clean
clean:
rm -rf '$(PACKER_HCLOUD_OUT)' '$(PACKER_DIGITALOCEAN_OUT)' '$(PACKER_QEMU_OUT)' '$(PACKER_CACHE_DIR)'