Makefile: avoid spurious recompilations of documentation
[org-mode.git] / targets.mk
blob2dc3a3b05cf95ffa7f2142b0ecb5432a0e81dd18
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
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 cleancontrib cleanutils cleanrel clean-install \
28 cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest
29 compile compile-dirty uncompiled
31 oldorg: compile info # what the old makefile did when no target was specified
32 uncompiled: cleanlisp autoloads # for developing
33 refcard: card
34 update update2:: up0 all
36 .PRECIOUS: local.mk
37 local.mk:
38 $(info ======================================================)
39 $(info = Invoke "make help" for a synopsis of make targets. =)
40 $(info = Created a default local.mk template. =)
41 $(info = Setting "oldorg" as the default target. =)
42 $(info = Please adapt local.mk to your local setup! =)
43 $(info ======================================================)
44 -@$(SED) -n \
45 -e '1 i ## Remove the following line to make "all" the default target' \
46 -e '1 i oldorg:' \
47 -e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
48 -e '$$ i ## See default.mk for further configuration options.' \
49 default.mk > $@
51 all compile:: doc lisp
52 $(MAKE) -C $< clean
53 compile compile-dirty:: lisp
54 $(MAKE) -C $< $@
55 all clean-install::
56 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
58 check test:: all
59 check test test-dirty::
60 -$(MKDIR) $(testdir)
61 TMPDIR=$(testdir) $(BTEST)
62 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
63 $(MAKE) cleantest
64 endif
66 up0 up1 up2::
67 git remote update
68 git pull
69 up1 up2:: all
70 $(MAKE) test-dirty
71 up2 update2::
72 $(SUDO) $(MAKE) install
74 install: $(INSTSUB)
76 install-info: install-doc
78 doc docs: $(ORG_MAKE_DOC)
80 info html pdf card:
81 $(MAKE) -C doc $@
83 $(INSTSUB):
84 $(MAKE) -C $(@:install-%=%) install
86 autoloads: lisp
87 $(MAKE) -C $< $@
89 cleandirs:
90 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
92 clean: cleanrel
93 $(MAKE) -C lisp clean
94 $(MAKE) -C doc clean
96 cleanall: cleandirs cleantest cleancontrib cleanutils
97 -$(FIND) . -name \*~ -exec $(RM) {} \;
99 cleancontrib:
100 -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
102 cleanutils:
103 -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
105 cleanrel:
106 $(RMR) RELEASEDIR
107 $(RMR) org-7.*
108 $(RMR) org-7*zip org-7*tar.gz
110 cleanelc cleanlisp:
111 $(MAKE) -C lisp clean
112 -$(FIND) lisp -name \*~ -exec $(RM) {} \;
114 cleandoc cleandocs:
115 $(MAKE) -C doc clean
116 -$(FIND) doc -name \*~ -exec $(RM) {} \;
118 cleantest:
119 $(RMR) $(testdir)