summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasmin Jessich <jasmin@anw.at>2017-05-24 20:30:47 (GMT)
committerFrank Neumann <fnu@yavdr.org>2017-05-24 20:30:47 (GMT)
commit20acc58dfd380b065917afd243e57a18821a49a7 (patch)
tree53f908b1de72b3e516c1b8f6cca413422b2e2b93
parent7bfd6f27292607ecb1e20b04e0fea8400fcaffe0 (diff)
downloadvdr-plugin-epgsearch-20acc58dfd380b065917afd243e57a18821a49a7.tar.gz
vdr-plugin-epgsearch-20acc58dfd380b065917afd243e57a18821a49a7.tar.bz2
Create man pages only once.
-rw-r--r--Makefile19
-rwxr-xr-xdocsrc2man.sh82
2 files changed, 74 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 2ded06a..e9bd930 100644
--- a/Makefile
+++ b/Makefile
@@ -207,7 +207,19 @@ DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) $(OBJS2:%.o=%.c) $(OBJS3:%.o=%.c) $(OBJS4:%.o=%.c)> $@
+ifneq ($(MAKECMDGOALS),clean)
-include $(DEPFILE)
+endif
+
+DEPFILE_DOC = .dependencies_doc
+DEPFILE_stmp = .doc_stmp
+$(DEPFILE_DOC): Makefile
+ @rm -f $(DEPFILE_DOC)
+ @./docsrc2man.sh --depend $(DEPFILE_stmp) > $(DEPFILE_DOC)
+
+ifneq ($(MAKECMDGOALS),clean)
+-include $(DEPFILE_DOC)
+endif
### Internationalization (I18N):
@@ -252,12 +264,16 @@ libvdr-$(PLUGIN4).so: $(OBJS4)
createcats: createcats.o Makefile
$(CXX) $(CXXFLAGS) $(LDFLAGS) createcats.o -o $@
-docs:
+$(DEPFILE_stmp):
./docsrc2man.sh
./docsrc2html.sh
ln -sf ./doc/en/epgsearch.4.txt MANUAL
ln -sf ./doc/en/epgsearch.1.txt README
ln -sf ./doc/de/epgsearch.1.txt README.DE
+ @rm -f $(DEPFILE_stmp)
+ @date > $(DEPFILE_stmp)
+
+docs: $(DEPFILE_stmp)
install-$(PLUGIN): libvdr-$(PLUGIN).so
install -D libvdr-$(PLUGIN).so $(DESTDIR)$(LIBDIR)/libvdr-$(PLUGIN).so.$(APIVERSION)
@@ -322,3 +338,4 @@ clean:
@-rm -f $(OBJS) $(OBJS2) $(OBJS3) $(OBJS4) $(DEPFILE) *.so *.tgz core* createcats createcats.o pod2*.tmp
@-find . \( -name "*~" -o -name "#*#" \) -print0 | xargs -0r rm -f
@-rm -rf doc html man
+ @-rm -f $(DEPFILE_stmp) $(DEPFILE_DOC)
diff --git a/docsrc2man.sh b/docsrc2man.sh
index cf6b041..7c3b4c7 100755
--- a/docsrc2man.sh
+++ b/docsrc2man.sh
@@ -7,6 +7,8 @@
# Mike Constabel
#
# Version 0.1 - 31.07.2006
+# jasmin.j 24. May 2017:
+# Added dependency generation by "--depend <tag>"
#
DOCSRC="doc-src"
@@ -16,47 +18,75 @@ if [ ! -s "epgsearch.c" ]; then
exit
fi
+PRINT_DEPS=0
+if [ "$1" = "--depend" ]; then
+ PRINT_DEPS=1
+ PRINT_DEPS_STMP=$2
+ echo "$PRINT_DEPS_STMP: \\"
+fi
+
VERSION="$(awk -F\" '/VERSION/ {print $2; exit;}' epgsearch.c)"
-for LANGUAGE in $(ls "$DOCSRC"/); do
+function man_dir () {
+ if [ $PRINT_DEPS -eq 0 ]; then
+ mkdir -p man/$1
+ rm man/$1/* 2>/dev/null
+ fi
+}
- [ ! -d ""$DOCSRC"/$LANGUAGE" ] && continue
- mkdir -p man/$LANGUAGE
- rm man/$LANGUAGE/* 2>/dev/null
-
- for i in "$DOCSRC"/$LANGUAGE/*.txt; do
- echo -ne "create man page: ($LANGUAGE) $(basename "$i" ".txt")..."
- name=$(echo "$(basename "$i")" | sed -e 's/\.[0-9]\..*$//')
- sect=$(echo "$i" | sed -e 's/.*\.\([0-9]\)\.txt/\1/')
- pod2man -c "Epgsearch Version $VERSION" -n "$name" --section="$sect" "$i" >"man/$LANGUAGE/$(basename "$i" ".txt")"
- if [ $? -eq 0 ]; then
- echo " done."
+function man_gen () {
+ for i in "$DOCSRC"/$1/*.txt; do
+ if [ $PRINT_DEPS -eq 0 ]; then
+ echo -ne "create man page: ($1) $(basename "$i" ".txt")..."
+ name=$(echo "$(basename "$i")" | sed -e 's/\.[0-9]\..*$//')
+ sect=$(echo "$i" | sed -e 's/.*\.\([0-9]\)\.txt/\1/')
+ pod2man -c "Epgsearch Version $VERSION" -n "$name" --section="$sect" "$i" >"man/$1/$(basename "$i" ".txt")"
+ if [ $? -eq 0 ]; then
+ echo " done."
+ else
+ echo " failed."
+ fi
else
- echo " failed."
+ echo -e "\t$i \\"
fi
done
+}
- rm "$DOCSRC"/$LANGUAGE/*~ 2>/dev/null
- gzip -f man/$LANGUAGE/*.[0-9]
+function man_gz () {
+ if [ $PRINT_DEPS -eq 0 ]; then
+ rm "$DOCSRC"/$1/*~ 2>/dev/null
+ gzip -f man/$1/*.[0-9]
+ fi
+}
+
+for LANGUAGE in $(ls "$DOCSRC"/); do
+
+ [ ! -d ""$DOCSRC"/$LANGUAGE" ] && continue
+
+ man_dir $LANGUAGE
+ man_gen $LANGUAGE
+ man_gz $LANGUAGE
done
echo
-for LANGUAGE in $(ls "$DOCSRC"/); do
+if [ $PRINT_DEPS -eq 0 ]; then
+ for LANGUAGE in $(ls "$DOCSRC"/); do
- [ ! -d "$DOCSRC/$LANGUAGE" ] && continue
- mkdir -p doc/$LANGUAGE
- rm doc/$LANGUAGE/* 2>/dev/null
+ [ ! -d "$DOCSRC/$LANGUAGE" ] && continue
+ mkdir -p doc/$LANGUAGE
+ rm doc/$LANGUAGE/* 2>/dev/null
- for i in man/$LANGUAGE/*.gz; do
- echo -ne "create doc file from man page: ($LANGUAGE) $(basename "$i")..."
- zcat "$i" | nroff -man - | col -xbp > "doc/$LANGUAGE/$(basename "$i" ".gz").txt"
- echo " done"
- done
+ for i in man/$LANGUAGE/*.gz; do
+ echo -ne "create doc file from man page: ($LANGUAGE) $(basename "$i")..."
+ zcat "$i" | nroff -man - | col -xbp > "doc/$LANGUAGE/$(basename "$i" ".gz").txt"
+ echo " done"
+ done
-done
+ done
-echo
+ echo
+fi
#EOF