1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
# build: update po files if needed and generate manpages
#
# clean: update po files if needed and remove existing
# generated manpages
PO4ADIR=po4a
PODIR=$(PO4ADIR)/po
PO4ACONFIGFILE=$(PO4ADIR)/$(PACKAGE).cfg
# function to create links
# It uses ".so" inclusions, even if the original link is a symbolic link
# examples:
# $(call create_link,foo.1,bar.1)
# creates the link bar.1 pointing to foo.1 in fr/man1
# $(call create_link,../man1/foo.1,bar.2)
# creates the link bar.2 in fr/man2 pointing to
# ../man1/foo.1, i.e. fr/man1/foo.1
# creates the fr/man2 directory if needed
define create_link
echo -n "Creating link $(2) pointing to $(1)... "; \
section1=`echo $(1) | sed -e "s/^.*\.\([1-9]\)\([^1-9.][^.]*\)*$$/\1/"`; \
section2=`echo $(2) | sed -e "s/^.*\.\([1-9]\)\([^1-9.][^.]*\)*$$/\1/"`; \
if [ `expr $$section1 : "[1-9]"` = 0 ] || [ `expr $$section2 : "[1-9]"` = 0 ]; then \
echo "failed."; \
exit 0; \
fi; \
if [ -e fr/man$$section1/$(1) ]; then \
if [ ! -d fr/man$$section2 ]; then \
mkdir fr/man$$section2; \
fi; \
echo ".so man$$section1/$(1)" > fr/man$$section2/$(2); \
echo "done."; \
else \
echo "ignored."; \
fi
endef
define create_from_pod
set -e; \
echo -n "Creating manual pages from POD..."; \
for file in fr/pod/*.pod; do \
if [ -e $$file ]; then \
sh C/pod/pod2manpage $$file; \
fi; \
done; \
echo -n "Move manual pages from POD to their actual location..."; \
for file in fr/pod/*; do \
if [ -e $$file ]; then \
section=`echo $$file | sed -e "s/^.*\.\([1-9]\|pod\)\([^1-9.][^.]*\)*$$/\1/"`; \
if [ `expr $$section : "pod"` = 0 ]; then \
if [ `expr $$section : "[1-9]"` = 0 ]; then \
echo "failed."; \
exit 0; \
fi; \
if [ ! -d fr/man$$section ]; then \
mkdir fr/man$$section; \
fi; \
cp $$file fr/man$$section; \
echo "done."; \
fi; \
fi; \
done
endef
all: build
pre-build:
po4a-build:
# po4a --previous $(PO4ACONFIGFILE)
post-build:
# @if [ -d fr/pod ]; then \
# $(call create_from_pod); \
# fi;
# @if [ -e links ]; then \
# cat links | while read line; do \
# LINK=`echo $$line | cut -d " " -f 1`; \
# TARGET=`echo $$line | cut -d " " -f 2`; \
# $(call create_link,$$TARGET,$$LINK); \
# done; \
# fi;
build:
# $(MAKE) pre-build
# $(MAKE) po4a-build
# $(MAKE) post-build
stats:
# @echo -n "$(PACKAGE): ";
# @msgfmt --statistics -c -o /dev/null $(PODIR)/fr.po;
clean:
# po4a --previous --rm-translations $(PO4ACONFIGFILE)
# -rm -rf fr
# -rm -f $(PODIR)/*~
|