Makefile: error out on invalid values of ORGCM
[org-mode.git] / lisp / Makefile
blobda84db016f2870b0ab222dca399a8ef27237d880
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 \
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 autoloads: cleanauto $(LISPI) $(LISPV)
53 $(LISPV): $(LISPF)
54 @echo "org-version: $(ORGVERSION) ($(GITVERSION))"
55 @$(RM) $(@)
56 @$(MAKE_ORG_VERSION)
58 $(LISPI): $(LISPV) $(LISPF)
59 @echo "org-install: $(ORGVERSION) ($(GITVERSION))"
60 @$(RM) $(@)
61 @$(MAKE_ORG_INSTALL)
63 install: $(LISPF) compile
64 if [ ! -d $(DESTDIR)$(lispdir) ] ; then \
65 $(MKDIR) $(DESTDIR)$(lispdir) ; \
66 fi ;
67 $(CP) $(LISPC) $(LISPF) $(LISPA) $(DESTDIR)$(lispdir)
69 cleanauto clean cleanall::
70 $(RM) $(LISPA) $(LISPA:%el=%elc)
71 clean cleanall cleanelc::
72 $(RM) *.elc
74 clean-install:
75 if [ -d $(DESTDIR)$(lispdir) ] ; then \
76 $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* ; \
77 fi ;