summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2012-04-28 19:24:39 +0200
committerBastien Guerry <bzg@altern.org>2012-05-18 07:45:44 +0200
commitdf89e3cd0c7c949cd84b538dcd62e1b83a090e2a (patch)
tree0540ace1f5fcbf5d6e9dbf9057d7cfb5556a4798
parent4f60b5f3a525e1fee299c5222b779bb2a24fc666 (diff)
downloadorg-mode-df89e3cd0c7c949cd84b538dcd62e1b83a090e2a.tar.gz
cleanup in lisp/Makefile, targets; create org-fixup.el, remove version definition
* UTILITIES/org-fixup.el: new file, has functions to create org-version.el and org-install.el, now use by the build system. * lisp/Makefile: delete said definitions, now sourced from toplevel make. "clean" and "cleanall" should do the same thing here, make them aliases, ditto for "all" and "compile". Both autoload files must be .PHONY and depend only on each other for correct ordering. Make "compile-dirty" actually do that again (i.e. no implied "clean", but "cleanauto"). Remove autoload files directly after install, so that they will only be present when explicitly requested by "autoloads". Create "org-version.el" before compilation as it is mandatory. Remove $(ORG_MAKE_INSTALL) and $(ORG_MAKE_VERSION), source from default.mk/local.mk. * default.mk: move definitions for $(ORG_MAKE_INSTALL) and $(ORG_MAKE_VERSION) here so that they can be more easily configured. Remove definition of "org-release" from $(BATCH) and $(BTEST), now sourced from "org-version.el". * targets.mk: target reorganization, introduce "stop" targets to prevent cleaning of org-version.el. Use new targets for "oldorg" to make it more robust in case of errors. New target "cleanutils" to remove any "*.elc" files that may have been produced there and add this target to "cleanall". Do the same in cleancontrib.
-rw-r--r--UTILITIES/org-fixup.el74
-rw-r--r--default.mk34
-rw-r--r--lisp/Makefile83
-rw-r--r--targets.mk36
4 files changed, 143 insertions, 84 deletions
diff --git a/UTILITIES/org-fixup.el b/UTILITIES/org-fixup.el
new file mode 100644
index 0000000..17f8057
--- /dev/null
+++ b/UTILITIES/org-fixup.el
@@ -0,0 +1,74 @@
+;;; org-fixup.el - to make life easier for folks without GNU make
+;;
+;; Author: Achim Gratz
+;; Keywords: outlines, hypermedia, calendar, wp
+;; Homepage: http://orgmode.org
+;;
+;; This file is not yet part of GNU Emacs.
+;;
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+
+(require 'find-func)
+(require 'org-compat)
+(require 'autoload)
+
+(defun org-make-org-version (org-release org-git-version odt-dir)
+ (find-file "org-version.el")
+ (erase-buffer)
+ (insert ";;; org-version.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
+ (insert ";;;\#\#\#autoload\n")
+ (insert "(defconst org-release \"" org-release "\"\n")
+ (insert " \"The release version of org-mode.\n")
+ (insert " Inserted by installing org-mode or when a release is made.\")\n")
+ (insert ";;;\#\#\#autoload\n")
+ (insert "(defconst org-git-version \"" org-git-version "\"\n")
+ (insert " \"The Git version of org-mode.\n")
+ (insert " Inserted by installing org-mode or when a release is made.\")\n")
+ (insert ";;;\#\#\#autoload\n")
+ (insert "(defconst org-odt-data-dir \"" odt-dir "\"\n")
+ (insert " \"The location of ODT styles.\")\n")
+ (insert "\f\n;; Local Variables:\n;; version-control: never\n")
+ (insert ";; no-byte-compile: t\n")
+ (insert ";; coding: utf-8\n;; End:\n;;; org-version.el ends here\n")
+ (save-buffer))
+
+(defun org-make-org-install (absfile)
+ (find-file absfile)
+ (erase-buffer)
+ (insert ";;; org-install.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")
+ (let ((files (directory-files (file-name-directory absfile) 'full "^[^.#~]*\\.el$")))
+ (mapc (lambda (f) (generate-file-autoloads f)) files))
+ (insert "\f\n(provide 'org-install)\n")
+ (insert "\f\n;; Local Variables:\n;; version-control: never\n")
+ (insert ";; no-byte-compile: t\n;; no-update-autoloads: t\n")
+ (insert ";; coding: utf-8\n;; End:\n;;; org-install.el ends here\n")
+ (save-buffer))
+
+(defun org-fixup ()
+ (message "might as well do something, but not now")
+)
+
+(provide 'org-fixup)
+
+
+;; Local Variables:
+;; no-byte-compile: t
+;; coding: utf-8
+;; End:
+;;; org-fixup.el ends here
diff --git a/default.mk b/default.mk
index 72a3e5f..7bfd224 100644
--- a/default.mk
+++ b/default.mk
@@ -45,9 +45,12 @@ BTEST_EXTRA = # extra packages to require for testing
# How to run tests
req-ob-lang = --eval '(require '"'"'ob-$(ob-lang))'
req-extra = --eval '(require '"'"'$(req))'
-BTEST = $(EMACS) -batch -Q \
- $(BTEST_PRE) -L lisp/ -L testing/ $(BTEST_POST) \
- --eval '(defconst org-release "$(ORGVERSION)-Test")' \
+BTEST = $(BATCH) \
+ $(BTEST_PRE) \
+ --eval '(add-to-list '"'"'load-path "lisp")' \
+ --eval '(add-to-list '"'"'load-path "testing")' \
+ $(BTEST_POST) \
+ -l org-install.el \
-l testing/org-test.el \
$(foreach ob-lang,$(BTEST_OB_LANGUAGES),$(req-ob-lang)) \
$(foreach req,$(BTEST_EXTRA),$(req-extra)) \
@@ -55,16 +58,13 @@ BTEST = $(EMACS) -batch -Q \
-f org-test-run-batch-tests
# Using emacs in batch mode.
-BATCH = $(EMACS) -batch -Q \
- -L . \
- --eval '(defconst org-release "$(ORGVERSION)-Make")' \
+BATCH = $(EMACS) -batch -Q
+# BATCH = $(EMACS) -batch -vanilla # XEmacs
# How to byte-compile the whole source directory
ELCDIR = $(BATCH) \
- --eval '(batch-byte-recompile-directory 0)'
-
-# How to byte-compile a single source file
-ELC = $(BATCH) -f batch-byte-compile
+ --eval '(add-to-list '"'"'load-path ".")' \
+ --eval '(batch-byte-recompile-directory 0)'
# How to make a pdf file from a texinfo file
TEXI2PDF = texi2pdf --batch --clean
@@ -104,3 +104,17 @@ SUDO = sudo
# Name of the program to install info files
# INSTALL_INFO = ginstall-info # Debian: avoid harmless warning message
INSTALL_INFO = install-info
+
+# How to generate org-install.el
+MAKE_ORG_INSTALL = $(BATCH) \
+ --eval '(add-to-list '"'"'load-path ".")' \
+ --eval '(load "org-compat.el")' \
+ --eval '(load "../UTILITIES/org-fixup.el")' \
+ --eval '(org-make-org-install "$(PWD)/lisp/org-install.el")'
+
+# How to generate org-version.el
+MAKE_ORG_VERSION = $(BATCH) \
+ --eval '(add-to-list '"'"'load-path ".")' \
+ --eval '(load "org-compat.el")' \
+ --eval '(load "../UTILITIES/org-fixup.el")' \
+ --eval '(org-make-org-version "$(ORGVERSION)" "$(GITVERSION)" "$(datadir)")'
diff --git a/lisp/Makefile b/lisp/Makefile
index ed02a95..617d53e 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -1,80 +1,51 @@
-ORG-INSTALL = $(BATCH) \
- --eval '(require '"'"'autoload)' \
- --eval '(find-file "org-install.el")' \
- --eval '(erase-buffer)' \
- --eval '(insert ";;; org-install.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")' \
- --eval '(mapc (lambda (x) (generate-file-autoloads (symbol-name x)))\
- (quote ($(LISPF) org-version.el)))' \
- --eval '(insert "\f\n(provide '"'"'org-install)\n")' \
- --eval '(insert ";; Local Variables:\n;; version-control: never\n")' \
- --eval '(insert ";; no-byte-compile: t\n;; no-update-autoloads: t\n")' \
- --eval '(insert ";; coding: utf-8\n;; End:\n;;; org-install.el ends here\n")' \
- --eval '(save-buffer)'
-ORG-VERSION = $(BATCH) \
- --eval '(find-file "org-version.el")' \
- --eval '(erase-buffer)' \
- --eval '(insert ";;; org-version.el --- autogenerated file, do not edit\n;;\n;;; Code:\n")' \
- --eval '(insert ";;;\#\#\#autoload\n")' \
- --eval '(insert "(defconst org-release \"$(ORGVERSION)\"\n")' \
- --eval '(insert " \"The release version of org-mode.\n")' \
- --eval '(insert " Inserted by installing org-mode or when a release is made.\")\n")' \
- --eval '(insert ";;;\#\#\#autoload\n")' \
- --eval '(insert "(defconst org-git-version \"$(GITVERSION)\"\n")' \
- --eval '(insert " \"The Git version of org-mode.\n")' \
- --eval '(insert " Inserted by installing org-mode or when a release is made.\")\n")' \
- --eval '(insert ";;;\#\#\#autoload\n")' \
- --eval '(insert "(defconst org-odt-data-dir \"$(datadir)\"\n")' \
- --eval '(insert " \"The location of ODT styles.\")\n")' \
- --eval '(insert ";; Local Variables:\n;; version-control: never\n")' \
- --eval '(insert ";; no-byte-compile: t\n")' \
- --eval '(insert ";; coding: utf-8\n;; End:\n;;; org-version.el ends here\n")' \
- --eval '(save-buffer)'
--include local.mk # optional local customization
-
.NOTPARALLEL: # always run this make serially
.SUFFIXES: # we don't need default suffix rules
ifeq ($(MAKELEVEL), 0)
$(error This make needs to be started as a sub-make from the toplevel directory.)
endif
-LISPO = org-install.el org-version.el # autogenerated files
-LISPF = $(filter-out $(LISPO),$(wildcard *.el))
+LISPV = org-version.el
+LISPI = org-install.el
+LISPA = $(LISPV) $(LISPI)
+LISPF = $(filter-out $(LISPA),$(wildcard *.el))
LISPC = $(LISPF:%el=%elc)
-.PHONY: all compile compile-dirty \
- autoloads \
- install clean cleanauto cleanall clean-install \
- org-version.el
+NOSTOP = all compile compile-dirty
+DOSTOP = compile-stop compile-stop-dirty
+
+.PHONY: $(NOSTOP) $(DOSTOP) \
+ autoloads $(LISPA) \
+ install clean cleanauto cleanall clean-install \
-all \
-compile \
-compile-dirty: cleanauto org-version.el
+# do not clean here, done in toplevel make
+$(NOSTOP) $(DOSTOP):: $(LISPV)
$(ELCDIR)
+$(NOSTOP)::
+ $(MAKE) cleanauto
-autoloads: $(LISPO)
+autoloads: $(LISPA)
-org-version.el: $(LISPF)
+$(LISPV):
@echo "org-version: $(ORGVERSION) ($(GITVERSION))"
- @$(ORG-VERSION)
+ @$(MAKE_ORG_VERSION)
-org-install.el: org-version.el
- $(ORG-INSTALL)
+$(LISPI): $(LISPV)
+ @echo "org-install: $(ORGVERSION) ($(GITVERSION))"
+ $(MAKE_ORG_INSTALL)
-install: $(LISPF) compile autoloads
+install: $(LISPF) compile
if [ ! -d $(DESTDIR)$(lispdir) ] ; then \
$(MKDIR) $(DESTDIR)$(lispdir) ; \
fi ;
- $(CP) $(LISPC) $(LISPF) $(LISPO) $(DESTDIR)$(lispdir)
+ $(MAKE) autoloads
+ $(CP) $(LISPC) $(LISPF) $(LISPA) $(DESTDIR)$(lispdir)
+ $(MAKE) cleanauto
-clean:
+cleanauto clean cleanall::
+ $(RM) $(LISPA) $(LISPA:%el=%elc)
+clean cleanall::
$(RM) *.elc
-cleanauto: # internal target
- $(RM) $(LISPO) $(LISPO:%el=%elc)
-
-cleanall:
- $(RM) *.elc $(LISPO)
-
clean-install:
if [ -d $(DESTDIR)$(lispdir) ] ; then \
$(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* ; \
diff --git a/targets.mk b/targets.mk
index 4ad5c5f..ca9863a 100644
--- a/targets.mk
+++ b/targets.mk
@@ -1,10 +1,11 @@
+.EXPORT_ALL_VARIABLES:
.NOTPARALLEL: .PHONY
# Additional distribution files
DISTFILES_extra= Makefile request-assign-future.txt contrib etc
-.EXPORT_ALL_VARIABLES:
LISPDIRS = lisp
-SUBDIRS = doc etc $(LISPDIRS)
+OTHERDIRS = doc etc
+SUBDIRS = $(OTHERDIRS) $(LISPDIRS)
INSTSUB = $(SUBDIRS:%=install-%)
ORG_MAKE_DOC ?= info html pdf
@@ -23,11 +24,11 @@ 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 \
+ autoloads cleanall clean cleancontrib cleanutils cleanrel clean-install \
cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest \
- compile compile-dirty uncompiled
+ compile compile-stop compile-dirty compile-stop-dirty uncompiled
-oldorg: compile autoloads info # what the old makefile did when no target was specified
+oldorg: compile-stop info # what the old makefile did when no target was specified
uncompiled: cleanlisp autoloads # for developing
refcard: card
update update2:: up0 all
@@ -47,24 +48,20 @@ local.mk:
-e '$$ i ## See default.mk for further configuration options.' \
default.mk > $@
-all \
-compile:: lisp
+all compile-stop compile:: lisp
$(MAKE) -C $< clean
-
-compile \
-compile-dirty:: lisp
+compile compile-stop compile-dirty compile-stop-dirty:: lisp
$(MAKE) -C $< $@
-all \
-clean-install::
+all clean-install::
$(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) $@;)
check test:: all
-
-check test \
-test-dirty::
+check test test-dirty::
-$(MKDIR) $(testdir)
+ $(MAKE) autoloads
TMPDIR=$(testdir) $(BTEST)
+ $(MAKE) -C lisp cleanauto
ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection
$(MAKE) cleantest
endif
@@ -75,7 +72,7 @@ up0 up1 up2::
up1 up2:: all
$(MAKE) test-dirty
up2 update2::
- $(SUDO) $(MAKE) install
+ $(SUDO) $(MAKE) install-dirty
install: $(INSTSUB)
@@ -99,11 +96,14 @@ clean: cleanrel
$(MAKE) -C lisp clean
$(MAKE) -C doc clean
-cleanall: cleandirs cleantest cleancontrib
+cleanall: cleandirs cleantest cleancontrib cleanutils
-$(FIND) . -name \*~ -exec $(RM) {} \;
cleancontrib:
- -$(FIND) contrib -name \*~ -exec $(RM) {} \;
+ -$(FIND) contrib -name \*~ -o -name \*.elc -exec $(RM) {} \;
+
+cleanutils:
+ -$(FIND) UTILITIES -name \*~ -o -name \*.elc -exec $(RM) {} \;
cleanrel:
$(RMR) RELEASEDIR