summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2007-09-27 20:34:04 -0300
committerMaxim Levitsky <maximlevitsky@gmail.com>2007-09-27 20:34:04 -0300
commit91692c5db5bac6c5a8d01a2351fd428726c265bc (patch)
treeefbc509a4097d23c87ef4541dd6beecbadbafce0
parent89f22d9227d65dad3df4ad8fcf333a288016cdc8 (diff)
downloadmediapointer-dvb-s2-91692c5db5bac6c5a8d01a2351fd428726c265bc.tar.gz
mediapointer-dvb-s2-91692c5db5bac6c5a8d01a2351fd428726c265bc.tar.bz2
V4L: Fix Makefile so builds with separate kernel output directory are possible
Currently it is impossible to build v4l drivers if kernel output directoty is not the same as kernel source directory This patch attempts to fix that. Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--v4l/Makefile28
1 files changed, 16 insertions, 12 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index 325c01ca9..932e61da2 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -16,15 +16,19 @@ else
ifneq ($(SRCDIR),)
KDIR := $(SRCDIR)
+KDIR_OBJ := $(SRCDIR)
+
else
ifneq ($(KERNELRELEASE),)
-KDIR := /lib/modules/$(KERNELRELEASE)/build
+KDIR_BASE := /lib/modules/$(KERNELRELEASE)
else
-KDIR := /lib/modules/$(shell uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("%s.%s.%s%s\n",$$1,$$2,$$3,$$4); };')/build
-
+KDIR_BASE := /lib/modules/$(shell uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("%s.%s.%s%s\n",$$1,$$2,$$3,$$4); };')
endif
+KDIR := $(KDIR_BASE)/source
+KDIR_OBJ := $(KDIR_BASE)/build
endif
+
endif
#################################################
@@ -32,7 +36,7 @@ endif
default:: config-compat.h Makefile.media links $(obj)/.version oss
@if [ "x$(SRCDIR)" != x ]; then echo SRCDIR is $(SRCDIR) ; fi
- $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MYCFLAGS) O=$(KDIR_OBJ) modules
./scripts/rmmod.pl check
#################################################
# Object specific rules
@@ -287,10 +291,10 @@ debug::
# Configuration rules
# Kernel config programs
-QCONF := $(KDIR)/scripts/kconfig/qconf
-GCONF := $(KDIR)/scripts/kconfig/gconf
-MCONF := $(KDIR)/scripts/kconfig/mconf
-CONF := $(KDIR)/scripts/kconfig/conf
+QCONF := $(KDIR_OBJ)/scripts/kconfig/qconf
+GCONF := $(KDIR_OBJ)/scripts/kconfig/gconf
+MCONF := $(KDIR_OBJ)/scripts/kconfig/mconf
+CONF := $(KDIR_OBJ)/scripts/kconfig/conf
# lxdialog can be in either scripts/lxdialog or scripts/kconfig/lxdialog
LXDIALOG_DIR := $(shell if [ -d $(KDIR)/scripts/kconfig/lxdialog ]; then echo kconfig/ ; fi)
@@ -309,10 +313,10 @@ endif
$(obj)/.config: $(obj)/.version
@echo Updating/Creating .config
@if [ -e $(obj)/.config ]; then touch $(obj)/.config ; else \
- ./scripts/make_kconfig.pl $(KDIR) ; fi
+ ./scripts/make_kconfig.pl $(KDIR_OBJ) ; fi
$(obj)/Kconfig: $(obj)/.version
- ./scripts/make_kconfig.pl $(KDIR)
+ ./scripts/make_kconfig.pl $(KDIR_OBJ)
# With make -j, it's possible that both the .config and Kconfig rules
# will run at the same time, running make_kconfig.pl twice. There
@@ -332,12 +336,12 @@ menuconfig:: $(MCONF) lxdialog $(obj)/Kconfig
$(MCONF) $(obj)/Kconfig
allyesconfig allmodconfig:: $(obj)/.version
- ./scripts/make_kconfig.pl $(KDIR) 1
+ ./scripts/make_kconfig.pl $(KDIR_OBJ) 1
# rule to build kernel conf programs
KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0
$(QCONF) $(GCONF) $(MCONF) $(CONF):
- $(MAKE) -C $(KDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(notdir $@)
+ $(MAKE) -C $(KDIR_OBJ) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(notdir $@)
# lxdialog has two parts, a symlink and the actual binary
.PHONY: lxdialog