Index: openssl-qat-module-1.0.1-r0/openssl-1.0.1/engines/qat_engine/qat_mem/Makefile
===================================================================
--- openssl-qat-module-1.0.1-r0.orig/openssl-1.0.1/engines/qat_engine/qat_mem/Makefile	2012-10-17 13:31:27.932376960 -0700
+++ openssl-qat-module-1.0.1-r0/openssl-1.0.1/engines/qat_engine/qat_mem/Makefile	2012-10-17 13:35:40.396389410 -0700
@@ -9,13 +9,9 @@
 MODULENAME 	:= qat_mem
 ### should not need to change stuff below ######################
 
-
-KDIR		:= /lib/modules/$(shell uname -r)/build
-#KDIR		:= /exports/linux-2.6.12.2/
+KDIR		:= $(KERNEL_SOURCE_ROOT)
 PWD		:= $(shell pwd)
-
-CC		:= gcc -Wall -imacros /usr/src/kernels/$(shell uname -r)/include/linux/autoconf.h
-
+CC		:= $(KERNEL_CC) -Wall -imacros $(KERNEL_SOURCE_ROOT)/include/generated/autoconf.h
 ifeq ($(KERNELRELEASE),)
 all:	$(MODULENAME)_test
 all:
@@ -23,20 +19,15 @@
 else
   obj-m	:= $(MODULENAME).o
 endif
-
 $(MODULENAME)_test: $(MODULENAME)_test.c
 	$(CC) -g -o $(MODULENAME)_test $(MODULENAME)_test.c
-
-
+modules_install:
+	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
 load:
 	insmod ./$(MODULENAME).ko
-
 unload:
 	rmmod $(MODULENAME)
-
 test: all
 	./$(MODULENAME)_test.sh
-
 clean:
 	rm -f *.o *.ko Modules.symvers *.mod.c .*.cmd $(MODULENAME)_test
-
