org-capture.el: Protect the text used for replacement from being further replaced
[org-mode.git] / targets.mk
blob78f12687777244599ffcce1cc721788bc5ec93f1
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 utils
9 SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
10 INSTSUB = $(SUBDIRS:%=install-%)
11 ORG_MAKE_DOC ?= info html pdf
13 ORG_FROM_CONTRIB = $(wildcard \
14 $(addsuffix .el, \
15 $(addprefix contrib/lisp/, \
16 $(basename \
17 $(notdir $(ORG_ADD_CONTRIB))))))
18 ORG_TO_LISP = $(ORG_FROM_CONTRIB:contrib/%=%)
20 ifneq ($(wildcard .git),)
21 GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
22 ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
23 GITSTATUS ?= $(shell git status -uno --porcelain)
24 else
25 GITVERSION ?= N/A
26 ORGVERSION ?= N/A
27 endif
28 DATE = $(shell date +%Y-%m-%d)
29 ifneq ($(GITSTATUS),)
30 GITVERSION := $(GITVERSION:.dirty=).dirty
31 endif
33 .PHONY: all oldorg update update2 up0 up1 up2 single $(SUBDIRS) \
34 check test install $(INSTSUB) \
35 info html pdf card refcard doc docs \
36 autoloads cleanall clean $(CLEANDIRS:%=clean%) \
37 clean-install cleanelc cleandirs \
38 cleanlisp cleandoc cleandocs cleantest \
39 compile compile-dirty uncompiled \
40 config config-test config-exe config-all config-eol
42 CONF_BASE = EMACS DESTDIR ORGCM
43 CONF_DEST = lispdir infodir datadir testdir
44 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
45 CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
46 CONF_CALL = BATCH BATCHL ELC ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
47 config-eol:: EOL = \#
48 config-eol:: config-all
49 config config-all::
50 $(info )
51 $(info ========= Emacs executable and Installation paths)
52 $(foreach var,$(CONF_BASE),$(info $(var) = $($(var))$(EOL)))
53 $(foreach var,$(CONF_DEST),$(info $(var) = $(DESTDIR)$($(var))$(EOL)))
54 $(info ========= Additional files from contrib/lisp)
55 $(info ORG_FROM_CONTRIB =)
56 $(info $(ORG_TO_LISP:lisp/%=%))
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::
70 @echo ""
72 oldorg: compile info # what the old makefile did when no target was specified
73 uncompiled: cleanlisp autoloads # for developing
74 refcard: card
75 update update2:: up0 all
77 single: ORGCM=single
78 single: compile
80 .PRECIOUS: local.mk
81 local.mk:
82 $(info ======================================================)
83 $(info = Invoke "make help" for a synopsis of make targets. =)
84 $(info = Created a default local.mk template. =)
85 $(info = Setting "oldorg" as the default target. =)
86 $(info = Please adapt local.mk to your local setup! =)
87 $(info ======================================================)
88 -@$(MAKE_LOCAL_MK)
90 all compile::
91 ifneq ($(ORG_FROM_CONTRIB),)
92 $(CP) $(ORG_FROM_CONTRIB) lisp/
93 endif
94 $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
95 compile compile-dirty::
96 $(MAKE) -C lisp $@
97 all clean-install::
98 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
100 check test:: compile
101 check test test-dirty::
102 -$(MKDIR) $(testdir)
103 TMPDIR=$(testdir) $(BTEST)
104 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
105 $(MAKE) cleantest
106 endif
108 up0 up1 up2::
109 git remote update
110 git pull
111 up1 up2:: all
112 $(MAKE) test-dirty
113 up2 update2::
114 $(SUDO) $(MAKE) install
116 install: $(INSTSUB)
118 install-info: install-doc
120 doc docs: $(ORG_MAKE_DOC)
122 info html pdf card:
123 $(MAKE) -C doc $@
125 $(INSTSUB):
126 $(MAKE) -C $(@:install-%=%) install
128 autoloads: lisp
129 $(MAKE) -C $< $@
131 cleandirs:
132 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
134 clean: cleanlisp cleandoc
136 cleanall: cleandirs cleantest
137 -$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} \;
138 -$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
140 $(CLEANDIRS:%=clean%):
141 -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
143 ifneq ($(ORG_TO_LISP),)
144 cleanlisp: cleanaddcontrib
145 cleanaddcontrib:
146 $(RM) $(ORG_TO_LISP)
147 endif
149 cleanelc:
150 $(MAKE) -C lisp $@
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)