targets.mk 4.4 KB

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