Merge branch 'maint'
[org-mode.git] / lisp / Makefile
blob89f504db6a9b333450549395e10c3db841fe2dda
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
7 ifneq ($(ORG_ADD_CONTRIB),)
8 _ORG_ADD_EL_ := \
9 $(notdir \
10 $(wildcard \
11 $(addsuffix .el, \
12 $(addprefix ../contrib/lisp/, \
13 $(basename \
14 $(notdir $(ORG_ADD_CONTRIB)))))))
15 endif
17 LISPV := org-version.el
18 LISPI := org-loaddefs.el
19 LISPA := $(LISPV) $(LISPI)
20 LISPB := $(LISPA:%el=%elc) org-install.elc
21 LISPF := $(filter-out $(LISPA),$(sort $(wildcard *.el) $(_ORG_ADD_EL_)))
22 LISPC := $(filter-out $(LISPB) $(LISPN:%el=%elc),$(LISPF:%el=%elc))
23 _ORGCM_ := dirall single source slint1 slint2
24 -include local.mk
26 .PHONY: all compile compile-dirty \
27 $(_ORGCM_) $(_ORGCM_:%=compile-%) \
28 autoloads addcontrib \
29 install clean cleanauto cleanall cleanelc clean-install
31 # do not clean here, done in toplevel make
32 all compile compile-dirty:: autoloads
33 ifeq ($(filter-out $(_ORGCM_),$(ORGCM)),)
34 $(MAKE) compile-$(ORGCM)
35 else
36 $(error ORGCM has illegal value $(ORGCM) (valid: $(_ORGCM_)))
37 endif
39 compile-dirall: dirall
40 compile-single: single $(LISPC)
41 compile-source: source dirall
42 compile-slint1: dirall slint1
43 compile-slint2: source dirall slint1
45 # internal
46 dirall:
47 @$(info ==================== $@ ====================)
48 @$(ELCDIR)
49 single:
50 @$(info ==================== $@ ====================)
51 source: cleanelc
52 @$(info ==================== $@ ====================)
53 @$(foreach elc,$(LISPC),$(MAKE) $(elc) && $(RM) $(elc);)
54 slint1:
55 @$(info ==================== $@ ====================)
56 @$(foreach elc,$(LISPC),$(RM) $(elc); $(MAKE) $(elc);)
58 %.elc: %.el
59 @$(info Compiling single $(abspath $<)...)
60 -@$(ELC) $<
62 addcontrib:
63 ifneq ($(ORG_ADD_CONTRIB),)
64 $(CP) $(addprefix ../contrib/lisp/,$(_ORG_ADD_EL_)) .
65 endif
67 autoloads: cleanauto addcontrib $(LISPI) $(LISPV)
69 $(LISPV): $(LISPF)
70 @echo "org-version: $(ORGVERSION) ($(GITVERSION))"
71 @$(RM) $(@)
72 @$(MAKE_ORG_VERSION)
74 $(LISPI): $(LISPV) $(LISPF)
75 @echo "org-loaddefs: $(ORGVERSION) ($(GITVERSION))"
76 @$(RM) $(@)
77 @$(MAKE_ORG_INSTALL)
79 install: compile $(LISPF)
80 if [ ! -d $(DESTDIR)$(lispdir) ] ; then \
81 $(MKDIR) $(DESTDIR)$(lispdir) ; \
82 fi ;
83 $(CP) $(LISPC) $(LISPF) $(LISPA) $(DESTDIR)$(lispdir)
85 cleanauto clean cleanall::
86 $(RM) $(LISPA) $(LISPB)
87 clean cleanall cleanelc::
88 $(RM) *.elc
90 clean-install:
91 if [ -d $(DESTDIR)$(lispdir) ] ; then \
92 $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
93 fi ;