Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 c
  45. check:
  46. $(MAKE) -C test $c c=
  47. else
  48. check:
  49. $(MAKE) -C test
  50. endif
  51. endif
  52. packages:
  53. $(MAKE) -C test packages
  54. summary:
  55. @mkdir -p test/logs/
  56. @touch test/logs/latest.log test/packages/errors.log
  57. -@sort test/packages/errors.log | diff test/logs/latest.log -
  58. @sort test/packages/errors.log > test/logs/latest.log
  59. @cp test/logs/latest.log "test/logs/$(shell date '+%F_%T%z')"
  60. search:
  61. @$(MAKE) --no-print-directory \
  62. -f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \
  63. search
  64. clean:
  65. $(MAKE) -C test clean
  66. rm -rf doc/guide.pdf doc/html
  67. git checkout erlang.mk
  68. docs:
  69. $(MAKE) -f core/core.mk -f core/docs.mk -f plugins/asciidoc.mk asciidoc DEPS=asciideck
  70. up:
  71. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  72. cd gh-pages && git checkout gh-pages
  73. cd gh-pages && make
  74. cd gh-pages && git push origin gh-pages
  75. rm -rf gh-pages
  76. ifdef file
  77. up-relx:
  78. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  79. cd gh-pages && git checkout gh-pages
  80. cp $(file) gh-pages/res/
  81. cd gh-pages && git add .
  82. cd gh-pages && git commit -m "Publish new Relx version"
  83. cd gh-pages && git push origin gh-pages
  84. rm -rf gh-pages
  85. else
  86. up-relx:
  87. @echo Missing parameter: url
  88. endif
  89. ifdef p
  90. XDG_DATA_HOME ?= $(HOME)/.local/share
  91. INSTALL_DIR ?= $(XDG_DATA_HOME)/erlang.mk/lib
  92. install: check
  93. for dep in `ls test/packages/$p_pkg/deps/`; do \
  94. rm -rf $(INSTALL_DIR)/$$dep; \
  95. mkdir -p $(INSTALL_DIR)/$$dep; \
  96. cp -r test/packages/$p_pkg/deps/$$dep/ebin $(INSTALL_DIR)/$$dep/; \
  97. if [ -d test/packages/$p_pkg/deps/$$dep/priv ]; then \
  98. cp -r test/packages/$p_pkg/deps/$$dep/priv $(INSTALL_DIR)/$$dep/; \
  99. fi; \
  100. done
  101. else
  102. install:
  103. @echo "Usage: $(MAKE) install p=<package name>"
  104. endif
  105. ifneq ($(strip $(LATEST_ERLANG_OTP)),)
  106. include core/kerl.mk
  107. endif