targets.mk 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. CLEANDIRS = contrib testing mk
  8. SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
  9. INSTSUB = $(SUBDIRS:%=install-%)
  10. ORG_MAKE_DOC ?= info html pdf
  11. ifneq ($(wildcard .git),)
  12. GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
  13. ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
  14. GITSTATUS ?= $(shell git status -uno --porcelain)
  15. else
  16. -include mk/version.mk
  17. GITVERSION ?= N/A
  18. ORGVERSION ?= N/A
  19. endif
  20. DATE = $(shell date +%Y-%m-%d)
  21. ifneq ($(GITSTATUS),)
  22. GITVERSION := $(GITVERSION:.dirty=).dirty
  23. endif
  24. .PHONY: all oldorg update update2 up0 up1 up2 single $(SUBDIRS) \
  25. check test install $(INSTSUB) \
  26. info html pdf card refcard doc docs \
  27. autoloads cleanall clean $(CLEANDIRS:%=clean%) \
  28. clean-install cleanelc cleandirs cleanaddcontrib \
  29. cleanlisp cleandoc cleandocs cleantest \
  30. compile compile-dirty uncompiled \
  31. config config-test config-exe config-all config-eol config-version \
  32. vanilla
  33. CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
  34. CONF_DEST = lispdir infodir datadir testdir
  35. CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
  36. CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
  37. CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
  38. config-eol:: EOL = \#
  39. config-eol:: config-all
  40. config config-all::
  41. $(info )
  42. $(info ========= Emacs executable and Installation paths)
  43. $(foreach var,$(CONF_BASE),$(info $(var) = $($(var))$(EOL)))
  44. $(foreach var,$(CONF_DEST),$(info $(var) = $(DESTDIR)$($(var))$(EOL)))
  45. $(info ========= Additional files from contrib/lisp)
  46. $(info $(notdir \
  47. $(wildcard \
  48. $(addsuffix .el, \
  49. $(addprefix contrib/lisp/, \
  50. $(basename \
  51. $(notdir $(ORG_ADD_CONTRIB))))))))
  52. config-test config-all::
  53. $(info )
  54. $(info ========= Test configuration)
  55. $(foreach var,$(CONF_TEST),$(info $(var) = $($(var))$(EOL)))
  56. config-exe config-all::
  57. $(info )
  58. $(info ========= Executables used by make)
  59. $(foreach var,$(CONF_EXEC),$(info $(var) = $($(var))$(EOL)))
  60. config-cmd config-all::
  61. $(info )
  62. $(info ========= Commands used by make)
  63. $(foreach var,$(CONF_CALL),$(info $(var) = $($(var))$(EOL)))
  64. config config-test config-exe config-all config-version::
  65. $(info ========= Org version)
  66. $(info make: Org-mode version $(ORGVERSION) ($(GITVERSION) => $(lispdir)))
  67. @echo ""
  68. oldorg: compile info # what the old makefile did when no target was specified
  69. uncompiled: cleanlisp autoloads # for developing
  70. refcard: card
  71. update update2:: up0 all
  72. single: ORGCM=single
  73. single: compile
  74. .PRECIOUS: local.mk
  75. local.mk:
  76. $(info ======================================================)
  77. $(info = Invoke "make help" for a synopsis of make targets. =)
  78. $(info = Created a default local.mk template. =)
  79. $(info = Setting "oldorg" as the default target. =)
  80. $(info = Please adapt local.mk to your local setup! =)
  81. $(info ======================================================)
  82. -@$(MAKE_LOCAL_MK)
  83. all compile::
  84. $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
  85. compile compile-dirty::
  86. $(MAKE) -C lisp $@
  87. all clean-install::
  88. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
  89. vanilla:
  90. $(NOBATCH) &
  91. check test:: compile
  92. check test test-dirty::
  93. -$(MKDIR) $(testdir)
  94. TMPDIR=$(testdir) $(BTEST)
  95. ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
  96. $(MAKE) cleantest
  97. endif
  98. up0:: cleanaddcontrib
  99. up0 up1 up2::
  100. git remote update
  101. git pull
  102. up1 up2:: all
  103. $(MAKE) test-dirty
  104. up2 update2::
  105. $(SUDO) $(MAKE) install
  106. install: $(INSTSUB)
  107. install-info: install-doc
  108. doc docs: $(ORG_MAKE_DOC)
  109. info html pdf card:
  110. $(MAKE) -C doc $@
  111. $(INSTSUB):
  112. $(MAKE) -C $(@:install-%=%) install
  113. autoloads: lisp
  114. $(MAKE) -C $< $@
  115. cleandirs:
  116. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
  117. clean: cleanlisp cleandoc
  118. cleanall: cleandirs cleantest cleanaddcontrib
  119. -$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} \;
  120. -$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
  121. $(CLEANDIRS:%=clean%):
  122. -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
  123. cleanelc:
  124. $(MAKE) -C lisp $@
  125. cleanaddcontrib:
  126. -$(RM) $(wildcard $(addprefix lisp/,$(notdir $(wildcard contrib/lisp/*.el))))
  127. cleanlisp: cleanaddcontrib
  128. cleanlisp cleandoc:
  129. $(MAKE) -C $(@:clean%=%) clean
  130. cleandocs:
  131. $(MAKE) -C doc clean
  132. -$(FIND) doc -name \*~ -exec $(RM) {} \;
  133. cleantest:
  134. $(RMR) $(testdir)