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