Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. export LC_COLLATE=C; \
  28. awk 'FNR==1 && NR!=1{print ""}1' $(patsubst %,%.mk,$(BUILD_CONFIG)) \
  29. | sed 's/^ERLANG_MK_VERSION =.*/ERLANG_MK_VERSION = $(ERLANG_MK_VERSION)/' \
  30. | sed 's:^ERLANG_MK_WITHOUT =.*:ERLANG_MK_WITHOUT = $(WITHOUT):' > $(ERLANG_MK)
  31. lint: all
  32. $(MAKE) -f erlang.mk --warn-undefined-variables
  33. ifdef p
  34. # Remove p from the list of variables since that conflicts with bootstrapping.
  35. MAKEOVERRIDES := $(filter-out p=$p,$(MAKEOVERRIDES))
  36. check:
  37. $(MAKE) -C test pkg-$p KEEP_BUILDS=1
  38. else
  39. ifdef c
  40. check:
  41. $(MAKE) -C test $c
  42. else
  43. check:
  44. $(MAKE) -C test
  45. endif
  46. endif
  47. packages:
  48. $(MAKE) -C test packages
  49. summary:
  50. @mkdir -p test/logs/
  51. @touch test/logs/latest.log test/packages/errors.log
  52. -@sort test/packages/errors.log | diff test/logs/latest.log -
  53. @sort test/packages/errors.log > test/logs/latest.log
  54. @cp test/logs/latest.log "test/logs/$(shell date '+%F_%T%z')"
  55. search:
  56. @$(MAKE) --no-print-directory \
  57. -f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \
  58. search
  59. clean:
  60. $(MAKE) -C test clean
  61. rm -rf doc/guide.pdf doc/html
  62. git checkout erlang.mk
  63. docs:
  64. $(MAKE) -f core/core.mk -f core/docs.mk -f plugins/asciidoc.mk asciidoc DEPS=asciideck
  65. up:
  66. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  67. cd gh-pages && git checkout gh-pages
  68. cd gh-pages && make
  69. cd gh-pages && git push origin gh-pages
  70. rm -rf gh-pages
  71. ifdef file
  72. up-relx:
  73. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  74. cd gh-pages && git checkout gh-pages
  75. cp $(file) gh-pages/res/
  76. cd gh-pages && git add .
  77. cd gh-pages && git commit -m "Publish new Relx version"
  78. cd gh-pages && git push origin gh-pages
  79. rm -rf gh-pages
  80. else
  81. up-relx:
  82. @echo Missing parameter: url
  83. endif
  84. ifdef p
  85. XDG_DATA_HOME ?= $(HOME)/.local/share
  86. INSTALL_DIR ?= $(XDG_DATA_HOME)/erlang.mk/lib
  87. install: check
  88. for dep in `ls test/packages/$p_pkg/deps/`; do \
  89. rm -rf $(INSTALL_DIR)/$$dep; \
  90. mkdir -p $(INSTALL_DIR)/$$dep; \
  91. cp -r test/packages/$p_pkg/deps/$$dep/ebin $(INSTALL_DIR)/$$dep/; \
  92. if [ -d test/packages/$p_pkg/deps/$$dep/priv ]; then \
  93. cp -r test/packages/$p_pkg/deps/$$dep/priv $(INSTALL_DIR)/$$dep/; \
  94. fi; \
  95. done
  96. else
  97. install:
  98. @echo "Usage: $(MAKE) install p=<package name>"
  99. endif