makefilet-download-ondemand.mk 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. # include this makefile snippet for automatic discovery of a:
  2. # * system-wide 'makefilet' installation (e.g. via the deb package)
  3. # * project-wide inclusion as a git-submodule (or code copy)
  4. # * on-demand download (temporarily stored in the local 'build/' directory)
  5. # alternative version: "master" (the tip of the current development branch)
  6. MAKEFILET_DOWNLOAD_VERSION ?= v0.7.3
  7. MAKEFILET_DOWNLOAD_URL ?= https://notabug.org/sumpfralle/makefilet/archive/$(MAKEFILET_DOWNLOAD_VERSION).tar.gz
  8. # first attempt: system-wide installation (e.g. deb package) or submodule of this project?
  9. -include makefilet/main.mk
  10. ifndef DIR_MAKEFILET
  11. # we failed - it is not available globally or as a submodule
  12. # second attempt: include a downloaded makefilet archive
  13. DIR_BUILD ?= build
  14. DIR_MAKEFILET_DOWNLOAD = $(DIR_BUILD)/makefilet
  15. -include $(DIR_MAKEFILET_DOWNLOAD)/main.mk
  16. ifndef DIR_MAKEFILET
  17. # third attempt: download and extract a known release
  18. $(info Downloading 'makefilet' ...)
  19. $(shell mkdir -p "$(DIR_MAKEFILET_DOWNLOAD)" \
  20. && wget --no-verbose --output-document - "$(MAKEFILET_DOWNLOAD_URL)" \
  21. | tar -xz -C "$(DIR_MAKEFILET_DOWNLOAD)" --strip-components=1 -f -)
  22. # last include attempt
  23. -include $(DIR_MAKEFILET_DOWNLOAD)/main.mk
  24. ifndef DIR_MAKEFILET
  25. $(error Failed to initialize 'makefilet'. It seems like it is neither installed system-wide, as a submodule or available via download.)
  26. endif
  27. endif
  28. endif