From: Andre Noll Date: Sun, 3 Mar 2019 20:58:45 +0000 (+0100) Subject: build: Compress man pages. X-Git-Tag: v1.0.2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=f35b70fc3e8656f71437cc85062da31488acd781;p=lopsub.git build: Compress man pages. Man pages should always be installed in compressed form, so run gzip on all four man pages. We always specify -f so that gzip won't ask questions, and use the highest compression level because the pages are compressed only once and decompressed every time the man page is opened. --- diff --git a/.gitignore b/.gitignore index be0f3e3..3dc13ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ **/*.o *.lsg.* -*.[1-9] +*.[1-9].gz config_file.c lopsubgen.c version.c diff --git a/Makefile b/Makefile index de6badf..d610c54 100644 --- a/Makefile +++ b/Makefile @@ -18,13 +18,15 @@ AR := ar GROFF := groff CP := cp INSTALL := install +GZIP := gzip -f9 +ZCAT := zcat DATE := $(shell date '+%B %Y') GIT_VERSION := $(shell ./version-gen.sh) -m4_man_pages := lopsub-suite.5 lopsub.7 -all := $(m4_man_pages) liblopsub.a lopsubgen lopsubgen.1 \ - lopsubex lopsubex.1 +m4_man_pages := lopsub-suite.5.gz lopsub.7.gz +all := $(m4_man_pages) liblopsub.a lopsubgen lopsubgen.1.gz \ + lopsubex lopsubex.1.gz all: $(all) # deps @@ -39,8 +41,8 @@ version.o: version.c gendoc := gendoc/gendoc.m4 %.h: %.h.m4 $(gendoc) $(M4) -DOUTPUT_MODE=C $(gendoc) $< > $@ -$(m4_man_pages): %: %.m4 version.c - $(M4) -DGIT_VERSION=$(GIT_VERSION) -DDATE="$(DATE)" $< > $@ +$(m4_man_pages): %.gz: %.m4 version.c + $(M4) -DGIT_VERSION=$(GIT_VERSION) -DDATE="$(DATE)" $< | $(GZIP) > $@ # flex %.c: %.l @@ -54,8 +56,9 @@ lopsubgen.lsg.c lopsubgen.lsg.h: lopsubgen.suite lopsubgen-stage1 \ ./lopsubgen --gen-c < $< %.lsg.h: %.suite lopsubgen ./lopsubgen --gen-header < $< -%.1: %.suite lopsubgen - ./lopsubgen --gen-man=$@ --version-string $(GIT_VERSION) < $< +%.1.gz: %.suite lopsubgen + ./lopsubgen --gen-man=${@:.gz=} --version-string $(GIT_VERSION) < $< + $(GZIP) ${@:.gz=} # compiling lsg1_objs := lopsubgen.o lsg1.o version.o @@ -93,11 +96,11 @@ web/lopsub-api.html: lopsub.h.m4 $< web/footer.html > $@ web/index.html: web/lopsub.7.html $(LN) -s $(notdir $<) $@ -web/%.html: % +web/%.html: %.gz $(CP) web/header.html $@ - $(GROFF) -m man -Thtml $< | sed -e '1,/^/d' >> $@ + $(ZCAT) $< | $(GROFF) -m man -Thtml | sed -e '1,/^/d' >> $@ -install: liblopsub.a lopsub.7 +install: $(all) $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib $(DESTDIR)$(PREFIX)/include \ $(DESTDIR)$(PREFIX)/man/man1 $(DESTDIR)$(PREFIX)/man/man5 \ $(DESTDIR)$(PREFIX)/man/man7 $(DESTDIR)$(PREFIX)/bin @@ -105,9 +108,9 @@ install: liblopsub.a lopsub.7 $(INSTALL) -m 755 lopsubgen $(DESTDIR)$(PREFIX)/bin $(INSTALL) -m 644 lopsub.h $(DESTDIR)$(PREFIX)/include $(INSTALL) -m 644 lopsub-internal.h $(DESTDIR)$(PREFIX)/include - $(INSTALL) -m 644 lopsubgen.1 $(DESTDIR)$(PREFIX)/man/man1 - $(INSTALL) -m 644 lopsub-suite.5 $(DESTDIR)$(PREFIX)/man/man5 - $(INSTALL) -m 644 lopsub.7 $(DESTDIR)$(PREFIX)/man/man7 + $(INSTALL) -m 644 lopsubgen.1.gz $(DESTDIR)$(PREFIX)/man/man1 + $(INSTALL) -m 644 lopsub-suite.5.gz $(DESTDIR)$(PREFIX)/man/man5 + $(INSTALL) -m 644 lopsub.7.gz $(DESTDIR)$(PREFIX)/man/man7 clean: $(RM) $(all) $(html) *.o *.man