Do not croak when git is not available
[org-mode.git] / targets.mk
blob49795fc3953b1188d4f77d1fc171e188979268d3
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 install info html pdf card docs $(INSTSUB) \
25 autoloads cleanall clean cleancontrib cleanelc cleandoc cleanrel
27 all \
28 compile:: lisp
29 $(MAKE) -C $< clean
31 compile \
32 compile-dirty:: lisp
33 $(MAKE) -C $< $@
35 all \
36 clean-install:: $(SUBDIRS)
37 $(foreach dir, $?, $(MAKE) -C $(dir) $@;)
39 up2: update
40 sudo ${MAKE} install
42 update:
43 git pull
44 ${MAKE} clean
45 ${MAKE} all
47 install: $(INSTSUB)
49 install-info: install-doc
51 docs: info html pdf card
53 info html pdf card:
54 $(MAKE) -C doc $@
56 $(INSTSUB):
57 $(MAKE) -C $(@:install-%=%) install
59 autoloads: lisp maint.mk
60 $(MAKE) -C $< $@
62 cleanall: $(SUBDIRS)
63 $(foreach dir, $?, $(MAKE) -C $(dir) $@;)
64 -$(FIND) . -name \*~ -exec $(RM) {} \;
66 clean: cleanrel
67 $(MAKE) -C lisp clean
68 $(MAKE) -C doc clean
69 -$(FIND) . -name \*~ -exec $(RM) {} \;
71 cleancontrib:
72 -$(FIND) contrib -name \*~ -exec $(RM) {} \;
74 cleanrel:
75 $(RMR) RELEASEDIR
76 $(RMR) org-7.*
77 $(RMR) org-7*zip org-7*tar.gz