xref: /freebsd/share/i18n/esdb/Makefile.part (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
1# $FreeBSD$
2# $NetBSD: Makefile.part,v 1.6 2008/10/25 22:35:36 apb Exp $
3
4PARTFILE?= ${.CURDIR}/${CODE}.part
5ALIASFILE?= ${.CURDIR}/${CODE}.alias
6.if !defined(NO_SEP)
7SEP?=	-
8.endif
9.if exists(${PARTFILE})
10PART!=	sed '/^\#/d;/^ *$$/d' ${PARTFILE}
11.endif
12.if !defined(NO_EPREFIX)
13CODESETS?= ${PART:C/^/${CODE}${SEP}/}
14EPREFIX?= ${CODE}${SEP}
15.else
16CODESETS?= ${PART}
17EPREFIX?=
18.endif
19ESUBDIR?= ${CODE}
20ESDB?=	${CODESETS:C/$/.esdb/:S/:/@/}
21
22FILES+=	${ESDB}
23FILESDIR= ${ESDBDIR}/${ESUBDIR}
24
25.SUFFIXES: .src .esdb
26
27.src.esdb:
28	${MKESDB} -o $@ $>
29
30CLEANFILES+= ${ESDB} esdb.dir.${ESUBDIR} esdb.alias.${ESUBDIR}
31
32# ----------------------------------------------------------------------
33# esdb.dir
34#
35esdb.dir.${ESUBDIR}: ${PARTFILE}
36	echo "# ${CODE}" >${.TARGET}
37.for i in ${PART}
38	printf "%-32s%s\n" "${EPREFIX}$i" \
39		"${ESUBDIR}/${EPREFIX}${i:S/:/@/}.esdb" >>${.TARGET}
40.endfor
41	echo >>${.TARGET}
42
43# ----------------------------------------------------------------------
44# esdb.alias
45#
46.for i in ${PART:S/:/@/}
47${CODE}_$i_aliases!= echo \
48	`sed \
49	    '/^\#/d;/^ *$$/d;/^${i:S/@/:/}[ 	]/!d;s/^[^ 	]*[ 	]*//' \
50		${ALIASFILE}`
51.endfor
52esdb.alias.${ESUBDIR}: ${PARTFILE} ${ALIASFILE}
53	echo "# ${CODE}" >${.TARGET}
54.for i in ${PART:S/:/@/}
55.for j in ${${CODE}_$i_aliases}
56	printf "%-32s%s\n" "$j" "${EPREFIX}${i:S/@/:/}" >>${.TARGET}
57.endfor
58.endfor
59	echo >>${.TARGET}
60
61.if !defined(_SKIP_BUILD)
62all: esdb.dir.${ESUBDIR} esdb.alias.${ESUBDIR} codesets
63.endif
64codesets: ${ESDB}
65
66.if !defined(NO_PREPROC)
67.for i in ${PART}
68.if !exists(${.CURDIR}/${EPREFIX}${i:S/:/@/}.src)
69${EPREFIX}${i:S/:/@/}.src: ${CODE}.src
70	sed ${SED_EXP:S@%%PART%%@${i}@} ${.ALLSRC} > ${.TARGET}
71	@echo ${.TARGET} >>.tmpfiles
72.endif
73.endfor
74.endif
75
76.if exists(.tmpfiles)
77TMPFILES!= cat .tmpfiles
78CLEANFILES+= ${TMPFILES} .tmpfiles
79.endif
80
81.include "./Makefile.inc"
82.include <bsd.prog.mk>
83