targets.mk 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. .EXPORT_ALL_VARIABLES:
  2. .NOTPARALLEL: .PHONY
  3. # Additional distribution files
  4. DISTFILES_extra= Makefile request-assign-future.txt contrib etc
  5. LISPDIRS = lisp
  6. OTHERDIRS = doc etc
  7. SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
  8. INSTSUB = $(SUBDIRS:%=install-%)
  9. ORG_MAKE_DOC ?= info html pdf
  10. ifneq ($(wildcard .git),)
  11. GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
  12. ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
  13. GITSTATUS ?= $(shell git status -uno --porcelain)
  14. else
  15. GITVERSION ?= N/A
  16. ORGVERSION ?= N/A
  17. endif
  18. DATE = $(shell date +%Y-%m-%d)
  19. ifneq ($(GITSTATUS),)
  20. GITVERSION := $(GITVERSION:.dirty=).dirty
  21. endif
  22. .PHONY: all oldorg update update2 up0 up1 up2 compile $(SUBDIRS) \
  23. check test install info html pdf card doc docs $(INSTSUB) \
  24. autoloads cleanall clean cleancontrib cleanutils cleanrel clean-install \
  25. cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest
  26. compile compile-dirty uncompiled
  27. oldorg: compile info # what the old makefile did when no target was specified
  28. uncompiled: cleanlisp autoloads # for developing
  29. refcard: card
  30. update update2:: up0 all
  31. .PRECIOUS: local.mk
  32. local.mk:
  33. $(info ======================================================)
  34. $(info = Invoke "make help" for a synopsis of make targets. =)
  35. $(info = Created a default local.mk template. =)
  36. $(info = Setting "oldorg" as the default target. =)
  37. $(info = Please adapt local.mk to your local setup! =)
  38. $(info ======================================================)
  39. -@$(SED) -n \
  40. -e '1 i ## Remove "oldorg:" to make "all" the default target,' \
  41. -e '1 i ## change to your favourite default target' \
  42. -e '1 i ## or provide your own defintion here' \
  43. -e '1 i oldorg:' \
  44. -e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
  45. -e '$$ i ## See default.mk for further configuration options.' \
  46. default.mk > $@
  47. all compile::
  48. $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
  49. compile compile-dirty::
  50. $(MAKE) -C lisp $@
  51. all clean-install::
  52. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
  53. check test:: compile
  54. check test test-dirty::
  55. -$(MKDIR) $(testdir)
  56. TMPDIR=$(testdir) $(BTEST)
  57. ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
  58. $(MAKE) cleantest
  59. endif
  60. up0 up1 up2::
  61. git remote update
  62. git pull
  63. up1 up2:: all
  64. $(MAKE) test-dirty
  65. up2 update2::
  66. $(SUDO) $(MAKE) install
  67. install: $(INSTSUB)
  68. install-info: install-doc
  69. doc docs: $(ORG_MAKE_DOC)
  70. info html pdf card:
  71. $(MAKE) -C doc $@
  72. $(INSTSUB):
  73. $(MAKE) -C $(@:install-%=%) install
  74. autoloads: lisp
  75. $(MAKE) -C $< $@
  76. cleandirs:
  77. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
  78. clean: cleanrel
  79. $(MAKE) -C lisp clean
  80. $(MAKE) -C doc clean
  81. cleanall: cleandirs cleantest cleancontrib cleanutils
  82. -$(FIND) . -name \*~ -o -name \*# -o -name .#\* -exec $(RM) {} \;
  83. cleancontrib:
  84. -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
  85. cleanutils:
  86. -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
  87. cleanrel:
  88. $(RMR) RELEASEDIR
  89. $(RMR) org-7.*
  90. $(RMR) org-7*zip org-7*tar.gz
  91. cleanelc cleanlisp:
  92. $(MAKE) -C lisp clean
  93. -$(FIND) lisp -name \*~ -exec $(RM) {} \;
  94. cleandoc cleandocs:
  95. $(MAKE) -C doc clean
  96. -$(FIND) doc -name \*~ -exec $(RM) {} \;
  97. cleantest:
  98. $(RMR) $(testdir)