summaryrefslogtreecommitdiff
path: root/drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile')
-rw-r--r--drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile b/drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile
index 0f3ace966df..bed5d51cc58 100644
--- a/drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile
+++ b/drivers/gpu/mali/mali400ko/x11/mali_drm/mali/Makefile
@@ -12,6 +12,21 @@
# Makefile for the Mali drm device driver. This driver provides support for the
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
-obj-y += mali_drm.o
-mali_drm-objs := mali_drv.o
-EXTRA_CFLAGS += -I$(KBUILD_EXTMOD) -I$(KBUILD_EXTMOD)/include -I$(KBUILD_EXTMOD)/../drm/include/
+# If KERNELRELEASE is defined, we've been invoked from the # kernel build system and can use its language.
+ifneq ($(KERNELRELEASE),)
+ obj-m := mali_drm.o
+ mali_drm-objs := mali_drv.o
+ EXTRA_CFLAGS += -I$(KBUILD_EXTMOD) -I$(KBUILD_EXTMOD)/include -I$(KBUILD_EXTMOD)/../drm/include/
+
+# Otherwise we were called directly from the command # line; invoke the kernel build system.
+else
+
+ KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+ PWD := $(shell pwd)
+
+default:
+ $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+all:
+ $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+
+endif