1107224Sru# $FreeBSD$
259632Swollman
359632SwollmanPROG=	getconf
459632Swollman
5103591SwollmanSRCS=	confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c
659642SobrienCFLAGS+= -I${.CURDIR}
7103591SwollmanCLEANFILES+=	confstr.c limits.c pathconf.c progenv.c sysconf.c \
8103591Swollman		confstr.names limits.names pathconf.names sysconf.names \
9103591Swollman		conflicting.names unique.names
1059632Swollman
11103591Swollman.SUFFIXES: .gperf .names
12103591Swollman.PHONY: conflicts
1359632Swollman
14103591Swollmanall:	conflicts
15103591Swollman
1659632Swollman.gperf.c:
17107224Sru	LC_ALL=C awk -f ${.CURDIR}/fake-gperf.awk ${.IMPSRC} >${.TARGET}
1859632Swollman
19103591Swollman.gperf.names:
20107224Sru	LC_ALL=C awk '/^[_A-Z]/ { print; }' ${.IMPSRC} | \
21107224Sru	    sed -e 's/,$$//' >${.TARGET}
22103591Swollman
23103591Swollmanconflicts: conflicting.names unique.names
24103591Swollman	@if test `wc -l <conflicting.names` != `wc -l <unique.names`; then \
25103591Swollman		echo "Name conflicts found!" >&2; \
26103591Swollman		exit 1; \
27103591Swollman	fi
28103591Swollman
29103591Swollman# pathconf.names is not included here because pathconf names are
30103591Swollman# syntactically distinct from the other kinds.
31103591Swollmanconflicting.names:	confstr.names limits.names sysconf.names
32103591Swollman	cat ${.ALLSRC} >${.TARGET}
33103591Swollman
34103591Swollmanunique.names:		conflicting.names
35107224Sru	LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
36103591Swollman
3759632Swollman.include <bsd.prog.mk>
38