xref: /freebsd/share/i18n/esdb/Makefile.part (revision 991554f2c46fdbc7e9acbf87fc8da089618c3a19)
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
63all: realall
64realall: esdb.dir.${ESUBDIR} esdb.alias.${ESUBDIR} codesets
65codesets: ${ESDB}
66
67.if !defined(NO_PREPROC)
68.for i in ${PART}
69.if !exists(${EPREFIX}${i:S/:/@/}.src)
70${EPREFIX}${i:S/:/@/}.src: ${CODE}.src
71	sed ${SED_EXP:S@%%PART%%@${i}@} ${.CURDIR}/${CODE}.src > ${EPREFIX}${i:S/:/@/}.src
72	@echo ${EPREFIX}${i:S/:/@/}.src >>.tmpfiles
73.endif
74.endfor
75.endif
76
77.if exists(.tmpfiles)
78TMPFILES!= cat .tmpfiles
79CLEANFILES+= ${TMPFILES} .tmpfiles
80.endif
81
82.include "./Makefile.inc"
83.include <bsd.prog.mk>
84