targets.mk 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. .NOTPARALLEL: .PHONY
  2. # Additional distribution files
  3. DISTFILES_extra= Makefile request-assign-future.txt contrib etc
  4. .EXPORT_ALL_VARIABLES:
  5. LISPDIRS = lisp
  6. SUBDIRS = doc etc $(LISPDIRS)
  7. INSTSUB = $(SUBDIRS:%=install-%)
  8. ORG_MAKE_DOC ?= info html pdf
  9. ifneq ($(wildcard .git),)
  10. GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
  11. ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
  12. GITSTATUS ?= $(shell git status -uno --porcelain)
  13. else
  14. GITVERSION ?= N/A
  15. ORGVERSION ?= N/A
  16. endif
  17. DATE = $(shell date +%Y-%m-%d)
  18. ifneq ($(GITSTATUS),)
  19. GITVERSION := $(GITVERSION).dirty
  20. endif
  21. .PHONY: all oldorg update update2 up0 up1 up2 compile $(SUBDIRS) \
  22. check test install info html pdf card doc docs $(INSTSUB) \
  23. autoloads cleanall clean cleancontrib cleanrel clean-install \
  24. cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest \
  25. compile compile-dirty
  26. oldorg: compile autoloads info # what the old makefile did when no target was specified
  27. refcard: card
  28. update update2:: up0 all
  29. .PRECIOUS: local.mk
  30. local.mk:
  31. $(info ==========================================)
  32. $(info Created a local.mk template.)
  33. $(info Please adapt local.mk to your local setup!)
  34. $(info ==========================================)
  35. -@$(SED) -n \
  36. -e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
  37. -e '$$ i ## See default.mk for further configuration options.' \
  38. default.mk > $@
  39. all \
  40. compile:: lisp
  41. $(MAKE) -C $< clean
  42. compile \
  43. compile-dirty:: lisp
  44. $(MAKE) -C $< $@
  45. all \
  46. clean-install::
  47. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
  48. check test:: all
  49. check test \
  50. test-dirty::
  51. -$(MKDIR) $(testdir)
  52. TMPDIR=$(testdir) $(BTEST)
  53. ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
  54. $(MAKE) cleantest
  55. endif
  56. up0 up1 up2::
  57. git remote update
  58. git pull
  59. up1 up2:: all
  60. $(MAKE) test-dirty
  61. up2 update2::
  62. $(SUDO) $(MAKE) install
  63. install: $(INSTSUB)
  64. install-info: install-doc
  65. doc docs: $(ORG_MAKE_DOC)
  66. info html pdf card:
  67. $(MAKE) -C doc $@
  68. $(INSTSUB):
  69. $(MAKE) -C $(@:install-%=%) install
  70. autoloads: lisp
  71. $(MAKE) -C $< $@
  72. cleandirs:
  73. $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
  74. clean: cleanrel
  75. $(MAKE) -C lisp clean
  76. $(MAKE) -C doc clean
  77. cleanall: cleandirs cleantest cleancontrib
  78. -$(FIND) . -name \*~ -exec $(RM) {} \;
  79. cleancontrib:
  80. -$(FIND) contrib -name \*~ -exec $(RM) {} \;
  81. cleanrel:
  82. $(RMR) RELEASEDIR
  83. $(RMR) org-7.*
  84. $(RMR) org-7*zip org-7*tar.gz
  85. cleanelc cleanlisp:
  86. $(MAKE) -C lisp clean
  87. -$(FIND) lisp -name \*~ -exec $(RM) {} \;
  88. cleandoc cleandocs:
  89. $(MAKE) -C doc clean
  90. -$(FIND) doc -name \*~ -exec $(RM) {} \;
  91. cleantest:
  92. $(RMR) $(testdir)