improve comment in local.mk template
[org-mode.git] / targets.mk
blob01290cdd2bfdc21239776c77271048963fc02a3b
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 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 "oldorg:" to make "all" the default target,' \
46 -e '1 i ## change to your favourite default target' \
47 -e '1 i ## or provide your own defintion here' \
48 -e '1 i oldorg:' \
49 -e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
50 -e '$$ i ## See default.mk for further configuration options.' \
51 default.mk > $@
53 all compile::
54 $(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
55 compile compile-dirty::
56 $(MAKE) -C lisp $@
57 all clean-install::
58 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
60 check test:: compile
61 check test test-dirty::
62 -$(MKDIR) $(testdir)
63 TMPDIR=$(testdir) $(BTEST)
64 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
65 $(MAKE) cleantest
66 endif
68 up0 up1 up2::
69 git remote update
70 git pull
71 up1 up2:: all
72 $(MAKE) test-dirty
73 up2 update2::
74 $(SUDO) $(MAKE) install
76 install: $(INSTSUB)
78 install-info: install-doc
80 doc docs: $(ORG_MAKE_DOC)
82 info html pdf card:
83 $(MAKE) -C doc $@
85 $(INSTSUB):
86 $(MAKE) -C $(@:install-%=%) install
88 autoloads: lisp
89 $(MAKE) -C $< $@
91 cleandirs:
92 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
94 clean: cleanrel
95 $(MAKE) -C lisp clean
96 $(MAKE) -C doc clean
98 cleanall: cleandirs cleantest cleancontrib cleanutils
99 -$(FIND) . -name \*~ -o -name \*# -o -name .#\* -exec $(RM) {} \;
101 cleancontrib:
102 -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
104 cleanutils:
105 -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
107 cleanrel:
108 $(RMR) RELEASEDIR
109 $(RMR) org-7.*
110 $(RMR) org-7*zip org-7*tar.gz
112 cleanelc cleanlisp:
113 $(MAKE) -C lisp clean
114 -$(FIND) lisp -name \*~ -exec $(RM) {} \;
116 cleandoc cleandocs:
117 $(MAKE) -C doc clean
118 -$(FIND) doc -name \*~ -exec $(RM) {} \;
120 cleantest:
121 $(RMR) $(testdir)