Skip to content

Commit 98c9957

Browse files
committed
scalar: allow building and installing the documentation
Now that Scalar is reasonably complete, we are comfortable having users install its documentation, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 0d917ba commit 98c9957

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

contrib/scalar/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
/*.xml
2+
/*.1
3+
/*.html
14
/*.exe
25
/scalar

contrib/scalar/Makefile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ $(TARGETS): $(GITLIBS) scalar.c
2121

2222
clean:
2323
$(RM) $(TARGETS) ../../bin-wrappers/scalar
24+
$(RM) scalar.1 scalar.html scalar.xml
2425

2526
../../bin-wrappers/scalar: ../../wrap-for-bin.sh Makefile
2627
@mkdir -p ../../bin-wrappers
@@ -35,11 +36,34 @@ test: all
3536
INSTALL = install
3637
prefix = $(HOME)
3738
bindir = $(prefix)/bin
39+
mandir ?= $(prefix)/share/man
40+
man1dir = $(mandir)/man1
41+
htmldir ?= $(prefix)/share/doc/git-doc
3842
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
3943
bindir_SQ = $(subst ','\'',$(bindir))
44+
man1dir_SQ = $(subst ','\'',$(man1dir))
45+
htmldir_SQ = $(subst ','\'',$(htmldir))
4046

4147
install:
4248
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
4349
$(INSTALL) scalar$(X) '$(DESTDIR_SQ)$(bindir_SQ)'
4450

45-
.PHONY: $(GITLIBS) all clean test install FORCE
51+
docs: scalar.html scalar.1
52+
53+
scalar.html: | scalar.1 # prevent them from trying to build `doc.dep` in parallel
54+
55+
scalar.html scalar.1: scalar.txt
56+
$(QUIET_SUBDIR0)../../Documentation$(QUIET_SUBDIR1) \
57+
MAN_TXT=../contrib/scalar/scalar.txt \
58+
../contrib/scalar/$@
59+
$(QUIET)test scalar.1 != "$@" || mv ../../Documentation/$@ .
60+
61+
install-doc: scalar.1
62+
$(INSTALL) -d -m 755 $(DESTDIR_SQ)$(man1dir_SQ)
63+
$(INSTALL) -m 644 $^ $(DESTDIR_SQ)$(man1dir_SQ)
64+
65+
install-html: scalar.html
66+
$(INSTALL) -d -m 755 $(DESTDIR_SQ)$(htmldir_SQ)
67+
$(INSTALL) -m 644 $^ $(DESTDIR_SQ)$(htmldir_SQ)
68+
69+
.PHONY: $(GITLIBS) all clean test docs install install-doc install-html FORCE

0 commit comments

Comments
 (0)