manpages: generate manpages

This commit is contained in:
Jan Engelhardt
2008-04-09 20:41:08 +02:00
parent 2c2527bdc4
commit d5ee47e9da
8 changed files with 62 additions and 10 deletions

View File

@@ -58,7 +58,7 @@ targets_install := ${obj-m}
.PHONY: all install clean distclean FORCE
all: modules ${targets}
all: modules ${targets} matches.man targets.man
install: modules_install ${targets_install}
@mkdir -p "${DESTDIR}${xtlibdir}";
@@ -68,7 +68,7 @@ clean: clean_modules
rm -f *.oo *.so;
distclean: clean
rm -f .*.d;
rm -f .*.d .manpages.lst;
-include .*.d
@@ -96,3 +96,34 @@ lib%.so: lib%.oo
lib%.oo: ${srcdir}/lib%.c
${AM_VERBOSE_CC} ${CC} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<;
#
# Manpages
#
wcman_matches := $(wildcard ${srcdir}/libxt_[a-z]*.man)
wcman_targets := $(wildcard ${srcdir}/libxt_[A-Z]*.man)
wlist_matches := $(patsubst ${srcdir}/libxt_%.man,%,${wcman_matches})
wlist_targets := $(patsubst ${srcdir}/libxt_%.man,%,${wcman_targets})
.manpages.lst: FORCE
@echo "${wlist_targets} ${wlist_matches}" >$@.tmp; \
cmp -s $@ $@.tmp || mv $@.tmp $@; \
rm -f $@.tmp;
man_run = \
${AM_VERBOSE_GEN} \
for ext in $(1); do \
f="${srcdir}/libxt_$$ext.man"; \
if [ -f "$$f" ]; then \
echo ".SS $$ext"; \
cat "$$f"; \
continue; \
fi; \
done >$@;
matches.man: .manpages.lst ${wcman_matches}
$(call man_run,${wlist_matches})
targets.man: .manpages.lst ${wcman_targets}
$(call man_run,${wlist_targets})