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
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
./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
$< 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,/^<body>/d' >> $@
+ $(ZCAT) $< | $(GROFF) -m man -Thtml | sed -e '1,/^<body>/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
$(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