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