Makefile 666 B

123456789101112131415161718
  1. # AMI IDs
  2. AMITARGETS=indexer.ami.id
  3. PACKER=/usr/local/bin/packer
  4. all: $(AMITARGETS)
  5. %.ami.id: %.json scripts/* ephemeral_init/* configs/*
  6. $(eval VPC_ID=$(shell cd ../2.network && terraform output vpc_id))
  7. $(eval SUBNET_ID=$(shell cd ../2.network && terraform output subnet0_id))
  8. $(PACKER) validate -var "vpc_id=$(VPC_ID)" -var "subnet_id=$(SUBNET_ID)" $<
  9. $(PACKER) inspect $<
  10. $(PACKER) build -var "vpc_id=$(VPC_ID)" -var "subnet_id=$(SUBNET_ID)" $< 2>&1 | tee $(basename $(notdir $<)).log
  11. tail -2 $(basename $(notdir $<)).log | head -2 | awk 'match($$0, /ami-.*/) { print substr($$0, RSTART, RLENGTH) }' > $@
  12. clean:
  13. -rm $(AMITARGETS)
  14. -rm *.log
  15. -rm *.tmp