Makefile: adding files from contrib

* default.mk: Add customizatin variable ORG_ADD_CONTRIB with
  descriptiona and commented example.

* targets.mk: Strip leading path and trailing suffix from all elements
  of ORG_ADD_CONTRIB, then prefix with contrib/lisp and do wildcard
  expansion (this will also remove any invalid names); store the
  result in ORG_FROM_CONTRIB.  Strip /contrib from ORG_FROM_CONTRIB
  and store the result in ORG_TO_LISP.  If these are non-empty, copy
  the files from contrib/lisp/ into lisp/ before compilation and
  remove them when cleanlisp is called.
This commit is contained in:
Achim Gratz 2012-08-22 08:04:56 +02:00 committed by Bastien Guerry
parent 85d6b781e4
commit a90ff91350
2 changed files with 23 additions and 0 deletions

View file

@ -22,6 +22,10 @@ infodir = $(prefix)/info
# Define if you only need info documentation, the default includes html and pdf
#ORG_MAKE_DOC = info # html pdf
# Define if you want to include some (or all) files from contrib/lisp
# just the filename please (no path prefix, no .el suffix), maybe with globbing
#ORG_ADD_CONTRIB = org-e-* org-md org-export # e.g. the new exporter
# Where to create temporary files for the testsuite
# respect TMPDIR if it is already defined in the environment
TMPDIR ?= /tmp

View file

@ -10,6 +10,13 @@ SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
INSTSUB = $(SUBDIRS:%=install-%)
ORG_MAKE_DOC ?= info html pdf
ORG_FROM_CONTRIB = $(wildcard \
$(addsuffix .el, \
$(addprefix contrib/lisp/, \
$(basename \
$(notdir $(ORG_ADD_CONTRIB))))))
ORG_TO_LISP = $(ORG_FROM_CONTRIB:contrib/%=%)
ifneq ($(wildcard .git),)
GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
@ -44,6 +51,9 @@ config config-all::
$(info ========= Emacs executable and Installation paths)
$(foreach var,$(CONF_BASE),$(info $(var) = $($(var))$(EOL)))
$(foreach var,$(CONF_DEST),$(info $(var) = $(DESTDIR)$($(var))$(EOL)))
$(info ========= Additional files from contrib/lisp)
$(info ORG_FROM_CONTRIB =)
$(info $(ORG_TO_LISP:lisp/%=%))
config-test config-all::
$(info )
$(info ========= Test configuration)
@ -78,6 +88,9 @@ local.mk:
-@$(MAKE_LOCAL_MK)
all compile::
ifneq ($(ORG_FROM_CONTRIB),)
$(CP) $(ORG_FROM_CONTRIB) lisp/
endif
$(foreach dir, doc lisp, $(MAKE) -C $(dir) clean;)
compile compile-dirty::
$(MAKE) -C lisp $@
@ -127,6 +140,12 @@ cleanall: cleandirs cleantest
$(CLEANDIRS:%=clean%):
-$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
ifneq ($(ORG_TO_LISP),)
cleanlisp: cleanaddcontrib
cleanaddcontrib:
$(RM) $(ORG_TO_LISP)
endif
cleanutils: cleanUTILITIES
cleanrel: