Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. # Copyright (c) 2013-2016, Loïc Hoguin <essen@ninenines.eu>
  2. #
  3. # Permission to use, copy, modify, and/or distribute this software for any
  4. # purpose with or without fee is hereby granted, provided that the above
  5. # copyright notice and this permission notice appear in all copies.
  6. #
  7. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. WITHOUT ?=
  15. BUILD_CONFIG_FILE ?= $(CURDIR)/build.config
  16. ifeq ($(strip $(WITHOUT)),)
  17. BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE))
  18. else
  19. empty := $(subst ,, )
  20. BUILD_CONFIG = $(shell sed "s/\#.*//" $(BUILD_CONFIG_FILE) \
  21. | grep -v "^$(subst $(empty),\|^,$(WITHOUT))")
  22. endif
  23. ERLANG_MK ?= erlang.mk
  24. ERLANG_MK_VERSION = $(shell git describe --dirty --tags --always)
  25. .PHONY: all check
  26. all:
  27. # Temporarily force the printing of the CHANGELOG.
  28. # The required variable hadn't been introduced yet.
  29. #ifdef UPGRADE
  30. @cat CHANGELOG.asciidoc
  31. #endif
  32. @export LC_COLLATE=C; \
  33. awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \
  34. | sed 's/^ERLANG_MK_VERSION =.*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' \
  35. | sed 's:^ERLANG_MK_WITHOUT =.*:ERLANG_MK_WITHOUT = $(WITHOUT):' > $(ERLANG_MK)
  36. lint: all
  37. $(MAKE) -f erlang.mk --warn-undefined-variables
  38. ifdef p
  39. # Remove p from the list of variables since that conflicts with bootstrapping.
  40. MAKEOVERRIDES := $(filter-out p=$p,$(MAKEOVERRIDES))
  41. check:
  42. $(MAKE) -C test pkg-$p KEEP_BUILDS=1
  43. else
  44. ifdef hp
  45. check:
  46. $(MAKE) -C test hexpm-pkg-$(hp) KEEP_BUILDS=1 HEXPM=1
  47. else
  48. ifdef c
  49. check:
  50. $(MAKE) -C test $c c=
  51. else
  52. check:
  53. $(MAKE) -C test
  54. endif
  55. endif
  56. endif
  57. packages:
  58. $(MAKE) -C test packages
  59. hexpm-packages:
  60. $(MAKE) -C test hexpm-packages HEXPM=1
  61. summary:
  62. @mkdir -p test/logs/
  63. @touch test/logs/latest.log test/packages/errors.log
  64. -@sort test/packages/errors.log | diff test/logs/latest.log -
  65. @sort test/packages/errors.log > test/logs/latest.log
  66. @cp test/logs/latest.log "test/logs/$(shell date '+%F_%T%z')"
  67. search:
  68. @$(MAKE) --no-print-directory \
  69. -f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \
  70. search
  71. clean:
  72. $(MAKE) -C test clean
  73. rm -rf doc/guide.pdf doc/html
  74. git checkout erlang.mk
  75. docs:
  76. $(MAKE) -f core/core.mk -f core/docs.mk -f plugins/asciidoc.mk asciidoc DEPS=asciideck
  77. up:
  78. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  79. cd gh-pages && git checkout gh-pages
  80. cd gh-pages && make
  81. cd gh-pages && git push origin gh-pages
  82. rm -rf gh-pages
  83. ifdef file
  84. up-relx:
  85. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  86. cd gh-pages && git checkout gh-pages
  87. cp $(file) gh-pages/res/
  88. cd gh-pages && git add .
  89. cd gh-pages && git commit -m "Publish new Relx version"
  90. cd gh-pages && git push origin gh-pages
  91. rm -rf gh-pages
  92. else
  93. up-relx:
  94. @echo Missing parameter: url
  95. endif
  96. ifdef p
  97. XDG_DATA_HOME ?= $(HOME)/.local/share
  98. INSTALL_DIR ?= $(XDG_DATA_HOME)/erlang.mk/lib
  99. install: check
  100. for dep in `ls test/packages/$p_pkg/deps/`; do \
  101. rm -rf $(INSTALL_DIR)/$$dep; \
  102. mkdir -p $(INSTALL_DIR)/$$dep; \
  103. cp -r test/packages/$p_pkg/deps/$$dep/ebin $(INSTALL_DIR)/$$dep/; \
  104. if [ -d test/packages/$p_pkg/deps/$$dep/priv ]; then \
  105. cp -r test/packages/$p_pkg/deps/$$dep/priv $(INSTALL_DIR)/$$dep/; \
  106. fi; \
  107. done
  108. else
  109. install:
  110. @echo "Usage: $(MAKE) install p=<package name>"
  111. endif
  112. ifneq ($(strip $(LATEST_ERLANG_OTP)),)
  113. include core/kerl.mk
  114. endif