import which(1) from openbsd, replacing csh script
[unleashed.git] / bin / which / Makefile
blob67aeee59b2bc8cf5d3f0379ea1779d10064f5554
1 # $OpenBSD: Makefile,v 1.9 2016/05/26 21:24:16 millert Exp $
3 PROG= which
4 MAN= which.1 whereis.1
5 LINKS= ${BINDIR}/which ${BINDIR}/whereis
6 COPTS+= -I${.CURDIR}/include
8 check_path_in_man:
9 @echo "Checking path expansion in whereis.1"; \
10 stdpath=`printf '#include <paths.h>\n_PATH_STDPATH\n' | \
11 ${CC} -E -P ${CPPFLAGS} - | \
12 sed -n 's/^[ ]*"\(.*\)".*/.D1 \1/p'` ; \
13 fgrep -xq "$$stdpath" ${.CURDIR}/whereis.1 && { touch $@; exit 0; }; \
14 echo "Update the expansion of _PATH_STDPATH in ${.CURDIR}/whereis.1"; \
15 exit 1
17 all: check_path_in_man
18 CLEANFILES = check_path_in_man
20 .include <bsd.prog.mk>