]> git.tuebingen.mpg.de Git - dss.git/commitdiff
build: Compress the man page.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 28 Apr 2024 03:07:01 +0000 (05:07 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 6 May 2024 20:24:53 +0000 (22:24 +0200)
Run gzip with -n to make the build reproducible.

.gitignore
Makefile

index b6dcfd23a6d2e4c6795159e0a4a830d4cce54cc7..fc6a8bb8dea359847f299ddb6fcb9afa9e750c13 100644 (file)
@@ -5,6 +5,6 @@ version.c
 *.swp
 dss.lsg.*
 dss
-dss.1
+dss.1.gz
 dss.1.html
 index.html
index f2f9c9ab3aa0a7b99e039d00a4b41f937fadd9ec..6b3be26f948de1fb3ca10b8a385266ac629d220a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,12 +7,13 @@ MKDIR_P := mkdir -p
 VERSION := $(shell ./version-gen.sh dss version.c)
 RM := rm -f
 LSG := lopsubgen
+GZIP := gzip -fn9
 
 units := dss str file exec sig daemon df tv snap ipc dss.lsg version
 objs := $(addsuffix .o, $(units))
 deps := $(addsuffix .d, $(units))
 
-all: dss dss.1
+all: dss dss.1.gz
 man: dss.1
 $(objs): dss.lsg.h Makefile
 -include $(deps)
@@ -56,16 +57,17 @@ dss: $(objs)
 %.lsg.c: %.suite
        $(call SAY, LSGC $<)
        $(LSG) --gen-c=$@ < $<
-%.1: %.suite
+%.1.gz: %.suite
        $(call SAY, LSGM $<)
-       $(LSG) --gen-man=$@ --version-string=$(VERSION) < $<
-%.1.html: %.1
+       $(LSG) --gen-man=${@:.gz=} --version-string=$(VERSION) < $<
+       $(GZIP) ${@:.gz=}
+%.1.html: %.1.gz
        $(call SAY, GROFF $<)
-       groff -m man -Thtml -P -l -P -r $< | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
-
+       zcat $< | groff -m man -Thtml -P -l -P -r \
+               | sed -e '1,/^<body>/d; /^<\/body>/,$$d' > $@
 clean:
        $(call SAY, CLEAM)
-       $(RM) *.[od] dss dss.1 *.html dss.lsg.[ch] version.c
+       $(RM) *.[od] dss dss.1.gz *.html dss.lsg.[ch] version.c
 
 ifneq ($(findstring strip, $(MAKECMDGOALS)),)
        strip_option := -s
@@ -75,7 +77,7 @@ mandir := $(DESTDIR)$(PREFIX)/share/man/man1
 install install-strip: all
        $(MKDIR_P) $(bindir) $(mandir)
        $(INSTALL_PROGRAM) $(strip_option) dss $(bindir)
-       $(INSTALL_DATA) dss.1 $(mandir)
+       $(INSTALL_DATA) dss.1.gz $(mandir)
 
 index.html: dss.1.html index.html.in INSTALL README NEWS
        sed -e '/@README@/,$$d' index.html.in > $@