1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-03 08:30:03 +00:00
org-mode/targets.mk
Achim Gratz 687766c922 Introduce compatibility and convenience targets, local.mk template, add "helpall"
* Makefile: new target "helpall" to document all targets, while "help"
  continues to show a brief subset.

* default.mk: add cutlines for sed to produce local.mk with.

* targets.mk: add target "local.mk" to produce an (empty) local.mk
  configuration template when it isn't already present.  Ignore any
  error when making this target since sed might not be present on all
  systems.  Redefine target "update" to not include testing, similarly
  add target "update2" to additionally install without test.  Add
  targets "up0" to stop after git pull and "up1" to stop after test,
  while "up2" continues to do everything and then installs.  Complete
  .PHONY target list.  Add "refcard" target for compatibility with old
  make.  Clean contrib in "cleanall", too.
2012-04-23 21:42:08 +02:00

118 lines
2.6 KiB
Makefile

.NOTPARALLEL: .PHONY
# Additional distribution files
DISTFILES_extra= Makefile request-assign-future.txt contrib etc
.EXPORT_ALL_VARIABLES:
LISPDIRS = lisp
SUBDIRS = doc etc $(LISPDIRS)
INSTSUB = $(SUBDIRS:%=install-%)
ORG_MAKE_DOC ?= info html pdf
ifneq ($(wildcard .git),)
GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
GITSTATUS ?= $(shell git status -uno --porcelain)
else
GITVERSION ?= N/A
ORGVERSION ?= N/A
endif
DATE = $(shell date +%Y-%m-%d)
ifneq ($(GITSTATUS),)
GITVERSION := $(GITVERSION).dirty
endif
.PHONY: all oldorg update update2 up0 up1 up2 compile $(SUBDIRS) \
check test install info html pdf card doc docs $(INSTSUB) \
autoloads cleanall clean cleancontrib cleanrel clean-install \
cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest \
compile compile-dirty
oldorg: compile autoloads info # what the old makefile did when no target was specified
refcard: card
update update2:: up0 all
.PRECIOUS: local.mk
local.mk:
$(info ==========================================)
$(info Created a local.mk template.)
$(info Please adapt local.mk to your local setup!)
$(info ==========================================)
-@$(SED) -n \
-e '/-8<-/,/->8-/ {s/^\(\s*[^#]\)/#\1/;p}' \
-e '$$ i ## See default.mk for further configuration options.' \
default.mk > $@
all \
compile:: lisp
$(MAKE) -C $< clean
compile \
compile-dirty:: lisp
$(MAKE) -C $< $@
all \
clean-install::
$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
check test:: all
check test \
test-dirty::
-$(MKDIR) $(testdir)
TMPDIR=$(testdir) $(BTEST)
ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
$(MAKE) cleantest
endif
up0 up1 up2::
git remote update
git pull
up1 up2:: all
$(MAKE) test-dirty
up2 update2::
$(SUDO) $(MAKE) install
install: $(INSTSUB)
install-info: install-doc
doc docs: $(ORG_MAKE_DOC)
info html pdf card:
$(MAKE) -C doc $@
$(INSTSUB):
$(MAKE) -C $(@:install-%=%) install
autoloads: lisp
$(MAKE) -C $< $@
cleandirs:
$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)
clean: cleanrel
$(MAKE) -C lisp clean
$(MAKE) -C doc clean
cleanall: cleandirs cleantest cleancontrib
-$(FIND) . -name \*~ -exec $(RM) {} \;
cleancontrib:
-$(FIND) contrib -name \*~ -exec $(RM) {} \;
cleanrel:
$(RMR) RELEASEDIR
$(RMR) org-7.*
$(RMR) org-7*zip org-7*tar.gz
cleanelc cleanlisp:
$(MAKE) -C lisp clean
-$(FIND) lisp -name \*~ -exec $(RM) {} \;
cleandoc cleandocs:
$(MAKE) -C doc clean
-$(FIND) doc -name \*~ -exec $(RM) {} \;
cleantest:
$(RMR) $(testdir)