Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. .NOTPARALLEL: # always run this make serially
  2. .SUFFIXES: # we don't need default suffix rules
  3. ifeq ($(MAKELEVEL), 0)
  4. $(error This make needs to be started as a sub-make from the toplevel directory.)
  5. endif
  6. ifneq ($(ORG_ADD_CONTRIB),)
  7. _ORG_ADD_EL_ := \
  8. $(notdir \
  9. $(wildcard \
  10. $(addsuffix .el, \
  11. $(addprefix ../contrib/lisp/, \
  12. $(basename \
  13. $(notdir $(ORG_ADD_CONTRIB)))))))
  14. endif
  15. LISPV := org-version.el
  16. LISPI := org-loaddefs.el
  17. LISPA := $(LISPV) $(LISPI)
  18. LISPB := $(LISPA:%el=%elc) org-install.elc
  19. LISPF := $(filter-out $(LISPA),$(sort $(wildcard *.el) $(_ORG_ADD_EL_)))
  20. LISPC := $(filter-out $(LISPB) $(LISPN:%el=%elc),$(LISPF:%el=%elc))
  21. _ORGCM_ := dirall single source slint1 slint2
  22. -include local.mk
  23. .PHONY: all compile compile-dirty \
  24. $(_ORGCM_) $(_ORGCM_:%=compile-%) \
  25. autoloads addcontrib \
  26. install clean cleanauto cleanall cleanelc clean-install
  27. # do not clean here, done in toplevel make
  28. all compile compile-dirty:: autoloads
  29. ifeq ($(filter-out $(_ORGCM_),$(ORGCM)),)
  30. $(MAKE) compile-$(ORGCM)
  31. else
  32. $(error ORGCM has illegal value $(ORGCM) (valid: $(_ORGCM_)))
  33. endif
  34. compile-dirall: dirall
  35. compile-single: single $(LISPC)
  36. compile-source: source dirall
  37. compile-slint1: dirall slint1
  38. compile-slint2: source dirall slint1
  39. # internal
  40. dirall:
  41. @$(info ==================== $@ ====================)
  42. @$(ELCDIR)
  43. single:
  44. @$(info ==================== $@ ====================)
  45. source: cleanelc
  46. @$(info ==================== $@ ====================)
  47. @$(foreach elc,$(LISPC),$(MAKE) $(elc) && $(RM) $(elc);)
  48. slint1:
  49. @$(info ==================== $@ ====================)
  50. @$(foreach elc,$(LISPC),$(RM) $(elc); $(MAKE) $(elc);)
  51. %.elc: %.el
  52. @$(info Compiling single $(abspath $<)...)
  53. -@$(ELC) $<
  54. addcontrib:
  55. ifneq ($(ORG_ADD_CONTRIB),)
  56. $(CP) $(addprefix ../contrib/lisp/,$(_ORG_ADD_EL_)) .
  57. endif
  58. autoloads: cleanauto addcontrib $(LISPI) $(LISPV)
  59. $(LISPV): $(LISPF)
  60. @echo "org-version: $(ORGVERSION) ($(GITVERSION))"
  61. @$(RM) $(@)
  62. @$(MAKE_ORG_VERSION)
  63. $(LISPI): $(LISPV) $(LISPF)
  64. @echo "org-loaddefs: $(ORGVERSION) ($(GITVERSION))"
  65. @$(RM) $(@)
  66. @$(MAKE_ORG_INSTALL)
  67. install: compile $(LISPF)
  68. if [ ! -d $(DESTDIR)$(lispdir) ] ; then \
  69. $(MKDIR) $(DESTDIR)$(lispdir) ; \
  70. fi ;
  71. $(CP) $(LISPC) $(LISPF) $(LISPA) $(DESTDIR)$(lispdir)
  72. cleanauto clean cleanall::
  73. $(RM) $(LISPA) $(LISPB)
  74. clean cleanall cleanelc::
  75. $(RM) *.elc
  76. clean-install:
  77. if [ -d $(DESTDIR)$(lispdir) ] ; then \
  78. $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
  79. fi ;