1 # --------------------------------------------------------------------
2 # Copyright (c) 2007 MediaTek Inc.
4 # All rights reserved. Copying, compilation, modification, distribution
5 # or any other use whatsoever of this material is strictly prohibited
6 # except in accordance with a Software License Agreement with
8 # --------------------------------------------------------------------
10 # --------------------------------------------------------------------
11 # This file is used for identifying version of Linux Kernel
12 # --------------------------------------------------------------------
14 KCHECK_DIR := $(DRV_SRC_DIR)/os/linux/.kcheck
17 $(error LINUX_SRC must be defined - check config.mk !)
20 FULL_PATH_CC := $(shell which $(CC) 2> /dev/null)
21 ifeq ($(FULL_PATH_CC), )
22 $(error $(CC) is missing - check config.mk !)
25 ifeq ($(shell cd $(LINUX_SRC) 2> /dev/null && pwd), )
26 $(error $(LINUX_SRC) is missing - check config.mk !)
30 KERNEL_RELEASE := $(shell $(CC) -E -I $(LINUX_SRC)/include $(KCHECK_DIR)/.kversion.c | grep uts_release | cut -f2 -d'"')
33 ifeq ($(filter-out 2.4%, $(KERNEL_RELEASE)), )
38 LINUX26_CC := $(shell $(MAKE) -n -C $(LINUX_SRC) M=$(KCHECK_DIR) 2> /dev/null | grep cc)
39 LINUX26_CC := $(filter-out -% '% "%,$(LINUX26_CC))
40 LINUX26_CC := $(sort $(filter %cc,$(LINUX26_CC)))
41 FULL_PATH_LINUX26_CC := $(shell which $(LINUX26_CC) 2> /dev/null)
42 ifeq ($(FULL_PATH_LINUX26_CC), )
43 LINUX26_CC := "\"$(LINUX26_CC)\" not found, check $(LINUX_SRC)/Makefile or \$$PATH in current SHELL !"
45 LINUX26_CC := $(FULL_PATH_LINUX26_CC)
49 ifneq ($(INSTALL_PATH), )
50 ifeq ($(shell cd $(INSTALL_PATH) 2> /dev/null && pwd), )