xref: /freebsd/share/i18n/esdb/Makefile.part (revision f39bffc62c1395bde25d152c7f68fdf7cbaab414)
1# $FreeBSD$
2# $NetBSD: Makefile.part,v 1.6 2008/10/25 22:35:36 apb Exp $
3
4MKESDB?= ${.OBJDIR:H:H:H:H}/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.if !exists(${.CURDIR}/${EPREFIX}${i:S/:/@/}.src)
71${EPREFIX}${i:S/:/@/}.src: ${CODE}.src
72	sed ${SED_EXP:S@%%PART%%@${i}@} ${.ALLSRC} > ${.TARGET}
73	@echo ${.TARGET} >>.tmpfiles
74.endif
75.endfor
76.endif
77
78.if exists(.tmpfiles)
79TMPFILES!= cat .tmpfiles
80CLEANFILES+= ${TMPFILES} .tmpfiles
81.endif
82
83.include "./Makefile.inc"
84.include <bsd.prog.mk>
85