From 6da2d089b0c0f165134e33e12267a51a9ac41f52 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sun, 6 Nov 2011 17:53:45 +0100 Subject: [PATCH] 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 --- doc/Makefile | 8 -------- lisp/Makefile | 16 ++++++---------- lisp/org.el | 28 ++-------------------------- targets.mk | 13 ++++++++++++- 4 files changed, 20 insertions(+), 45 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index 3ca04483a..04c4fb81d 100644 --- a/doc/Makefile +++ b/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 diff --git a/lisp/Makefile b/lisp/Makefile index 6ac5447a8..6b6739249 100644 --- a/lisp/Makefile +++ b/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 diff --git a/lisp/org.el b/lisp/org.el index c76103878..988815787 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7,7 +7,6 @@ ;; Maintainer: Bastien Guerry ;; 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))) diff --git a/targets.mk b/targets.mk index d61b6e247..ab333a2b3 100644 --- a/targets.mk +++ b/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 \ -- 2.11.4.GIT