targets.mk 2.9 KB

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