Ver código fonte

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.
Achim Gratz 12 anos atrás
pai
commit
a90ff91350
2 arquivos alterados com 23 adições e 0 exclusões
  1. 4 0
      default.mk
  2. 19 0
      targets.mk

+ 4 - 0
default.mk

@@ -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

+ 19 - 0
targets.mk

@@ -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: