From 655ef46f50d95209c39da1aa26a2d1c520b77193 Mon Sep 17 00:00:00 2001 From: Kenny Ballou Date: Mon, 9 Apr 2018 21:50:35 -0600 Subject: Add cloudformation templates and tooling Blag will be managed using cloudfront/S3/lambdaedge, specified via cloudformation. Signed-off-by: Kenny Ballou --- Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2acd93f --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +PROJROOT:=$(git rev-parse --show-toplevel) + +AG:=autogen +JQ:=jq +JQ_OPTIONS:= +REGION?=us-east-1 +BUILD_DIR:=_build/$(REGION) +VERBOSE?=0 + +ifeq ($(VERBOSE),1) + VFILTER := +else + VFILTER :=>/dev/null +endif + +SOURCE_TEMPLATES:=$(wildcard stacks/*.tpl) +SOURCE_PARAMS:=$(wildcard params/*.tpl) +TEMPLATES:=$(patsubst %.tpl, $(BUILD_DIR)/%.template, $(SOURCE_TEMPLATES)) +STACK_PARAMS:=$(patsubst %.tpl, $(BUILD_DIR)/%.params, $(SOURCE_PARAMS)) + +SOURCES:=$(shell find stacks/ -type f -name '*.in') + +.PHONY: all +all: autogen/stack.def \ + $(TEMPLATES) \ + $(STACK_PARAMS) + +autogen/stack.def: autogen/stack.def.in + cat $^ > $@ + +$(BUILD_DIR)/%.json: %.tpl $(SOURCES) + mkdir -p $(dir $@) + $(AG) --override-tpl=$< --definitions=autogen/stack.def > $@ + +$(BUILD_DIR)/%.template: $(BUILD_DIR)/%.json + $(JQ) . $< > $@ + +$(BUILD_DIR)/%.params: $(BUILD_DIR)/%.json + $(JQ) '.' $< > $@ + +.PHONY: clean +clean: + -rm -r $(BUILD_DIR) -- cgit v1.2.1