summaryrefslogtreecommitdiff
path: root/v4l/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/Makefile')
-rw-r--r--v4l/Makefile27
1 files changed, 18 insertions, 9 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index f51050876..fcc0882e6 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -1,9 +1,7 @@
-
ifeq ($(obj),)
obj = .
endif
-
#################################################
# configuration
@@ -30,7 +28,6 @@ tuner-objs := tuner-core.o tuner-simple.o mt20xx.o tda8290.o tea5767.o
list-multi := bttv.o saa7134.o cx88xx.o cx8800.o cx88-alsa.o cx8802.o
em2820-objs := em2820-video.o em2820-i2c.o em2820-cards.o em2820-core.o
-
# what to build
obj-m := video-buf.o v4l1-compat.o v4l2-common.o
obj-$(CONFIG_VIDEO_BTTV) += btcx-risc.o ir-common.o bttv.o tveeprom.o
@@ -87,8 +84,6 @@ endif
# compile modules
ifneq ($(KERNELRELEASE),)
-# recursive call from kernel build system
-dummy := $(shell echo $(KERNELRELEASE) > $(obj)/.version)
ifeq ($(VERSION).$(PATCHLEVEL),2.6)
export-objs :=
@@ -125,7 +120,7 @@ saa7134.o: $(saa7134-objs)
-include $(TOPDIR)/Rules.make
else
# take version info from last module build if available
-KERNELRELEASE := $(shell cat $(obj)/.version 2>/dev/null || uname -r)
+-include $(obj)/.version
endif
KDIR := /lib/modules/$(KERNELRELEASE)/build
@@ -134,7 +129,12 @@ DEST := /lib/modules/$(KERNELRELEASE)/$(MDIR)
KDIR26 := /lib/modules/$(KERNELRELEASE)/kernel/drivers/media
KDIRUSB := /lib/modules/$(KERNELRELEASE)/kernel/drivers/usb/media
-CPPFLAGS := -I$(SUBDIRS)/../linux/include $(CPPFLAGS)
+ifeq ($(VERSION).$(PATCHLEVEL),2.6)
+ CPPFLAGS := -I$(SUBDIRS)/../linux/include $(CPPFLAGS)
+ MYCFLAGS :=
+else
+ MYCFLAGS := CFLAGS="-I../linux/include -D__KERNEL__ -I$(KDIR)/include -DEXPORT_SYMTAB"
+endif
# which files to install?
inst-m := $(wildcard *.ko)
@@ -162,8 +162,8 @@ v4l_modules := $(shell lsmod|cut -d' ' -f1 ) $(patsubst %.ko,%,$(inst-m))
LC_ALL = POSIX
export LC_ALL
-default:: links
- $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
+default:: links .version
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules
links::
find ../linux/drivers/media/video -name '*.[c,h]' -type f -exec ln -sf '{}' . \;
@@ -263,6 +263,15 @@ linux media:
-rm -f .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
-rm -rf .tmp_versions
+.version:
+ifneq ($(KERNELRELEASE),)
+ echo -e VERSION=$(VERSION)\\nPATCHLEVEL:=$(PATCHLEVEL)\\nSUBLEVEL:=$(SUBLEVEL)\\nKERNELRELEASE:=$(KERNELRELEASE) > $(obj)/.version
+else
+ echo "No version yet."
+ uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s\n",$$1,$$2,$$3,$$1,$$2,$$3); };' > $(obj)/.version
+
+endif
+
#################################################
# build tarballs