11b52d76503965eb3d3151e15973e30544308105
[dragonfly.git] / usr.bin / getconf / Makefile
1 # $FreeBSD: src/usr.bin/getconf/Makefile,v 1.3.2.2 2002/11/25 09:02:40 ru Exp $
2 # $DragonFly: src/usr.bin/getconf/Makefile,v 1.3 2007/08/27 16:50:54 pavalos Exp $
3
4 PROG=   getconf
5
6 SRCS=   confstr.c getconf.c limits.c pathconf.c progenv.c sysconf.c
7 CFLAGS+= -I${.CURDIR} -DSTABLE
8 CLEANFILES+=    confstr.c limits.c pathconf.c progenv.c sysconf.c \
9                 confstr.names limits.names pathconf.names sysconf.names \
10                 conflicting.names unique.names
11 WARNS?= 2
12
13 .SUFFIXES: .gperf .names
14 .PHONY: conflicts
15
16 all:    conflicts
17
18 .gperf.c:
19         LC_ALL=C awk -f ${.CURDIR}/fake-gperf.awk ${.IMPSRC} >${.TARGET}
20
21 .gperf.names:
22         LC_ALL=C awk '/^[_A-Z]/ { print; }' ${.IMPSRC} | \
23             sed -e 's/,$$//' >${.TARGET}
24
25 conflicts: 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.
33 conflicting.names:      confstr.names limits.names sysconf.names
34         cat ${.ALLSRC} >${.TARGET}
35
36 unique.names:           conflicting.names
37         LC_ALL=C sort -u ${.ALLSRC} >${.TARGET}
38
39 .include <bsd.prog.mk>