diff options
Diffstat (limited to 'v4l/Makefile')
-rw-r--r-- | v4l/Makefile | 164 |
1 files changed, 94 insertions, 70 deletions
diff --git a/v4l/Makefile b/v4l/Makefile index 9acafb007..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 ################################################# @@ -18,15 +39,6 @@ default:: Makefile.media links .version ################################################# # CFLAGS configuration -# for DVB -EXTRA_CFLAGS += -DDVB_CVS=1 -EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core/ -EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/frontends/ - -ifeq ($(CONFIG_VIDEO_ADV_DEBUG),y) - EXTRA_CFLAGS += -DCONFIG_VIDEO_ADV_DEBUG=1 -endif - ifeq ($(CONFIG_XC3028),m) EXTRA_CFLAGS += -DCONFIG_XC3028=1 endif @@ -35,28 +47,6 @@ ifeq ($(CONFIG_DVB_FIRESAT),m) EXTRA_CFLAGS += -I$(srctree)/drivers/ieee1394/ endif -ifeq ($(CONFIG_VIDEO_CX88_DVB),m) - EXTRA_CFLAGS += -DCONFIG_VIDEO_CX88_DVB_MODULE=1 - EXTRA_CFLAGS += -DHAVE_CX22702=1 - EXTRA_CFLAGS += -DHAVE_OR51132=1 - EXTRA_CFLAGS += -DHAVE_LGDT330X=1 - EXTRA_CFLAGS += -DHAVE_MT352=1 - EXTRA_CFLAGS += -DHAVE_ZL10353=1 - EXTRA_CFLAGS += -DHAVE_NXT200X=1 - EXTRA_CFLAGS += -DHAVE_CX24123=1 - EXTRA_CFLAGS += -DHAVE_VP3054_I2C=1 -endif - -ifeq ($(CONFIG_VIDEO_SAA7134_DVB),m) - EXTRA_CFLAGS += -DHAVE_MT352=1 - EXTRA_CFLAGS += -DHAVE_TDA1004X=1 - EXTRA_CFLAGS += -DHAVE_NXT200X=1 -endif - -ifeq ($(CONFIG_VIDEO_BUF_DVB),m) - EXTRA_CFLAGS += -DHAVE_VIDEO_BUF_DVB=1 -endif - ifeq ($(CONFIG_DVB_AV7110_OSD),y) EXTRA_CFLAGS += -DCONFIG_DVB_AV7110_OSD=1 endif @@ -65,17 +55,6 @@ ifeq ($(CONFIG_DVB_AV7110_FIRMWARE),y) EXTRA_CFLAGS += -DCONFIG_DVB_AV7110_FIRMWARE_FILE endif -# for pvrusb2 -ifeq ($(CONFIG_VIDEO_PVRUSB2_SYSFS),y) - EXTRA_CFLAGS += -DCONFIG_VIDEO_PVRUSB2_SYSFS -endif -ifeq ($(CONFIG_VIDEO_PVRUSB2_DEBUGIFC),y) - EXTRA_CFLAGS += -DCONFIG_VIDEO_PVRUSB2_DEBUGIFC -endif -ifeq ($(CONFIG_VIDEO_PVRUSB2_24XXX),y) - EXTRA_CFLAGS += -DCONFIG_VIDEO_PVRUSB2_24XXX -endif - EXTRA_CFLAGS += -g EXTRA_CFLAGS += $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL) @@ -84,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 ################################################# @@ -109,15 +86,14 @@ 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 +HOSTCC:=$(CC) CC += -I$(obj) ifeq ($(VERSION).$(PATCHLEVEL),2.6) @@ -156,17 +132,55 @@ export LC_ALL all:: allmodconfig default ################################################# +# installation invocation rules + +install:: media-install ivtv-install + +remove rminstall:: media-rminstall ivtv-rminstall + +################################################# # Compiling preparation rules -Makefile.media:: +Makefile.media:: .version scripts/make_makefile.pl -.version: +.version:: ifneq ($(KERNELRELEASE),) - echo -e VERSION=$(VERSION)\\nPATCHLEVEL:=$(PATCHLEVEL)\\nSUBLEVEL:=$(SUBLEVEL)\\nKERNELRELEASE:=$(KERNELRELEASE) > $(obj)/.version + @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 + @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 +endif + +release:: +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:: @@ -180,7 +194,7 @@ kernel-links makelinks:: ################################################# # Cardlist updating rule -card cardlist cardlists: +card cardlist cardlists:: scripts/cardlist ################################################# @@ -202,9 +216,6 @@ distclean:: clean ################################################# # Kernel module insert/removal rules -rmmodules:: - rmmod -w $(shell echo "$(v4l_modules)"|sed s,' ','\n',g|sed s,'-','_',g|sort|uniq -d) - insmod load:: scripts/insmod.sh load @@ -222,22 +233,28 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi ; fi) -build := srctree=$(KDIR) HOSTCXX=$(CXX) HOSTCC=$(CC) CONFIG_SHELL=$(CONFIG_SHELL) -f $(KDIR)/scripts/Makefile.build obj +build := srctree=$(KDIR) HOSTCXX="$(CXX)" HOSTCC="$(HOSTCC)" CONFIG_SHELL="$(CONFIG_SHELL)" -f $(KDIR)/scripts/Makefile.build obj xconfig:: links .version - $(MAKE) -C $(KDIR) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf + -if [ ! -f $(KDIR)/scripts/kconfig/qconf ]; then \ + $(MAKE) -C $(KDIR) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf; \ + fi ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/qconf Kconfig ./scripts/make_noconfig.pl gconfig:: links .version - $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/gconf + -if [ ! -f $(KDIR)/scripts/kconfig/gconf ]; then \ + $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/gconf; \ + fi ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/gconf Kconfig ./scripts/make_noconfig.pl config:: links .version - $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/conf + -if [ ! -f $(KDIR)/scripts/kconfig/conf ]; then \ + $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/conf; \ + fi ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/conf Kconfig ./scripts/make_noconfig.pl @@ -246,14 +263,19 @@ menuconfig:: links .version ./scripts/make_kconfig.pl -rm scripts/lxdialog scripts/kconfig -if [ -d $(KDIR)/scripts/lxdialog ]; then \ - $(MAKE) -C $(KDIR) $(build)=scripts/lxdialog; \ + if [ ! -f $(KDIR)/scripts/lxdialog/lxdialog ]; then \ + $(MAKE) -C $(KDIR) $(build)=scripts/lxdialog; \ + fi; \ ln -s $(KDIR)/scripts/lxdialog scripts/lxdialog; \ fi -if [ -d $(KDIR)/scripts/kconfig ]; then \ if [ -d $(KDIR)/scripts/kconfig/lxdialog ]; then \ - $(MAKE) -C $(KDIR) $(build)=scripts/kconfig/lxdialog; \ - else \ + if [ ! -f $(KDIR)/scripts/kconfig/lxdialog ]; then \ + $(MAKE) -C $(KDIR) $(build)=scripts/kconfig/lxdialog; \ + fi; \ + fi; \ + if [ ! -f $(KDIR)/scripts/kconfig/mconf ]; then \ $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/mconf; \ fi; \ ln -s $(KDIR)/scripts/kconfig scripts/kconfig; \ @@ -310,9 +332,6 @@ old-install:: rminstall ################################################# # Tree management rules -change changes changelog:: - make -C .. changelog - update:: make -C .. update @@ -323,6 +342,11 @@ push:: make -C .. push ################################################# +# Help +help:: + @cat ../INSTALL + +################################################# # build tarballs rules RPWD := $(shell cd .. && pwd) @@ -334,7 +358,7 @@ tardest ?= . snapdir := $(HOME)/snapshot snap := $(name) -snapshot snap tarball: update distclean +snapshot snap tarball:: update distclean echo $(thisdir) echo $(name) echo $(date) > .snapshot |