clean up Makefile some more, keep autoloads around
[org-mode.git] / targets.mk
blobe775fa763e0b596af73eb262a32384a4e78b07ed
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:: lisp
52 $(MAKE) -C $< clean
53 all compile compile-dirty:: lisp
54 $(MAKE) -C $< $@
56 all clean-install::
57 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
59 check test:: all
60 check test test-dirty::
61 -$(MKDIR) $(testdir)
62 TMPDIR=$(testdir) $(BTEST)
63 ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
64 $(MAKE) cleantest
65 endif
67 up0 up1 up2::
68 git remote update
69 git pull
70 up1 up2:: all
71 $(MAKE) test-dirty
72 up2 update2::
73 $(SUDO) $(MAKE) install
75 install: $(INSTSUB)
77 install-info: install-doc
79 doc docs: $(ORG_MAKE_DOC)
81 info html pdf card:
82 $(MAKE) -C doc $@
84 $(INSTSUB):
85 $(MAKE) -C $(@:install-%=%) install
87 autoloads: lisp
88 $(MAKE) -C $< $@
90 cleandirs:
91 $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
93 clean: cleanrel
94 $(MAKE) -C lisp clean
95 $(MAKE) -C doc clean
97 cleanall: cleandirs cleantest cleancontrib cleanutils
98 -$(FIND) . -name \*~ -exec $(RM) {} \;
100 cleancontrib:
101 -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
103 cleanutils:
104 -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
106 cleanrel:
107 $(RMR) RELEASEDIR
108 $(RMR) org-7.*
109 $(RMR) org-7*zip org-7*tar.gz
111 cleanelc cleanlisp:
112 $(MAKE) -C lisp clean
113 -$(FIND) lisp -name \*~ -exec $(RM) {} \;
115 cleandoc cleandocs:
116 $(MAKE) -C doc clean
117 -$(FIND) doc -name \*~ -exec $(RM) {} \;
119 cleantest:
120 $(RMR) $(testdir)