--- gradm.orig/Makefile	2014-05-29 00:51:00.000000000 +0200
+++ gradm/Makefile	2014-06-23 12:13:04.000000000 +0200
@@ -11,25 +11,25 @@ GRADM_PAM=gradm_pam
 GRSEC_DIR=/etc/grsec
 
 LLEX=/usr/bin/lex
-FLEX=/usr/bin/flex
-LEX := $(shell if [ -x $(FLEX) ]; then echo $(FLEX); else echo $(LLEX); fi)
+FLEX?=/usr/bin/flex
+LEX?=$(FLEX)
 LEXFLAGS=-Cfa -B
 #ubuntu broke byacc for who knows why, disable it
 #BYACC=/usr/bin/byacc
-BISON=/usr/bin/bison
+BISON?=/usr/bin/bison
 #YACC := $(shell if [ -x $(BYACC) ]; then echo $(BYACC); else echo $(BISON); fi)
 YACC=$(BISON)
 MKNOD=/bin/mknod
 #for dietlibc
 #CC=/usr/bin/diet /usr/bin/gcc
-CC=/usr/bin/gcc
-FIND=/usr/bin/find
-STRIP=/usr/bin/strip
-LIBS := $(shell if [ "`uname -m`" != "sparc64" -a "`uname -m`" != "x86_64" ]; then echo "-lfl" ; else echo "" ; fi)
+CC?=/usr/bin/gcc
+FIND?=/usr/bin/find
+STRIP=
 OPT_FLAGS := -O2
 # for older versions of grsecurity, comment the above line and uncomment the below:
 #OPT_FLAGS := $(shell if [ "`uname -m`" != "sparc64" ] && [ "`uname -m`" != "x86_64" ]; then echo "-O2" ; else echo "-O2 -m64" ; fi)
-CFLAGS := $(OPT_FLAGS) -Wcast-qual -DGRSEC_DIR=\"$(GRSEC_DIR)\" -D_LARGEFILE64_SOURCE
+CFLAGS ?= 
+CFLAGS += -Wcast-qual -DGRSEC_DIR=\"$(GRSEC_DIR)\" -D_LARGEFILE64_SOURCE
 LDFLAGS=
 INSTALL = /usr/bin/install -c
 
@@ -140,7 +140,6 @@ install: $(GRADM_BIN) gradm.8 policy grl
 	@mkdir -p $(DESTDIR)/sbin
 	@echo "Installing gradm..."
 	@$(INSTALL) -m 0755 $(GRADM_BIN) $(DESTDIR)/sbin
-	@$(STRIP) $(DESTDIR)/sbin/$(GRADM_BIN)
 	@if [ -f $(GRADM_PAM) ] ; then \
 		echo "Installing gradm_pam..." ; \
 		$(INSTALL) -m 4755 $(GRADM_PAM) $(DESTDIR)/sbin ; \
@@ -148,7 +147,6 @@ install: $(GRADM_BIN) gradm.8 policy grl
 	fi
 	@echo "Installing grlearn..."
 	@$(INSTALL) -m 0700 grlearn $(DESTDIR)/sbin
-	@$(STRIP) $(DESTDIR)/sbin/grlearn
 	@mkdir -p -m 700 $(DESTDIR)$(GRSEC_DIR)
 	@if [ ! -f $(DESTDIR)$(GRSEC_DIR)/policy ] ; then \
 		if [ -f $(DESTDIR)$(GRSEC_DIR)/acl ] ; then \
@@ -161,29 +159,6 @@ install: $(GRADM_BIN) gradm.8 policy grl
 	@if [ ! -f $(DESTDIR)$(GRSEC_DIR)/learn_config ] ; then \
 		$(INSTALL) -m 0600 learn_config $(DESTDIR)$(GRSEC_DIR) ; \
 	fi
-	@if [ -z "`cut -d" " -f3 /proc/mounts | grep "^devfs"`" ] ; then \
-		rm -f $(DESTDIR)/dev/grsec ; \
-		if [ ! -e $(DESTDIR)/dev/grsec ] ; then \
-			mkdir -p $(DESTDIR)/dev ; \
-			$(MKNOD) -m 0622 $(DESTDIR)/dev/grsec c 1 13 ; \
-		fi \
-	fi
-	@if [ -d $(DESTDIR)/etc/udev/rules.d ] ; then \
-		echo "ACTION!=\"add|change\", GOTO=\"permissions_end\"" > $(DESTDIR)/etc/udev/rules.d/80-grsec.rules ; \
-		echo "KERNEL==\"grsec\",          MODE=\"0622\"" >> $(DESTDIR)/etc/udev/rules.d/80-grsec.rules ; \
-		echo "LABEL=\"permissions_end\"" >> $(DESTDIR)/etc/udev/rules.d/80-grsec.rules ; \
-	fi
-	@if [ -f $(DESTDIR)/sbin/udevadm ] ; then \
-		$(DESTDIR)/sbin/udevadm trigger --action=change ; \
-	fi
-	@echo "Installing gradm manpage..."
-	@mkdir -p $(DESTDIR)$(MANDIR)/man8
-	@$(INSTALL) -m 0644 gradm.8 $(DESTDIR)$(MANDIR)/man8/$(GRADM_BIN).8
-	@if [ -x /sbin/$(GRADM_BIN) ] ; then \
-		if [ -z $(DESTDIR) ] && [ ! -f $(GRSEC_DIR)/pw ] ; then \
-			/sbin/$(GRADM_BIN) -P ; \
-		fi \
-	fi
 	@true
 
 clean:
