File: Makefile.common

package info (click to toggle)
manpages-fr-extra 20070311
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,752 kB
  • ctags: 22
  • sloc: makefile: 98; perl: 90
file content (64 lines) | stat: -rw-r--r-- 1,710 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
# 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 -o `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

all: build

pre-build:

po4a-build:
	po4a $(PO4ACONFIGFILE)

post-build:
	@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: pre-build po4a-build post-build

stats:
	@echo -n "$(PACKAGE): ";
	@msgfmt --statistics -o /dev/null $(PODIR)/fr.po;

clean:
	po4a --rm-translations $(PO4ACONFIGFILE)
	-rm -rf fr
	-rm -f $(PODIR)/*~