org-agenda: Fix last commit
[org-mode/org-tableheadings.git] / mk / targets.mk
blob15cbdfad5558e276ecb9e9919faa61ed36258ded
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 --match release\* --abbrev=6 HEAD)
15 ORGVERSION ?= $(subst release_,,$(shell git describe --match release\* --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 YEAR = $(shell date +%Y)
24 ifneq ($(GITSTATUS),)
25 GITVERSION := $(GITVERSION:.dirty=).dirty
26 endif
28 .PHONY: all oldorg update update2 up0 up1 up2 single $(SUBDIRS) \
29 check test install $(INSTSUB) \
30 info html pdf card refcard doc docs \
31 autoloads cleanall clean $(CLEANDIRS:%=clean%) \
32 clean-install cleanelc cleandirs cleanaddcontrib \
33 cleanlisp cleandoc cleandocs cleantest \
34 compile compile-dirty uncompiled \
35 config config-test config-exe config-all config-eol config-version \
36 vanilla
38 CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
39 CONF_DEST = lispdir infodir datadir testdir
40 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
41 CONF_EXEC = CP MKDIR RM RMR FIND CHMOD SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
42 CONF_CALL = BATCH BATCHL ELC ELCDIR NOBATCH BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
43 config-eol:: EOL = \#
44 config-eol:: config-all
45 config config-all::
46 $(info )
47 $(info ========= Emacs executable and Installation paths)
48 $(foreach var,$(CONF_BASE),$(info $(var) = $($(var))$(EOL)))
49 $(foreach var,$(CONF_DEST),$(info $(var) = $(DESTDIR)$($(var))$(EOL)))
50 $(info ========= Additional files from contrib/lisp)
51 $(info $(notdir \
52 $(wildcard \
53 $(addsuffix .el, \
54 $(addprefix contrib/lisp/, \
55 $(basename \
56 $(notdir $(ORG_ADD_CONTRIB))))))))
57 config-test config-all::
58 $(info )
59 $(info ========= Test configuration)
60 $(foreach var,$(CONF_TEST),$(info $(var) = $($(var))$(EOL)))
61 config-exe config-all::
62 $(info )
63 $(info ========= Executables used by make)
64 $(foreach var,$(CONF_EXEC),$(info $(var) = $($(var))$(EOL)))
65 config-cmd config-all::
66 $(info )
67 $(info ========= Commands used by make)
68 $(foreach var,$(CONF_CALL),$(info $(var) = $($(var))$(EOL)))
69 config config-test config-exe config-all config-version::
70 $(info ========= Org version)
71 $(info make: Org mode version $(ORGVERSION) ($(GITVERSION) => $(lispdir)))
72 @echo ""
74 oldorg: compile info # what the old makefile did when no target was specified
75 uncompiled: cleanlisp autoloads # for developing
76 refcard: card
77 update update2:: up0 all
79 single: ORGCM=single
80 single: compile
82 .PRECIOUS: local.mk
83 local.mk:
84 $(info ======================================================)
85 $(info = Invoke "make help" for a synopsis of make targets. =)
86 $(info = Created a default local.mk template. =)
87 $(info = Setting "oldorg" as the default target. =)
88 $(info = Please adapt local.mk to your local setup! =)
89 $(info ======================================================)
90 -@$(MAKE_LOCAL_MK)
92 all compile::
93 $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
94 compile compile-dirty::
95 $(MAKE) -C lisp $@
96 all clean-install::
97 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
99 vanilla:
100 -@$(NOBATCH) &
102 check test:: compile
103 check test test-dirty::
104 -$(MKDIR) $(testdir)
105 TMPDIR=$(testdir) $(BTEST)
106 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
107 $(MAKE) cleantest
108 endif
110 up0:: cleanaddcontrib
111 up0 up1 up2::
112 git checkout $(GIT_BRANCH)
113 git remote update
114 git pull
115 up1 up2:: all
116 $(MAKE) test-dirty
117 up2 update2::
118 $(SUDO) $(MAKE) install
120 install: $(INSTSUB)
122 install-info: install-doc
124 doc docs: $(ORG_MAKE_DOC)
126 info html pdf card:
127 $(MAKE) -C doc $@
129 $(INSTSUB):
130 $(MAKE) -C $(@:install-%=%) install
132 autoloads: lisp
133 $(MAKE) -C $< $@
135 cleandirs:
136 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
138 clean: cleanlisp cleandoc
140 cleanall: cleandirs cleantest cleanaddcontrib
141 -$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} +
142 -$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +
144 $(CLEANDIRS:%=clean%):
145 -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +
147 cleanelc:
148 $(MAKE) -C lisp $@
150 cleanaddcontrib:
151 -$(RM) $(wildcard $(addprefix lisp/,$(notdir $(wildcard contrib/lisp/*.el))))
153 cleanlisp: cleanaddcontrib
154 cleanlisp cleandoc:
155 $(MAKE) -C $(@:clean%=%) clean
157 cleandocs:
158 $(MAKE) -C doc clean
159 -$(FIND) doc -name \*~ -exec $(RM) {} \;
161 cleantest:
162 # git-annex creates non-writable directories so that the files within
163 # them can't be removed; if rm fails, try to recover by making all
164 # directories writable
165 -$(RMR) $(testdir) || { \
166 $(FIND) $(testdir) -type d -exec $(CHMOD) u+w {} + && \
167 $(RMR) $(testdir) ; \