gator: Get Makefile to work with DKMS
authorJon Medhurst <tixy@linaro.org>
Tue, 22 May 2012 15:54:12 +0000 (16:54 +0100)
committerJon Medhurst <tixy@linaro.org>
Tue, 8 Oct 2013 13:57:45 +0000 (14:57 +0100)
DKMS uses an absolute paths for $(src) and $(obj) whereas these are
relative paths for other kernel building scenarios. So we need to do
some jiggery-pokery to get the rule for gator_events.h to work in all
situations.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
drivers/gator/Makefile

index b5393fbbc5d289abc98acefff511f57d8913275f..5dadbacb30f491298316ff2ae0e2cbf6a920854a 100644 (file)
@@ -40,16 +40,21 @@ gator-$(CONFIG_ARM) +=      gator_events_armv6.o \
                        gator_events_l2c-310.o \
                        gator_events_scorpion.o
 
-$(obj)/gator_main.o: gator_events.h
+$(obj)/gator_main.o: $(obj)/gator_events.h
 
 clean-files := gator_events.h
 
+# Note, in the recipe below we use "cd $(srctree) && cd $(src)" rather than
+# "cd $(srctree)/$(src)" because under DKMS  $(src) is an absolute path, and we
+# can't just use $(src) because for normal kernel builds this is relative to
+# $(srctree)
+
        chk_events.h = :
  quiet_chk_events.h = echo '  CHK     $@'
 silent_chk_events.h = :
-gator_events.h: FORCE
+$(obj)/gator_events.h: FORCE
        @$($(quiet)chk_events.h)
-       $(Q)cd $(srctree)/$(src) ; $(CONFIG_SHELL) gator_events.sh $(objtree)/$(obj)/$@
+       $(Q)cd $(srctree) && cd $(src) ; $(CONFIG_SHELL) gator_events.sh $(abspath $@)
 
 else