1# $FreeBSD: stable/10/usr.bin/getconf/Makefile 319385 2017-06-01 06:41:27Z ngie $
2
3.include <bsd.own.mk>
4
5PROG=	getconf
6
7SRCS=	confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c
8CFLAGS+= -I${.CURDIR}
9CLEANFILES+=	confstr.c limits.c pathconf.c progenv.c sysconf.c \
10		confstr.names limits.names pathconf.names sysconf.names \
11		conflicting.names unique.names
12
13.SUFFIXES: .gperf .names
14.PHONY: conflicts
15
16all:	conflicts
17
18FAKE_GPERF=	${.CURDIR}/fake-gperf.awk
19.gperf.c: ${FAKE_GPERF}
20	LC_ALL=C awk -f ${FAKE_GPERF} ${.IMPSRC} >${.TARGET}
21
22.gperf.names:
23	LC_ALL=C awk '/^[_A-Z]/ { print; }' ${.IMPSRC} | \
24	    sed -e 's/,$$//' >${.TARGET}
25
26conflicts: conflicting.names unique.names
27	@if test `wc -l <conflicting.names` != `wc -l <unique.names`; then \
28		echo "Name conflicts found!" >&2; \
29		exit 1; \
30	fi
31
32# pathconf.names is not included here because pathconf names are
33# syntactically distinct from the other kinds.
34conflicting.names:	confstr.names limits.names sysconf.names
35	cat ${.ALLSRC} >${.TARGET}
36
37unique.names:		conflicting.names
38	LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
39
40.if ${MK_TESTS} != "no"
41SUBDIR+=	tests
42.endif
43
44.include <bsd.prog.mk>
45