summaryrefslogtreecommitdiff
path: root/Source/DirectFB/gfxdrivers/sh772x/Makefile.kernel
blob: 8b6be07c1576de4b7f8c620c0f4c0752ba6bb398 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
KERNEL_VERSION  ?= $(shell uname -r)
KERNEL_MODLIB   ?= /lib/modules/$(KERNEL_VERSION)
KERNEL_BUILD    ?= $(SYSROOT)$(KERNEL_MODLIB)/build
KERNEL_SOURCE   ?= $(SYSROOT)$(KERNEL_MODLIB)/source

ifeq ($(shell test -L $(KERNEL_BUILD) && echo yes),yes)
  KERNEL_BUILD := $(SYSROOT)$(shell readlink $(KERNEL_BUILD))
endif

ifeq ($(shell test -L $(KERNEL_SOURCE) && echo yes),yes)
  KERNEL_SOURCE := $(SYSROOT)$(shell readlink $(KERNEL_SOURCE))
endif

K_VERSION    := $(shell echo $(KERNEL_VERSION) | cut -d . -f 1)
K_PATCHLEVEL := $(shell echo $(KERNEL_VERSION) | cut -d . -f 2)
K_SUBLEVEL   := $(shell echo $(KERNEL_VERSION) | cut -d . -f 3 | cut -d '-' -f 1)


DESTDIR ?= $(SYSROOT)


ifeq ($(DEBUG_2DG),yes)
  CPPFLAGS += -DSH7722GFX_DEBUG_2DG
endif

ifeq ($(DEBUG_JPU),yes)
  CPPFLAGS += -DSH7722GFX_DEBUG_JPU
endif

ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/autoconf.h && echo yes),yes)
  AUTOCONF_H = -include $(KERNEL_BUILD)/include/linux/autoconf.h
endif
  
ifeq ($(shell test -e $(KERNEL_BUILD)/include/linux/config.h && echo yes),yes)
  CPPFLAGS += -DHAVE_LINUX_CONFIG_H
endif
    
check-version = $(shell expr \( $(K_VERSION) \* 65536 + $(K_PATCHLEVEL) \* 256 + $(K_SUBLEVEL) \) \>= \( $(1) \* 65536 + $(2) \* 256 + $(3) \))

.PHONY: all install clean

all:
ifeq ($(call check-version,2,6,24),1)
	$(MAKE) -C $(KERNEL_BUILD) \
		KCPPFLAGS="$(CPPFLAGS) -I`pwd`/kernel-module" \
		SUBDIRS="`pwd`/kernel-module" modules
else
	$(MAKE) -C $(KERNEL_BUILD) \
		CPPFLAGS="$(CPPFLAGS) -D__KERNEL__ -I`pwd`/kernel-module -I$(KERNEL_BUILD)/include -I$(KERNEL_SOURCE)/include $(AUTOCONF_H)" \
		SUBDIRS="`pwd`/kernel-module" modules
endif

clean:
	rm -rf kernel-module/*.*o kernel-module/.*.*o* kernel-module/*.mod.c kernel-module/.tmp_versions

install: all
	install -v -m 0755 -d $(DESTDIR)/lib/modules/$(KERNEL_VERSION)/renesas
	install -v -m 0644 kernel-module/sh772x_gfx.ko $(DESTDIR)/lib/modules/$(KERNEL_VERSION)/renesas/


.PHONY: all clean