relx.mk 978 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright (c) 2013-2015, Loïc Hoguin <essen@ninenines.eu>
  2. # This file is part of erlang.mk and subject to the terms of the ISC License.
  3. .PHONY: relx-rel distclean-relx-rel distclean-relx
  4. # Configuration.
  5. RELX_CONFIG ?= $(CURDIR)/relx.config
  6. RELX ?= $(CURDIR)/relx
  7. export RELX
  8. RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.2.0/relx
  9. RELX_OPTS ?=
  10. RELX_OUTPUT_DIR ?= _rel
  11. ifeq ($(firstword $(RELX_OPTS)),-o)
  12. RELX_OUTPUT_DIR = $(word 2,$(RELX_OPTS))
  13. else
  14. RELX_OPTS += -o $(RELX_OUTPUT_DIR)
  15. endif
  16. # Core targets.
  17. ifneq ($(wildcard $(RELX_CONFIG)),)
  18. rel:: distclean-relx-rel relx-rel
  19. endif
  20. distclean:: distclean-relx-rel distclean-relx
  21. # Plugin-specific targets.
  22. define relx_fetch
  23. $(call core_http_get,$(RELX),$(RELX_URL))
  24. chmod +x $(RELX)
  25. endef
  26. $(RELX):
  27. @$(call relx_fetch)
  28. relx-rel: $(RELX)
  29. @$(RELX) -c $(RELX_CONFIG) $(RELX_OPTS)
  30. distclean-relx-rel:
  31. $(gen_verbose) rm -rf $(RELX_OUTPUT_DIR)
  32. distclean-relx:
  33. $(gen_verbose) rm -rf $(RELX)