Skip to content

Commit

Permalink
Add docs/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Dec 16, 2021
1 parent e66e658 commit adc611d
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 110 deletions.
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*.elc
/config.mk
/docs/*.html
/docs/*.pdf
/docs/dir
/docs/stats/

/*-autoloads.el
/.config.mk
/dir
/borg/
/borg.html
/borg.info
/borg.pdf
/stats/
/*.elc
/docs/borg/
129 changes: 27 additions & 102 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
-include config.mk
include default.mk

PKG = borg
.PHONY: lisp docs

ELS = $(PKG).el
ELS += $(PKG)-elpa.el
ELCS = $(ELS:.el=.elc)

DEPS =

EMACS ?= emacs
EMACS_ARGS ?=

LOAD_PATH ?= $(addprefix -L ../,$(DEPS))
LOAD_PATH += -L .

ifndef ORG_LOAD_PATH
ORG_LOAD_PATH = -L ../org/lisp
ORG_LOAD_PATH += -L ../ox-texinfo+
endif

INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info)
MAKEINFO ?= makeinfo
MANUAL_HTML_ARGS ?= --css-ref /assets/page.css

all: lisp info
docs: info html html-dir pdf
all: lisp docs

help:
$(info make all - generate lisp and manual)
Expand All @@ -43,90 +22,36 @@ help:

lisp: $(ELCS) loaddefs

loaddefs: $(PKG)-autoloads.el

%.elc: %.el
@printf "Compiling $<\n"
@$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -f batch-byte-compile $<

info: $(PKG).info dir
html: $(PKG).html
pdf: $(PKG).pdf

ORG_ARGS = --batch -Q $(ORG_LOAD_PATH) -l ox-texinfo+
ORG_EVAL = --eval "(setq org-texinfo+-dissolve-noexport-headlines t)"
ORG_EVAL += --eval "(setq indent-tabs-mode nil)"
ORG_EVAL += --eval "(setq org-src-preserve-indentation nil)"
ORG_EVAL += --funcall org-texinfo-export-to-texinfo

# This target first bumps version strings in the Org source. The
# necessary tools might be missing so other targets do not depend
# on this target and it has to be run explicitly when appropriate.
#
# AMEND=t make texi Update manual to be amended to HEAD.
# VERSION=N make texi Update manual for release.
#
.PHONY: texi
docs:
@$(MAKE) -C docs docs
texi:
@$(EMACS) $(ORG_ARGS) $(PKG).org $(ORG_EVAL)
@printf "\n" >> $(PKG).texi
@rm -f $(PKG).texi~

%.info: %.texi
@printf "Generating $@\n"
@$(MAKEINFO) --no-split $< -o $@

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

.PHONY: stats
@$(MAKE) -C docs texi
info:
@$(MAKE) -C docs info
html:
@$(MAKE) -C docs html
html-dir:
@$(MAKE) -C docs html-dir
pdf:
@$(MAKE) -C docs pdf
stats:
@printf "Generating statistics\n"
@gitstats -c style=https://magit.vc/assets/stats.css -c max_authors=999 . stats
@$(MAKE) -C docs stats

DOMAIN ?= emacsmirror.net
CFRONT_DIST ?= E1IXJGPIOM4EUW
PUBLISH_PATH ?= /manual/
PUBLISH_BUCKET ?= s3://$(DOMAIN)
PREVIEW_BUCKET ?= s3://preview.$(DOMAIN)
PUBLISH_TARGET ?= $(PUBLISH_BUCKET)$(PUBLISH_PATH)
PREVIEW_TARGET ?= $(PREVIEW_BUCKET)$(PUBLISH_PATH)
publish:
@$(MAKE) -C docs publish
release:
@$(MAKE) VERSION=$(VERSION) -C docs release

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)/
@printf "Generating CDN invalidation\n"
@aws cloudfront create-invalidation \
--distribution-id $(CFRONT_DIST) --paths "\
$(PUBLISH_PATH)$(PKG).html,\
$(PUBLISH_PATH)$(PKG).pdf,\
$(PUBLISH_PATH)$(PKG)/*" > /dev/null
clean:
@printf "Cleaning *...\n"
@rm -rf $(ELCS) $(PKG)-autoloads.el
@$(MAKE) -C docs clean

CLEAN = $(ELCS) $(PKG)-autoloads.el $(PKG).info dir
CLEAN += $(PKG) $(PKG).html $(PKG).pdf
loaddefs: $(PKG)-autoloads.el

clean:
@printf "Cleaning...\n"
@rm -rf $(CLEAN)
%.elc: %.el
@printf "Compiling $<\n"
@$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -f batch-byte-compile $<

define LOADDEFS_TMPL
;;; $(PKG)-autoloads.el --- automatically extracted autoloads
Expand Down
26 changes: 26 additions & 0 deletions default.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
TOP := $(dir $(lastword $(MAKEFILE_LIST)))

PKG = borg

ELS = $(PKG).el
ELS += $(PKG)-elpa.el
ELCS = $(ELS:.el=.elc)

DEPS =

EMACS ?= emacs
EMACS_ARGS ?=

LOAD_PATH ?= $(addprefix -L ../,$(DEPS))
LOAD_PATH += -L .

ifndef ORG_LOAD_PATH
ORG_LOAD_PATH = -L ../../org/lisp
ORG_LOAD_PATH += -L ../../ox-texinfo+
endif

INSTALL_INFO ?= $(shell command -v ginstall-info || printf install-info)
MAKEINFO ?= makeinfo
MANUAL_HTML_ARGS ?= --css-ref /assets/page.css

STATS_DIR ?= $(TOP)docs/stats
82 changes: 82 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
-include ../config.mk
include ../default.mk

docs: info html html-dir pdf

info: $(PKG).info dir
html: $(PKG).html
pdf: $(PKG).pdf

ORG_ARGS = --batch -Q $(ORG_LOAD_PATH) -l ox-texinfo+
ORG_EVAL = --eval "(setq org-texinfo+-dissolve-noexport-headlines t)"
ORG_EVAL += --eval "(setq indent-tabs-mode nil)"
ORG_EVAL += --eval "(setq org-src-preserve-indentation nil)"
ORG_EVAL += --funcall org-texinfo-export-to-texinfo

# This target first bumps version strings in the Org source. The
# necessary tools might be missing so other targets do not depend
# on this target and it has to be run explicitly when appropriate.
#
# AMEND=t make texi Update manual to be amended to HEAD.
# VERSION=N make texi Update manual for release.
#
.PHONY: texi
texi:
@$(EMACS) $(ORG_ARGS) $(PKG).org $(ORG_EVAL)
@printf "\n" >> $(PKG).texi
@rm -f $(PKG).texi~

%.info: %.texi
@printf "Generating $@\n"
@$(MAKEINFO) --no-split $< -o $@

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

.PHONY: stats
stats:
@printf "Generating statistics\n"
@gitstats -c style=https://magit.vc/assets/stats.css -c max_authors=999 $(TOP) $(STATS_DIR)

DOMAIN ?= emacsmirror.net
CFRONT_DIST ?= E1IXJGPIOM4EUW
PUBLISH_PATH ?= /manual/
PUBLISH_BUCKET ?= s3://$(DOMAIN)
PREVIEW_BUCKET ?= s3://preview.$(DOMAIN)
PUBLISH_TARGET ?= $(PUBLISH_BUCKET)$(PUBLISH_PATH)
PREVIEW_TARGET ?= $(PREVIEW_BUCKET)$(PUBLISH_PATH)

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)/
@printf "Generating CDN invalidation\n"
@aws cloudfront create-invalidation \
--distribution-id $(CFRONT_DIST) --paths "\
$(PUBLISH_PATH)$(PKG).html,\
$(PUBLISH_PATH)$(PKG).pdf,\
$(PUBLISH_PATH)$(PKG)/*" > /dev/null

CLEAN = $(PKG).info dir $(PKG) $(PKG).html $(PKG).pdf

clean:
@printf "Cleaning docs/*...\n"
@rm -rf $(CLEAN)
File renamed without changes.
File renamed without changes.

0 comments on commit adc611d

Please sign in to comment.