targets.mk 2.9 KB

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