org-agenda.el: Allow `org-agenda-finalize-hook' to modify the buffer
[org-mode.git] / mk / targets.mk
blobaac6de9c8c73945583ac3613a29ebf664d2962d0
1 .EXPORT_ALL_VARIABLES:
2 .NOTPARALLEL: .PHONY
3 # Additional distribution files
4 DISTFILES_extra= Makefile request-assign-future.txt contrib etc
6 LISPDIRS = lisp
7 OTHERDIRS = doc etc
8 CLEANDIRS = contrib testing mk
9 SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
10 INSTSUB = $(SUBDIRS:%=install-%)
11 ORG_MAKE_DOC ?= info html pdf
13 ifneq ($(wildcard .git),)
14 GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
15 ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
16 GITSTATUS ?= $(shell git status -uno --porcelain)
17 else
18 -include mk/version.mk
19 GITVERSION ?= N/A
20 ORGVERSION ?= N/A
21 endif
22 DATE = $(shell date +%Y-%m-%d)
23 ifneq ($(GITSTATUS),)
24 GITVERSION := $(GITVERSION:.dirty=).dirty
25 endif
27 .PHONY: all oldorg update update2 up0 up1 up2 single $(SUBDIRS) \
28 check test install $(INSTSUB) \
29 info html pdf card refcard doc docs \
30 autoloads cleanall clean $(CLEANDIRS:%=clean%) \
31 clean-install cleanelc cleandirs \
32 cleanlisp cleandoc cleandocs cleantest \
33 compile compile-dirty uncompiled \
34 config config-test config-exe config-all config-eol
36 CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
37 CONF_DEST = lispdir infodir datadir testdir
38 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
39 CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
40 CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
41 config-eol:: EOL = \#
42 config-eol:: config-all
43 config config-all::
44 $(info )
45 $(info ========= Emacs executable and Installation paths)
46 $(foreach var,$(CONF_BASE),$(info $(var) = $($(var))$(EOL)))
47 $(foreach var,$(CONF_DEST),$(info $(var) = $(DESTDIR)$($(var))$(EOL)))
48 $(info ========= Additional files from contrib/lisp)
49 $(info $(notdir \
50 $(wildcard \
51 $(addsuffix .el, \
52 $(addprefix contrib/lisp/, \
53 $(basename \
54 $(notdir $(ORG_ADD_CONTRIB))))))))
55 config-test config-all::
56 $(info )
57 $(info ========= Test configuration)
58 $(foreach var,$(CONF_TEST),$(info $(var) = $($(var))$(EOL)))
59 config-exe config-all::
60 $(info )
61 $(info ========= Executables used by make)
62 $(foreach var,$(CONF_EXEC),$(info $(var) = $($(var))$(EOL)))
63 config-cmd config-all::
64 $(info )
65 $(info ========= Commands used by make)
66 $(foreach var,$(CONF_CALL),$(info $(var) = $($(var))$(EOL)))
67 config config-test config-exe config-all::
68 @echo ""
70 oldorg: compile info # what the old makefile did when no target was specified
71 uncompiled: cleanlisp autoloads # for developing
72 refcard: card
73 update update2:: up0 all
75 single: ORGCM=single
76 single: compile
78 .PRECIOUS: local.mk
79 local.mk:
80 $(info ======================================================)
81 $(info = Invoke "make help" for a synopsis of make targets. =)
82 $(info = Created a default local.mk template. =)
83 $(info = Setting "oldorg" as the default target. =)
84 $(info = Please adapt local.mk to your local setup! =)
85 $(info ======================================================)
86 -@$(MAKE_LOCAL_MK)
88 all compile::
89 $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
90 compile compile-dirty::
91 $(MAKE) -C lisp $@
92 all clean-install::
93 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
95 check test:: compile
96 check test test-dirty::
97 -$(MKDIR) $(testdir)
98 TMPDIR=$(testdir) $(BTEST)
99 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
100 $(MAKE) cleantest
101 endif
103 up0 up1 up2::
104 git remote update
105 git pull
106 up1 up2:: all
107 $(MAKE) test-dirty
108 up2 update2::
109 $(SUDO) $(MAKE) install
111 install: $(INSTSUB)
113 install-info: install-doc
115 doc docs: $(ORG_MAKE_DOC)
117 info html pdf card:
118 $(MAKE) -C doc $@
120 $(INSTSUB):
121 $(MAKE) -C $(@:install-%=%) install
123 autoloads: lisp
124 ifneq ($(ORG_ADD_CONTRIB),)
125 $(CP) $(wildcard \
126 $(addsuffix .el, \
127 $(addprefix contrib/lisp/, \
128 $(basename \
129 $(notdir $(ORG_ADD_CONTRIB)))))) lisp/
130 endif
131 $(MAKE) -C $< $@
133 cleandirs:
134 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
136 clean: cleanlisp cleandoc
138 cleanall: cleandirs cleantest cleanaddcontrib
139 -$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} \;
140 -$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
142 $(CLEANDIRS:%=clean%):
143 -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
145 cleanelc:
146 $(MAKE) -C lisp $@
148 cleanaddcontrib:
149 -$(RM) $(wildcard $(addprefix lisp/,$(notdir $(wildcard contrib/lisp/*.el))))
151 cleanlisp: cleanaddcontrib
152 cleanlisp cleandoc:
153 $(MAKE) -C $(@:clean%=%) clean
155 cleandocs:
156 $(MAKE) -C doc clean
157 -$(FIND) doc -name \*~ -exec $(RM) {} \;
159 cleantest:
160 $(RMR) $(testdir)