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