emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/with-editor 7b6ac3a 026/140: base the Makefile on the same


From: Jonas Bernoulli
Subject: [nongnu] elpa/with-editor 7b6ac3a 026/140: base the Makefile on the same template used for other packages
Date: Fri, 6 Aug 2021 12:51:13 -0400 (EDT)

branch: elpa/with-editor
commit 7b6ac3acf02fcfe118685011d46bb8f6b5cc493c
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    base the Makefile on the same template used for other packages
    
    Beside the obvious differences (the package specific values for
    (`PKG', `DEPS', `DOMAIN' and `MANUAL_HTML_ARGS) this only diverges
    from the Makefiles of other packages that use the same template in
    that an additional target `authors' is available and in that `EFLAGS'
    is non-empty.
    
    Compared to the old Makefile the most significant breaking change is
    that there no longer exists a `bump-versions' target.  To bump the
    versions one still only has to edit one file, but that's now the
    library, not the Makefile.
    
    Furthermore the autoloads file is now being created automatically, and
    the manual can be exported to more formats and the results can easily
    be published on the webpage.
---
 .gitignore      |   5 +-
 Makefile        | 188 +++++++++++++++++++++++++++++++++++---------------------
 with-editor.org |   1 -
 3 files changed, 123 insertions(+), 71 deletions(-)

diff --git a/.gitignore b/.gitignore
index bf12a97..23df18b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
-*.info
+/with-editor
+/with-editor.html
+/with-editor.info
+/with-editor.pdf
diff --git a/Makefile b/Makefile
index d26cdc0..42960f5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,59 +1,119 @@
-ELS = with-editor.el
+-include config.mk
 
-DEPS = dash
+PKG = with-editor
 
-TEXIPAGES = with-editor.texi
-INFOPAGES = with-editor.info
+ELS   = $(PKG).el
+ELCS  = $(ELS:.el=.elc)
+
+DEPS  = dash
 
-ELCS    = $(ELS:.el=.elc)
-DFLAGS  = $(addprefix -L ../,$(DEPS))
-EFLAGS ?= $(DFLAGS)
 EMACS  ?= emacs
-BATCH   = $(EMACS) -batch -Q -L . $(EFLAGS)
+EFLAGS ?=
+EFLAGS += --eval '(setq with-editor-emacsclient-executable nil)'
+DFLAGS ?= $(addprefix -L ../,$(DEPS))
+OFLAGS ?= -L ../dash -L ../org/lisp -L ../ox-texinfo+
 
-MAKEINFO     ?= makeinfo
-INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info)
+INSTALL_INFO     ?= $(shell command -v ginstall-info || printf install-info)
+MAKEINFO         ?= makeinfo
+MANUAL_HTML_ARGS ?= --css-ref /assets/page.css
 
-WITH_EDITOR_VERSION = 2.5.7
-ASYNC_VERSION       = 1.9
-DASH_VERSION        = 2.13.0
+VERSION := $(shell test -e .git && \
+       git tag | cut -c2- | sort --version-sort | tail -1)
 
-.PHONY: help clean AUTHORS.md
+all: lisp info
+doc: info html html-dir pdf
 
 help:
-       $(info make all           - compile elisp and manual)
-       $(info make lisp          - compile elisp)
-       $(info make info          - generate info manual)
-       $(info make clean         - remove generated files)
-       $(info )
-       $(info Release Managment)
-       $(info =================)
-       $(info )
-       $(info make authors       - generate AUTHORS.md)
-       $(info make bump-versions - bump versions for release)
+       $(info make all          - generate lisp and manual)
+       $(info make doc          - generate most manual formats)
+       $(info make lisp         - generate byte-code and autoloads)
+       $(info make texi         - generate texi manual)
+       $(info make info         - generate info manual)
+       $(info make html         - generate html manual file)
+       $(info make html-dir     - generate html manual directory)
+       $(info make pdf          - generate pdf manual)
+       $(info make authors      - generate AUTHORS.md)
+       $(info make preview      - preview html manual)
+       $(info make publish      - publish html manual)
+       $(info make clean        - remove most generated files)
+       $(info make clean-texi   - remove (tracked) texi manual)
+       $(info make clean-all    - remove all generated files)
        @printf "\n"
 
-all: lisp info
+lisp: $(ELCS) loaddefs
+
+loaddefs: $(PKG)-autoloads.el
 
-lisp: $(ELCS)
 %.elc: %.el
-       @printf "Compiling %s\n" $<
-       @$(BATCH)\
-         --eval '(setq with-editor-emacsclient-executable nil)'\
-         -f batch-byte-compile $<
+       @printf "Compiling $<\n"
+       @$(EMACS) -Q --batch $(EFLAGS) -L . $(DFLAGS) -f batch-byte-compile $<
 
-texi: $(TEXIPAGES)
+texi: $(PKG).texi
+info: $(PKG).info dir
+html: $(PKG).html
+pdf:  $(PKG).pdf
+
+%.texi: %.org
+       @printf "Generating $@\n"
+       @$(EMACS) -Q --batch $(OFLAGS) \
+       -l ox-texinfo+.el $< -f org-texinfo+export-to-texinfo
+       @printf "\n" >> $@
+       @sed -i -e '/^@title /a@subtitle for version $(VERSION)' $@
+       @rm -f $@~
 
-info: $(INFOPAGES) dir
 %.info: %.texi
        @printf "Generating $@\n"
        @$(MAKEINFO) --no-split $< -o $@
 
-dir: $(INFOPAGES)
-       @printf "Generating dir\n"
-       @echo $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@
+dir: $(PKG).info
+       @printf "Generating $@\n"
+       @printf "%s" $^ | xargs -n 1 $(INSTALL_INFO) --dir=$@
+
+%.html: %.texi
+       @printf "Generating $@\n"
+       @$(MAKEINFO) --html --no-split $(MANUAL_HTML_ARGS) $<
+
+html-dir: $(PKG).texi
+       @printf "Generating $(PKG)/*.html\n"
+       @$(MAKEINFO) --html $(MANUAL_HTML_ARGS) $<
+
+%.pdf: %.texi
+       @printf "Generating $@\n"
+       @texi2pdf --clean $< > /dev/null
+
+DOMAIN         ?= magit.vc
+PUBLISH_BUCKET ?= s3://$(DOMAIN)
+PREVIEW_BUCKET ?= s3://preview.$(DOMAIN)
+PUBLISH_TARGET ?= $(PUBLISH_BUCKET)/manual/
+PREVIEW_TARGET ?= $(PREVIEW_BUCKET)/manual/
+
+preview: html html-dir pdf
+       @aws s3 cp $(PKG).html $(PREVIEW_TARGET)
+       @aws s3 cp $(PKG).pdf $(PREVIEW_TARGET)
+       @aws s3 sync $(PKG) $(PREVIEW_TARGET)$(PKG)/
+
+publish: html html-dir pdf
+       @aws s3 cp $(PKG).html $(PUBLISH_TARGET)
+       @aws s3 cp $(PKG).pdf $(PUBLISH_TARGET)
+       @aws s3 sync $(PKG) $(PUBLISH_TARGET)$(PKG)/
+
+CLEAN  = $(ELCS) $(PKG)-autoloads.el $(PKG).info dir
+CLEAN += $(PKG) $(PKG).html $(PKG).pdf
+
+clean:
+       @printf "Cleaning...\n"
+       @rm -rf $(CLEAN)
+
+clean-texi:
+       @printf "Cleaning...\n"
+       @rm -f $(PKG).texi
+
+clean-all:
+       @printf "Cleaning...\n"
+       @rm -rf $(CLEAN) $(PKG).texi
 
 authors: AUTHORS.md
+
 AUTHORS.md:
        @ printf "Authors\n=======\n\n" > $@
        @ ( printf "%s\n" "- Barak A. Pearlmutter <barak+git@pearlmutter.net>" 
&& \
@@ -62,40 +122,30 @@ AUTHORS.md:
            git log --pretty=format:'- %aN <%aE>' \
          ) | sort -u >> $@
 
-clean:
-       @printf "Cleaning...\n"
-       @rm -f $(ELCS)
-
-define set_package_requires
-(require 'dash)
-(with-current-buffer (find-file-noselect "with-editor.el")
-  (goto-char (point-min))
-  (re-search-forward "^;; Package-Requires: ")
-  (let ((s (read (buffer-substring (point) (line-end-position)))))
-    (--when-let (assq 'async       s) (setcdr it (list async-version)))
-    (--when-let (assq 'dash        s) (setcdr it (list dash-version)))
-    (delete-region (point) (line-end-position))
-    (insert (format "%S" s))
-    (save-buffer)))
+define LOADDEFS_TMPL
+;;; $(PKG)-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (directory-file-name \
+(or (file-name-directory #$$) (car load-path))))
+
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; $(PKG)-autoloads.el ends here
 endef
-export set_package_requires
+export LOADDEFS_TMPL
 #'
 
-define set_manual_version
-(let ((version "$(WITH_EDITOR_VERSION)"))
-  (with-current-buffer (find-file-noselect "with-editor.org")
-    (goto-char (point-min))
-    (re-search-forward "^#\\+SUBTITLE: for version ")
-    (delete-region (point) (line-end-position))
-    (insert version)
-    (save-buffer)))
-endef
-export set_manual_version
-
-bump-versions: bump-versions-1 texi
-bump-versions-1:
-       @$(BATCH) --eval "(progn\
-        (setq async-version \"$(ASYNC_VERSION)\")\
-        (setq dash-version \"$(DASH_VERSION)\")\
-        $$set_package_requires\
-        $$set_manual_version)"
+$(PKG)-autoloads.el: $(ELS)
+       @printf "Generating $@\n"
+       @printf "%s" "$$LOADDEFS_TMPL" > $@
+       @$(EMACS) -Q --batch --eval "(progn\
+       (setq make-backup-files nil)\
+       (setq vc-handled-backends nil)\
+       (setq default-directory (file-truename default-directory))\
+       (setq generated-autoload-file (expand-file-name \"$@\"))\
+       (setq find-file-visit-truename t)\
+       (update-directory-autoloads default-directory)))"
diff --git a/with-editor.org b/with-editor.org
index 56f6133..aed37ad 100644
--- a/with-editor.org
+++ b/with-editor.org
@@ -7,7 +7,6 @@
 #+TEXINFO_DIR_CATEGORY: Emacs
 #+TEXINFO_DIR_TITLE: With-Editor: (with-editor).
 #+TEXINFO_DIR_DESC: Using the Emacsclient as $EDITOR
-#+SUBTITLE: for version 2.5.7
 
 #+OPTIONS: H:4 num:3 toc:2
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]