Addendum to 50a434bb9faa23396c2619031bd07a2fa2d30d0b
[org-mode.git] / targets.mk
blob5db69f3c401164dd25d2719022d068bddc880360
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 SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
9 INSTSUB = $(SUBDIRS:%=install-%)
10 ORG_MAKE_DOC ?= info html pdf
12 ifneq ($(wildcard .git),)
13 GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
14 ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
15 GITSTATUS ?= $(shell git status -uno --porcelain)
16 else
17 GITVERSION ?= N/A
18 ORGVERSION ?= N/A
19 endif
20 DATE = $(shell date +%Y-%m-%d)
21 ifneq ($(GITSTATUS),)
22 GITVERSION := $(GITVERSION:.dirty=).dirty
23 endif
25 .PHONY: all oldorg update update2 up0 up1 up2 compile $(SUBDIRS) \
26 check test install info html pdf card doc docs $(INSTSUB) \
27 autoloads cleanall clean \
28 cleancontrib cleantesting cleanutils
29 cleanrel clean-install cleanelc cleandirs \
30 cleanlisp cleandoc cleandocs cleantest \
31 compile compile-single compile-source compile-dirty uncompiled \
32 config config-test config-exe config-all config-eol
34 CONF_BASE = EMACS DESTDIR
35 CONF_DEST = lispdir infodir datadir testdir
36 CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA
37 CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
38 CONF_CALL = BATCH BATCHL ELCDIR BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
39 config-eol:: EOL = \#
40 config-eol:: config-all
41 config config-all::
42 $(info )
43 $(info ========= Emacs executable and Installation paths)
44 $(foreach var,$(CONF_BASE),$(info $(var) = $($(var))$(EOL)))
45 $(foreach var,$(CONF_DEST),$(info $(var) = $(DESTDIR)$($(var))$(EOL)))
46 config-test config-all::
47 $(info )
48 $(info ========= Test configuration)
49 $(foreach var,$(CONF_TEST),$(info $(var) = $($(var))$(EOL)))
50 config-exe config-all::
51 $(info )
52 $(info ========= Executables used by make)
53 $(foreach var,$(CONF_EXEC),$(info $(var) = $($(var))$(EOL)))
54 config-cmd config-all::
55 $(info )
56 $(info ========= Commands used by make)
57 $(foreach var,$(CONF_CALL),$(info $(var) = $($(var))$(EOL)))
58 config config-test config-exe config-all::
59 $(info )
61 oldorg: compile info # what the old makefile did when no target was specified
62 uncompiled: cleanlisp autoloads # for developing
63 refcard: card
64 update update2:: up0 all
66 .PRECIOUS: local.mk
67 local.mk:
68 $(info ======================================================)
69 $(info = Invoke "make help" for a synopsis of make targets. =)
70 $(info = Created a default local.mk template. =)
71 $(info = Setting "oldorg" as the default target. =)
72 $(info = Please adapt local.mk to your local setup! =)
73 $(info ======================================================)
74 -@$(MAKE_LOCAL_MK)
76 all compile::
77 $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
78 compile compile-dirty compile-single compile-source::
79 $(MAKE) -C lisp $@
80 all clean-install::
81 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
83 check test:: compile
84 check test test-dirty::
85 -$(MKDIR) $(testdir)
86 TMPDIR=$(testdir) $(BTEST)
87 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
88 $(MAKE) cleantest
89 endif
91 up0 up1 up2::
92 git remote update
93 git pull
94 up1 up2:: all
95 $(MAKE) test-dirty
96 up2 update2::
97 $(SUDO) $(MAKE) install
99 install: $(INSTSUB)
101 install-info: install-doc
103 doc docs: $(ORG_MAKE_DOC)
105 info html pdf card:
106 $(MAKE) -C doc $@
108 $(INSTSUB):
109 $(MAKE) -C $(@:install-%=%) install
111 autoloads: lisp
112 $(MAKE) -C $< $@
114 cleandirs:
115 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
117 clean: cleanrel
118 $(MAKE) -C lisp clean
119 $(MAKE) -C doc clean
121 cleanall: cleandirs cleantest cleancontrib cleantesting cleanutils
122 -$(FIND) . -name \*~ -o -name \*# -o -name .#\* -exec $(RM) {} \;
124 cleancontrib:
125 -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
127 cleantesting:
128 -$(FIND) testing -name \*~ -o -name \*.elc -exec $(RM) {} \;
130 cleanutils:
131 -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
133 cleanrel:
134 $(RMR) RELEASEDIR
135 $(RMR) org-7.*
136 $(RMR) org-7*zip org-7*tar.gz
138 cleanelc cleanlisp:
139 $(MAKE) -C lisp clean
140 -$(FIND) lisp -name \*~ -exec $(RM) {} \;
142 cleandoc cleandocs:
143 $(MAKE) -C doc clean
144 -$(FIND) doc -name \*~ -exec $(RM) {} \;
146 cleantest:
147 $(RMR) $(testdir)