Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 --tags --dirty)
  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. ifdef p
  32. # Remove p from the list of variables since that conflicts with bootstrapping.
  33. MAKEOVERRIDES := $(filter-out p=$p,$(MAKEOVERRIDES))
  34. check:
  35. $(MAKE) -C test pkg-$p KEEP_BUILDS=1
  36. else
  37. ifdef c
  38. check:
  39. $(MAKE) -C test $c
  40. else
  41. check:
  42. $(MAKE) -C test
  43. endif
  44. endif
  45. packages:
  46. $(MAKE) -C test packages
  47. summary:
  48. @mkdir -p test/logs/
  49. @touch test/logs/latest.log test/packages/errors.log
  50. -@sort test/packages/errors.log | diff test/logs/latest.log -
  51. @sort test/packages/errors.log > test/logs/latest.log
  52. @cp test/logs/latest.log "test/logs/$(shell date '+%F_%T%z')"
  53. search:
  54. @$(MAKE) --no-print-directory \
  55. -f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \
  56. search
  57. clean:
  58. $(MAKE) -C test clean
  59. rm -rf doc/guide.pdf doc/html
  60. git checkout erlang.mk
  61. docs:
  62. $(MAKE) -f core/core.mk -f core/docs.mk -f plugins/asciidoc.mk asciidoc DEPS=asciideck
  63. up:
  64. git clone git@github.com:ninenines/erlang.mk.git gh-pages
  65. cd gh-pages && git checkout gh-pages
  66. cd gh-pages && make
  67. cd gh-pages && git push origin gh-pages
  68. rm -rf gh-pages