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