Merge from vendor branch GCC:
[dragonfly.git] / share / mk / bsd.nls.mk
1 # $FreeBSD: src/share/mk/bsd.nls.mk,v 1.11 2005/02/27 16:36:54 phantom Exp $
2 # $DragonFly: src/share/mk/bsd.nls.mk,v 1.3 2005/04/21 16:36:35 joerg Exp $
3 #
4 # This include file <bsd.nls.mk> handles building and installing Native
5 # Language Support (NLS) catalogs
6 #
7 # +++ variables +++
8 #
9 # GENCAT        A program for converting .msg files into compiled NLS
10 #               .cat files. [gencat]
11 #
12 # NLS           Source or intermediate .msg files. [set in Makefile]
13 #
14 # NLSDIR        Base path for National Language Support files
15 #               installation. [${SHAREDIR}/nls]
16 #
17 # NLSGRP        National Language Support files group. [${SHAREGRP}]
18 #
19 # NLSMODE       National Language Support files mode. [${NOBINMODE}]
20 #
21 # NLSOWN        National Language Support files owner. [${SHAREOWN}]
22 #
23 # NO_NLS        Do not make or install NLS files. [not set]
24
25 .if !target(__<bsd.init.mk>__)
26 .error bsd.nls.mk cannot be included directly.
27 .endif
28
29 GENCAT?=        gencat
30
31 .SUFFIXES: .cat .msg
32
33 .msg.cat:
34         ${GENCAT} ${.TARGET} ${.IMPSRC}
35
36 .if defined(NLS) && !empty(NLS) && !defined(NO_NLS)
37
38 #
39 # .msg file pre-build rules
40 #
41 NLSSRCDIR?=     ${.CURDIR}
42 .for file in ${NLS}
43 .if defined(NLSSRCFILES)
44 NLSSRCFILES_${file}?= ${NLSSRCFILES}
45 .endif
46 .if defined(NLSSRCFILES_${file})
47 NLSSRCDIR_${file}?= ${NLSSRCDIR}
48 ${file}.msg: ${NLSSRCFILES_${file}:S/^/${NLSSRCDIR_${file}}\//}
49         @rm -f ${.TARGET}
50         cat ${.ALLSRC} > ${.TARGET}
51 CLEANFILES+= ${file}.msg
52 .endif
53 .endfor
54
55 #
56 # .cat file build rules
57 #
58 NLS:=           ${NLS:=.cat}
59 CLEANFILES+=    ${NLS}
60 FILESGROUPS?=   FILES
61 FILESGROUPS+=   NLS
62
63 #
64 # installation rules
65 #
66 .for file in ${NLS}
67 NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
68 .if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
69 NLSLINKS+=      ${file:R}
70 .endif
71 .for dst in ${NLSLINKS_${file:R}}
72 SYMLINKS+=      ../${file:R}/${NLSNAME}.cat ${NLSDIR}/${dst}/${NLSNAME}.cat
73 .endfor
74 .endfor
75
76 .endif # defined(NLS) && !empty(NLS) && !defined(NO_NLS)