Merge branch 'local-Makefile' into test-makefile-merge
[org-mode.git] / targets.mk
blob94387f4768e818c32935df50a8e7f650a6f6927e
1 .NOTPARALLEL: .PHONY
2 # Additional distribution files
3 DISTFILES_extra= Makefile request-assign-future.txt contrib etc
4 .EXPORT_ALL_VARIABLES:
6 LISPDIRS = lisp
7 SUBDIRS = doc etc $(LISPDIRS)
8 INSTSUB = $(SUBDIRS:%=install-%)
10 ifneq ($(wildcard .git),)
11 GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
12 ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
13 GITSTATUS ?= $(shell git status -uno --porcelain)
14 else
15 GITVERSION ?= N/A
16 ORGVERSION ?= N/A
17 endif
18 DATE = $(shell date +%Y-%m-%d)
19 ifneq ($(GITSTATUS),)
20 GITVERSION := $(GITVERSION).dirty
21 endif
23 .PHONY: default all up2 update compile lisp doc etc \
24 check test install info html pdf card docs $(INSTSUB) \
25 autoloads cleanall clean cleancontrib cleanrel clean-install \
26 cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest
28 all \
29 compile:: lisp
30 $(MAKE) -C $< clean
32 compile \
33 compile-dirty:: lisp
34 $(MAKE) -C $< $@
36 all \
37 clean-install:: $(SUBDIRS)
38 $(foreach dir, $?, $(MAKE) -C $(dir) $@;)
40 check test:: all
42 check test \
43 test-dirty::
44 -$(MKDIR) $(testdir)
45 TMPDIR=$(testdir) $(BTEST)
46 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
47 $(MAKE) cleantest
48 endif
50 up2: update
51 $(SUDO) $(MAKE) install
53 update:
54 git remote update
55 git pull
56 $(MAKE) check
58 install: $(INSTSUB)
60 install-info: install-doc
62 docs: info html pdf card
64 info html pdf card:
65 $(MAKE) -C doc $@
67 $(INSTSUB):
68 $(MAKE) -C $(@:install-%=%) install
70 autoloads: lisp
71 $(MAKE) -C $< $@
73 cleandirs: $(SUBDIRS)
74 $(foreach dir, $?, $(MAKE) -C $(dir) cleanall;)
76 clean: cleanrel
77 $(MAKE) -C lisp clean
78 $(MAKE) -C doc clean
80 cleanall: cleandirs cleantest
81 -$(FIND) . -name \*~ -exec $(RM) {} \;
83 cleancontrib:
84 -$(FIND) contrib -name \*~ -exec $(RM) {} \;
86 cleanrel:
87 $(RMR) RELEASEDIR
88 $(RMR) org-7.*
89 $(RMR) org-7*zip org-7*tar.gz
91 cleanelc cleanlisp:
92 $(MAKE) -C lisp clean
93 -$(FIND) lisp -name \*~ -exec $(RM) {} \;
95 cleandoc cleandocs:
96 $(MAKE) -C doc clean
97 -$(FIND) doc -name \*~ -exec $(RM) {} \;
99 cleantest:
100 $(RMR) $(testdir)