Browse Source

move all version strings into org-install.el

	* targets.mk: check for release and git version and record this
	into environment variables for use in sub-make invocations; add
	new target "compile-dirty" that does not invoke "make clean" first
	* doc/Makefile, lisp/Makefile: remove git version check, since
	they are now provided by first-level make
	* lisp/Makefile: add insertion of version information into
	org-install.el, have org-install.el depend on LISPF rather than
	LISPC so that autoloads can be produced without compiling
	everything and remove insertion into org.el and re-compilation
	during install; add new target "compile-dirty" to support
	invocation from first-level make
	* lisp/org.el (org-version): remove determination of version
	information, show "N/A" if the information is not provided via
	org-install.el
Achim Gratz 13 years ago
parent
commit
6da2d089b0
4 changed files with 20 additions and 45 deletions
  1. 0 8
      doc/Makefile
  2. 6 10
      lisp/Makefile
  3. 2 26
      lisp/org.el
  4. 12 1
      targets.mk

+ 0 - 8
doc/Makefile

@@ -2,14 +2,6 @@ ifeq ($(MAKELEVEL), 0)
   $(error This make needs to be started as a sub-make from the toplevel directory.)
 endif
 
-GITVERSION	= $(shell git describe --abbrev=6 HEAD)
-ORGVERSION	= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
-GITSTATUS	= $(shell git status -uno --porcelain)
-DATE            = $(shell date +%Y-%m-%d)
-ifneq ("$(GITSTATUS)", "")
-  GITVERSION := $(GITVERSION).dirty
-endif
-
 .PHONY:		all info html pdf card manual guide install clean cleanall clean-install
 
 all:		info html pdf card

+ 6 - 10
lisp/Makefile

@@ -2,36 +2,32 @@ ifeq ($(MAKELEVEL), 0)
   $(error This make needs to be started as a sub-make from the toplevel directory.)
 endif
 
-GITVERSION	= $(shell git describe --abbrev=6 HEAD)
-GITSTATUS	= $(shell git status -uno --porcelain)
-ifneq ("$(GITSTATUS)", "")
-  GITVERSION := $(GITVERSION).dirty
-endif
-
 LISPO = org-install.el
 LISPF = $(subst $(LISPO),,$(wildcard *.el))
 LISPC = $(LISPF:%el=%elc)
 
 .PHONY:		all autoloads compile install clean cleanall clean-install
 
-all compile:	$(LISPC)
+all \
+compile \
+compile-dirty:	$(LISPC)
 
 autoloads:	$(LISPO)
 
-org-install.el:	$(LISPC)
+org-install.el:	$(LISPF)
 	$(BATCH) \
 	 --eval "(require 'autoload)" \
 	 --eval '(find-file "$(LISPO)")' \
 	 --eval '(erase-buffer)' \
 	 --eval '(mapc (lambda (x) (generate-file-autoloads (symbol-name x))) (quote ($(LISPF))))' \
 	 --eval '(insert "\n(provide (quote org-install))\n")' \
+	 --eval '(insert "\n(defconst org-release \"$(ORGVERSION)\"\n  \"The release version of org-mode.  Inserted by installing org-mode\n  or when a release is made.\")\n")' \
+	 --eval '(insert "\n(defconst org-git-version \"$(GITVERSION)\"\n  \"The Git version of org-mode.  Inserted by installing org-mode\n  or when a release is made.\")\n")' \
 	 --eval '(save-buffer)'
 
 install:	$(LISPF) compile autoloads
 	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
 	$(CP) $(LISPC) $(LISPF) $(LISPO) $(lispdir)
-	-$(SED) -e 's/^\((defconst org-git-version \).*/\1 "$(GITVERSION)"/;' org.el > $(lispdir)/org.el
-	$(MAKE) $(lispdir)/org.elc
 
 clean:
 	$(RM) *.elc

+ 2 - 26
lisp/org.el

@@ -7,7 +7,6 @@
 ;; Maintainer: Bastien Guerry <bzg at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 7.8.09
 ;;
 ;; This file is part of GNU Emacs.
 ;;
@@ -209,37 +208,14 @@ identifier."
 
 ;;; Version
 
-(defconst org-version "7.8.09"
-  "The version number of the file org.el.")
-
-(defconst org-git-version "N/A"
-  "The Git version of org-mode.  Inserted by installing org-mode
-  or when a release is made.")
-
-;;;###autoload
 (defun org-version (&optional here)
   "Show the org-mode version in the echo area.
 With prefix arg HERE, insert it at point."
   (interactive "P")
   (let* ((origin default-directory)
-	 (version org-version)
-	 (git-version org-git-version)
+	 (version (if (boundp 'org-release) org-release "N/A"))
+	 (git-version (if (boundp 'org-git-version) org-git-version "N/A"))
 	 (dir (concat (file-name-directory (locate-library "org")) "../" )))
-    (when (and (file-exists-p (expand-file-name ".git" dir))
-	       (executable-find "git"))
-      (unwind-protect
-	  (progn
-	    (cd dir)
-	    (when (eql 0 (shell-command "git describe --abbrev=4 HEAD"))
-	      (with-current-buffer "*Shell Command Output*"
-		(goto-char (point-min))
-		(setq git-version (buffer-substring (point) (point-at-eol))))
-	      (subst-char-in-string ?- ?. git-version t)
-	      (when (string-match "\\S-"
-				  (shell-command-to-string "git status -uno --porcelain"))
-		(setq git-version (concat git-version ".dirty")))
-	      (setq version (concat version " (" git-version ")"))))
-	(cd origin)))
     (setq version (format "Org-mode version %s (%s)" version git-version))
     (if here (insert version))
     (message version)))

+ 12 - 1
targets.mk

@@ -7,12 +7,23 @@ LISPDIRS	= lisp
 SUBDIRS		= doc $(LISPDIRS)
 INSTSUB         = $(SUBDIRS:%=install-%)
 
+GITVERSION	= $(shell git describe --abbrev=6 HEAD)
+ORGVERSION	= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
+GITSTATUS	= $(shell git status -uno --porcelain)
+DATE            = $(shell date +%Y-%m-%d)
+ifneq ("$(GITSTATUS)", "")
+  GITVERSION := $(GITVERSION).dirty
+endif
+
 .PHONY:	default all up2 update compile lisp doc \
 	install info html pdf card docs $(INSTSUB) \
 	autoloads cleanall clean cleancontrib cleanelc cleandoc cleanrel
 
-compile:	lisp
+compile::	lisp
 	$(MAKE) -C $< clean
+
+compile \
+compile-dirty::	lisp
 	$(MAKE) -C $< $@
 
 all \