You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 line
3.5 KiB

14 年之前
14 年之前
  1. REPO ?= riak
  2. RIAK_TAG = $(shell git describe --tags)
  3. REVISION ?= $(shell echo $(RIAK_TAG) | sed -e 's/^$(REPO)-//')
  4. PKG_VERSION ?= $(shell echo $(REVISION) | tr - .)
  5. .PHONY: rel stagedevrel deps
  6. all: deps compile
  7. compile:
  8. ./rebar compile
  9. deps:
  10. ./rebar get-deps
  11. clean:
  12. ./rebar clean
  13. distclean: clean devclean relclean ballclean
  14. ./rebar delete-deps
  15. test:
  16. ./rebar skip_deps=true eunit
  17. ##
  18. ## Release targets
  19. ##
  20. rel: deps
  21. ./rebar compile generate
  22. relclean:
  23. rm -rf rel/riak
  24. ##
  25. ## Developer targets
  26. ##
  27. stagedevrel: dev1 dev2 dev3 dev4
  28. $(foreach dev,$^,\
  29. $(foreach dep,$(wildcard deps/*), rm -rf dev/$(dev)/lib/$(shell basename $(dep))-* && ln -sf $(abspath $(dep)) dev/$(dev)/lib;))
  30. devrel: dev1 dev2 dev3 dev4
  31. dev1 dev2 dev3 dev4:
  32. mkdir -p dev
  33. (cd rel && ../rebar generate target_dir=../dev/$@ overlay_vars=vars/$@_vars.config)
  34. devclean: clean
  35. rm -rf dev
  36. stage : rel
  37. $(foreach dep,$(wildcard deps/*), rm -rf rel/riak/lib/$(shell basename $(dep))-* && ln -sf $(abspath $(dep)) rel/riak/lib;)
  38. ##
  39. ## Doc targets
  40. ##
  41. docs:
  42. ./rebar skip_deps=true doc
  43. @cp -R apps/luke/doc doc/luke
  44. @cp -R apps/riak_core/doc doc/riak_core
  45. @cp -R apps/riak_kv/doc doc/riak_kv
  46. orgs: orgs-doc orgs-README
  47. orgs-doc:
  48. @emacs -l orgbatch.el -batch --eval="(riak-export-doc-dir \"doc\" 'html)"
  49. orgs-README:
  50. @emacs -l orgbatch.el -batch --eval="(riak-export-doc-file \"README.org\" 'ascii)"
  51. @mv README.txt README
  52. APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
  53. xmerl webtool snmp public_key mnesia eunit syntax_tools compiler
  54. COMBO_PLT = $(HOME)/.riak_combo_dialyzer_plt
  55. check_plt: compile
  56. dialyzer --check_plt --plt $(COMBO_PLT) --apps $(APPS) \
  57. deps/*/ebin
  58. build_plt: compile
  59. dialyzer --build_plt --output_plt $(COMBO_PLT) --apps $(APPS) \
  60. deps/*/ebin
  61. dialyzer: compile
  62. @echo
  63. @echo Use "'make check_plt'" to check PLT prior to using this target.
  64. @echo Use "'make build_plt'" to build PLT prior to using this target.
  65. @echo
  66. @sleep 1
  67. dialyzer -Wno_return --plt $(COMBO_PLT) deps/*/ebin | \
  68. fgrep -v -f ./dialyzer.ignore-warnings
  69. cleanplt:
  70. @echo
  71. @echo "Are you sure? It takes about 1/2 hour to re-build."
  72. @echo Deleting $(COMBO_PLT) in 5 seconds.
  73. @echo
  74. sleep 5
  75. rm $(COMBO_PLT)
  76. # Release tarball creation
  77. # Generates a tarball that includes all the deps sources so no checkouts are necessary
  78. archivegit = git archive --format=tar --prefix=$(1)/ HEAD | (cd $(2) && tar xf -)
  79. archivehg = hg archive $(2)/$(1)
  80. archive = if [ -d ".git" ]; then \
  81. $(call archivegit,$(1),$(2)); \
  82. else \
  83. $(call archivehg,$(1),$(2)); \
  84. fi
  85. buildtar = mkdir distdir && \
  86. git clone . distdir/riak-clone && \
  87. cd distdir/riak-clone && \
  88. git checkout $(RIAK_TAG) && \
  89. $(call archive,$(RIAK_TAG),..) && \
  90. mkdir ../$(RIAK_TAG)/deps && \
  91. make deps; \
  92. for dep in deps/*; do \
  93. cd $${dep} && \
  94. $(call archive,$${dep},../../../$(RIAK_TAG)) && \
  95. mkdir -p ../../../$(RIAK_TAG)/$${dep}/priv && \
  96. git rev-list --max-count=1 HEAD > ../../../$(RIAK_TAG)/$${dep}/priv/git.vsn && \
  97. cd ../..; done
  98. distdir:
  99. $(if $(RIAK_TAG), $(call buildtar), $(error "You can't generate a release tarball from a non-tagged revision. Run 'git checkout <tag>', then 'make dist'"))
  100. dist $(RIAK_TAG).tar.gz: distdir
  101. cd distdir; \
  102. tar czf ../$(RIAK_TAG).tar.gz $(RIAK_TAG)
  103. ballclean:
  104. rm -rf $(RIAK_TAG).tar.gz distdir
  105. package: dist
  106. $(MAKE) -C package package
  107. pkgclean:
  108. $(MAKE) -C package pkgclean
  109. .PHONY: package
  110. export PKG_VERSION REPO REVISION RIAK_TAG