Make.Rules: add gperf detection and fix INDENT test

Move gperf detection from libcap/Makefile to Make.Rules to be more cross-environment friendly.
Fix INDENT test (dollar sign must be doubled):
http://www.gnu.org/software/make/manual/make.html#Variables-in-Recipes

Signed-off-by: Matthieu Crapet <mcrapet@gmail.com>
Signed-off-by: Andrew G Morgan <morgan@kernel.org>
diff --git a/Make.Rules b/Make.Rules
index ec1c474..882b033 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -61,13 +61,14 @@
         -Wnested-externs -Winline -Wshadow
 LD=$(CC) -Wl,-x -shared
 LDFLAGS := #-g
+BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
 
 SYSTEM_HEADERS = /usr/include
 INCS=$(topdir)/libcap/include/sys/capability.h
 LDFLAGS += -L$(topdir)/libcap
 CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
 PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
-INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
+INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
 DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
 LIBATTR := yes
 
diff --git a/libcap/Makefile b/libcap/Makefile
index 20ab00f..80ccf3c 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -28,7 +28,7 @@
 
 all: $(MINLIBNAME) $(STALIBNAME) libcap.pc
 
-ifeq ($(shell gperf --version > /dev/null 2>&1 && echo yes),yes)
+ifeq ($(BUILD_GPERF),yes)
 USE_GPERF_OUTPUT = $(GPERF_OUTPUT)
 INCLUDE_GPERF_OUTPUT = -include $(GPERF_OUTPUT)
 endif