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