summaryrefslogtreecommitdiff
path: root/v4l/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/Makefile')
-rw-r--r--v4l/Makefile55
1 files changed, 47 insertions, 8 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index 318d7f753..58b160397 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -3,9 +3,30 @@ obj = .
endif
#################################################
+# Version Check
+
+ifneq ($(KERNELRELEASE),)
+
+-include $(TOPDIR)/Rules.make
+
+else
+
+# take version info from last module build if available
+-include $(obj)/.version
+
+ifneq ($(SRCDIR),)
+KDIR := $(SRCDIR)
+else
+KDIR := /lib/modules/$(KERNELRELEASE)/build
+endif
+
+endif
+
+#################################################
# default compilation rule
default:: Makefile.media links .version
+ echo srcdir $(SRCDIR)
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules
#################################################
@@ -42,20 +63,18 @@ EXTRA_CFLAGS += $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL)
# Kernel 2.4/2.6 specific rules
ifneq ($(KERNELRELEASE),)
+
ifeq ($(VERSION).$(PATCHLEVEL),2.6)
export-objs :=
list-multi :=
else
+include $(obj)/Makefile.kern24
+
multi-m := $(filter $(list-multi), $(obj-m))
int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs)))
export-objs := $(filter $(int-m) $(obj-m),$(export-objs))
endif
-include $(obj)/Makefile.kern24
--include $(TOPDIR)/Rules.make
-else
-# take version info from last module build if available
--include $(obj)/.version
endif
#################################################
@@ -67,11 +86,9 @@ SNAPSHOT_CFLAGS := -DSNAPSHOT='$(shell cat $(snapshot))'
EXTRA_CFLAGS += $(SNAPSHOT_CFLAGS)
endif
-KDIR := /lib/modules/$(KERNELRELEASE)/build
PWD := $(shell pwd)
-DEST := /lib/modules/$(KERNELRELEASE)/$(MDIR)
+DEST := /lib/modules/$(KERNELRELEASE)/v4l2
KDIR26 := /lib/modules/$(KERNELRELEASE)/kernel/drivers/media
-KDIRUSB := /lib/modules/$(KERNELRELEASE)/kernel/drivers/usb/media
#################################################
# Compiler fixup rules
@@ -130,6 +147,9 @@ Makefile.media:: .version
.version::
ifneq ($(KERNELRELEASE),)
@echo -e VERSION=$(VERSION)\\nPATCHLEVEL:=$(PATCHLEVEL)\\nSUBLEVEL:=$(SUBLEVEL)\\nKERNELRELEASE:=$(KERNELRELEASE) > $(obj)/.version
+ifneq ($(SRCDIR),)
+ @echo -e SRCDIR=$(SRCDIR)\\n >> $(obj)/.version
+endif
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%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
@@ -140,9 +160,28 @@ ifneq ($(VER),)
@echo "Forcing compiling to version $(VER)."
@echo $(VER)|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
else
+ifneq ($(DIR),)
+ @perl -e 'open IN,"<$(DIR)/Makefile"; \
+ while (<IN>) { \
+ if (/^VERSION\s*=\s*([0-9]+)/){ $$version=$$1; next; }\
+ if (/^PATCHLEVEL\s*=\s*([0-9]+)/){ $$level=$$1; next; }\
+ if (/^SUBLEVEL\s*=\s*([0-9]+)/){ $$sublevel=$$1; next; }\
+ if (/^EXTRAVERSION\s*=\s*([^\s]+)\n/){ $$extra=$$1; next; }\
+ }; \
+ printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n", \
+ $$version,$$level,$$sublevel,$$version,$$level,$$sublevel,$$extra); \
+ printf ("SRCDIR:=$(DIR)\n");' > $(obj)/.version
+ @cat .version|grep KERNELRELEASE:|sed s,'KERNELRELEASE:=','Forcing compiling to version ',
+
+ @if [ ! -f $(DIR)/scripts/kallsyms ]; then \
+ echo "*** Warning: You should configure and build kernel before compiling V4L"; \
+ fi
+
+else
@echo "No version specified. Using `uname -r`."
@uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version
endif
+endif
links::
@echo creating symbolic links...