targets.mk 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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
  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 the following line to make "all" the default target' \
  41. -e '1 i oldorg:' \
  42. -e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
  43. -e '$$ i ## See default.mk for further configuration options.' \
  44. default.mk > $@
  45. all compile:: doc lisp
  46. $(MAKE) -C $< clean
  47. compile compile-dirty:: lisp
  48. $(MAKE) -C $< $@
  49. all clean-install::
  50. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
  51. check test:: all
  52. check test test-dirty::
  53. -$(MKDIR) $(testdir)
  54. TMPDIR=$(testdir) $(BTEST)
  55. ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
  56. $(MAKE) cleantest
  57. endif
  58. up0 up1 up2::
  59. git remote update
  60. git pull
  61. up1 up2:: all
  62. $(MAKE) test-dirty
  63. up2 update2::
  64. $(SUDO) $(MAKE) install
  65. install: $(INSTSUB)
  66. install-info: install-doc
  67. doc docs: $(ORG_MAKE_DOC)
  68. info html pdf card:
  69. $(MAKE) -C doc $@
  70. $(INSTSUB):
  71. $(MAKE) -C $(@:install-%=%) install
  72. autoloads: lisp
  73. $(MAKE) -C $< $@
  74. cleandirs:
  75. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
  76. clean: cleanrel
  77. $(MAKE) -C lisp clean
  78. $(MAKE) -C doc clean
  79. cleanall: cleandirs cleantest cleancontrib cleanutils
  80. -$(FIND) . -name \*~ -exec $(RM) {} \;
  81. cleancontrib:
  82. -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
  83. cleanutils:
  84. -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
  85. cleanrel:
  86. $(RMR) RELEASEDIR
  87. $(RMR) org-7.*
  88. $(RMR) org-7*zip org-7*tar.gz
  89. cleanelc cleanlisp:
  90. $(MAKE) -C lisp clean
  91. -$(FIND) lisp -name \*~ -exec $(RM) {} \;
  92. cleandoc cleandocs:
  93. $(MAKE) -C doc clean
  94. -$(FIND) doc -name \*~ -exec $(RM) {} \;
  95. cleantest:
  96. $(RMR) $(testdir)