Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. GITHUB := https://github.com
  2. ARCHIVE_EXT := tar.gz
  3. extract = tar -zxmf '${1}' ${2}
  4. # repo
  5. METALANG_REPO := Hirrolot/metalang99
  6. # version
  7. METALANG_VERSION := 1.13.3
  8. # headers
  9. METALANG_HEADERS := metalang99.h
  10. METALANG_HEADERS_ALL := ${METALANG_HEADERS} metalang99/
  11. #
  12. # archive
  13. METALANG_ARCHIVE_EXTRACTED := metalang99-${METALANG_VERSION}
  14. METALANG_ARCHIVE := ${METALANG_ARCHIVE_EXTRACTED}.${ARCHIVE_EXT}
  15. # url
  16. METALANG_URL := ${GITHUB}/${METALANG_REPO}/archive/v${METALANG_VERSION}.${ARCHIVE_EXT}
  17. HEADERS_ALL := ${METALANG_HEADERS_ALL}
  18. ARCHIVES_ALL := ${METALANG_ARCHIVE}
  19. DOWNLOADER ?= curl
  20. # download function should downlad file ${1} from url ${2}
  21. ifeq (${DOWNLOADER},curl)
  22. download = curl -Lo '${1}' -- '${2}'
  23. else # if curl
  24. ifeq (${DOWNLOADER},wget)
  25. download = wget -O '${1}' -- '${2}'
  26. endif # if wget
  27. endif # if curl
  28. .PHONY: all
  29. all: metalang
  30. .PHONY: metalang
  31. metalang: ${METALANG_HEADERS}
  32. ${METALANG_HEADERS}: ${METALANG_ARCHIVE}
  33. $(call extract,${<},\
  34. $(foreach _,\
  35. ${METALANG_HEADERS_ALL},\
  36. ${METALANG_ARCHIVE_EXTRACTED}/include/${_}))
  37. mv -v -- '${METALANG_ARCHIVE_EXTRACTED}/include'/* .
  38. rmdir -p -- '${METALANG_ARCHIVE_EXTRACTED}/include'
  39. define download_rule
  40. $${${1}_ARCHIVE}:
  41. $$(call download,$${@},$${${1}_URL})
  42. endef
  43. $(eval $(call download_rule,METALANG))
  44. .PHONY: clean
  45. clean:
  46. rm -rf -- ${HEADERS_ALL} ${ARCHIVES_ALL}