Skip to content

Commit

Permalink
scalar: allow building and installing the documentation
Browse files Browse the repository at this point in the history
Now that Scalar is reasonably complete, we are comfortable having users
install its documentation, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho authored and derrickstolee committed Aug 31, 2022
1 parent 9e4017e commit 06c3619
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 3 additions & 0 deletions contrib/scalar/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/*.xml
/*.1
/*.html
/*.exe
/scalar
26 changes: 25 additions & 1 deletion contrib/scalar/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $(TARGETS): $(GITLIBS) scalar.c

clean:
$(RM) $(TARGETS) ../../bin-wrappers/scalar
$(RM) scalar.1 scalar.html scalar.xml

../../bin-wrappers/scalar: ../../wrap-for-bin.sh Makefile
@mkdir -p ../../bin-wrappers
Expand All @@ -35,11 +36,34 @@ test: all
INSTALL = install
prefix = $(HOME)
bindir = $(prefix)/bin
mandir ?= $(prefix)/share/man
man1dir = $(mandir)/man1
htmldir ?= $(prefix)/share/doc/git-doc
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir))
man1dir_SQ = $(subst ','\'',$(man1dir))
htmldir_SQ = $(subst ','\'',$(htmldir))

install:
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
$(INSTALL) scalar$(X) '$(DESTDIR_SQ)$(bindir_SQ)'

.PHONY: $(GITLIBS) all clean test install FORCE
docs: scalar.html scalar.1

scalar.html: | scalar.1 # prevent them from trying to build `doc.dep` in parallel

scalar.html scalar.1: scalar.txt
$(QUIET_SUBDIR0)../../Documentation$(QUIET_SUBDIR1) \
MAN_TXT=../contrib/scalar/scalar.txt \
../contrib/scalar/$@
$(QUIET)test scalar.1 != "$@" || mv ../../Documentation/$@ .

install-doc: scalar.1
$(INSTALL) -d -m 755 $(DESTDIR_SQ)$(man1dir_SQ)
$(INSTALL) -m 644 $^ $(DESTDIR_SQ)$(man1dir_SQ)

install-html: scalar.html
$(INSTALL) -d -m 755 $(DESTDIR_SQ)$(htmldir_SQ)
$(INSTALL) -m 644 $^ $(DESTDIR_SQ)$(htmldir_SQ)

.PHONY: $(GITLIBS) all clean test docs install install-doc install-html FORCE

0 comments on commit 06c3619

Please sign in to comment.