File: Makefile

package info (click to toggle)
manpages-fr 3.07.1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 20,492 kB
  • ctags: 5
  • sloc: makefile: 137
file content (75 lines) | stat: -rw-r--r-- 2,542 bytes parent folder | download
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
# build: update po files if needed and generate manpages
#
# clean: update po files if needed and remove existing
#        generated manpages

SUBDIRS=man1 man2a-m man2n-z man3a-f man3g-m man3n-s man3t-z man4 man5 man6 man7a-l man7m-z man8

# 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]" >/dev/null || ! expr $$section2 : "[1-9]" >/dev/null; then \
    echo "failed."; \
    exit 0; \
  fi; \
  if [ -e fr/man$$section1/$(1) ] && [ ! -e fr/man$$section2/$(2) ] && iconv -f utf8 -t latin1 fr/man$$section1/$(1) > /dev/null 2>&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

all: build

po4a-build:
	set -e; \
	for subs in $(SUBDIRS); do \
	  echo "po4a --previous po4a/$$subs/$$subs.cfg"; \
	  po4a --previous po4a/$$subs/$$subs.cfg; \
	done;

build: po4a-build post-build

stats:
	@for subs in $(SUBDIRS); do \
	  echo -n "$$subs: "; \
	  msgfmt -c --statistics -o /dev/null po4a/$$subs/po/fr.po; \
	done;
	@for subs in $(SUBDIRS); do \
	  LC_ALL=C msgfmt -c --statistics -o /dev/null po4a/$$subs/po/fr.po; \
	done 2>&1 | perl -e '$$f=$$t=$$u; while (<>) {if (/([0-9]*) translated/) {$$t+=$$1;} if (/([0-9]*) untranslated/) {$$u+=$$1;} if (/([0-9]*) fuzzy/) {$$f+=$$1;}} printf "%d translated, %d fuzzy, %d untranslated ==> %.2f%%\n", $$t, $$f, $$u, (100*$$t/($$t+$$f+$$u))'


clean:
	@set -e; \
	for subs in $(SUBDIRS); do \
	  po4a --previous -v --rm-translations po4a/$$subs/$$subs.cfg; \
	done;
	-rm -f po4a/*/*/*~;
	-rm -rf manpages/fr manpages-dev/fr

post-build:
	@for p in manpages manpages-dev; do \
	  cd $$p; \
	  sed -e 's,[^ ]*/\([^/ ]*\),\1,g' -e 's/\.gz//g' C/link | while read line; do \
	    TARGET=`echo $$line | cut -d " " -f 1`; \
	    LINK=`echo $$line | cut -d " " -f 2`; \
	    $(call create_link,$$TARGET,$$LINK); \
	  done; \
	  cd ..; \
	done