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