ifeq ($(obj),) obj = . endif ################################################# # default compilation rule default:: Makefile.media links .version $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules ################################################# # Object specific rules -include $(obj)/.myconfig -include $(obj)/Makefile.media ################################################# # 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 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 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) ################################################# # Kernel 2.4/2.6 specific rules ifneq ($(KERNELRELEASE),) ifeq ($(VERSION).$(PATCHLEVEL),2.6) export-objs := list-multi := else 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 ################################################# # Directories to be used snapshot := $(wildcard $(obj)/.snapshot) ifneq ($(snapshot),) SNAPSHOT_CFLAGS := -DSNAPSHOT='$(shell cat $(snapshot))' EXTRA_CFLAGS += $(SNAPSHOT_CFLAGS) endif KDIR := /lib/modules/$(KERNELRELEASE)/build PWD := $(shell pwd) DEST := /lib/modules/$(KERNELRELEASE)/$(MDIR) KDIR26 := /lib/modules/$(KERNELRELEASE)/kernel/drivers/media KDIRUSB := /lib/modules/$(KERNELRELEASE)/kernel/drivers/usb/media ################################################# # Compiler fixup rules CC += -I$(obj) ifeq ($(VERSION).$(PATCHLEVEL),2.6) CPPFLAGS := -I$(SUBDIRS)/../linux/include $(CPPFLAGS) -I$(SUBDIRS)/ MYCFLAGS := else MYCFLAGS := CFLAGS="-I../linux/include -D__KERNEL__ -I$(KDIR)/include -DEXPORT_SYMTAB" endif ################################################# # which files to install? inst-m := $(wildcard *.ko) ifeq ($(inst-m),) inst-m := $(obj-m) endif v4l_modules := $(shell /sbin/lsmod|cut -d' ' -f1 ) $(patsubst %.ko,%,$(inst-m)) ################################################# # locales seem to cause trouble sometimes. LC_ALL = POSIX export LC_ALL ################################################# # Generic wildcard rules %.asm: %.o objdump -S $< > $@ ################################################# # all file compilation rule all:: allmodconfig default ################################################# # Compiling preparation rules Makefile.media:: scripts/make_makefile.pl .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%s\n",$$1,$$2,$$3,$$1,$$2,$$3,$$4); };' > $(obj)/.version endif links:: @echo creating symbolic links... @find ../linux/drivers/media -name '*.[ch]' -type f -exec ln -sf '{}' . \; @find ../linux/sound -name '*.[ch]' -type f -exec ln -sf '{}' . \; kernel-links makelinks:: cd ..; v4l/scripts/makelinks.sh $(KDIR) ################################################# # Cardlist updating rule card cardlist cardlists: scripts/cardlist ################################################# # Cleaning rules clean:: @find . -name '*.c' -type l -exec rm '{}' \; @find . -name '*.h' -type l -exec rm '{}' \; -rm -f *~ *.o *.ko .*.o.cmd .*.ko.cmd *.mod.c av7110_firm.h fdump \ ivtv-svnversion.h \ Kconfig Kconfig.kern .config .config.cmd distclean:: clean -rm -f .version .*.o.flags .*.o.d Makefile.media -rm -rf .tmp_versions @find .. -name '*.orig' -exec rm '{}' \; @find .. -name '*.rej' -exec rm '{}' \; ################################################# # 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 rmmod unload:: scripts/insmod.sh unload reload:: scripts/insmod.sh reload ################################################# # Configuration rules xconfig:: links .version ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/qconf Kconfig ./scripts/make_noconfig.pl gconfig:: links .version ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/gconf Kconfig ./scripts/make_noconfig.pl config:: links .version ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/conf Kconfig ./scripts/make_noconfig.pl menuconfig:: links .version ./scripts/make_kconfig.pl -ln -s /usr/src/linux-2.6.16/scripts/kconfig scripts/ $(KDIR)/scripts/kconfig/mconf Kconfig ./scripts/make_noconfig.pl allmodconfig:: links .version ./scripts/make_kconfig.pl $(KDIR)/scripts/kconfig/conf -m Kconfig cat .config|grep -v CONFIG_DVB_AV7110_FIRMWARE >.config.new mv .config.new .config ./scripts/make_noconfig.pl ################################################# # IVTV link rules ivtv-checkout:: @if [ ! -d ivtv ]; then \ echo retrieving the latest ivtv sources from ivtvdriver.org; \ echo this step requires subversion to be installed; \ svn co http://ivtvdriver.org/svn/ivtv/trunk ivtv; \ fi ivtv-update ivtv-up:: ivtv @svn up ivtv ivtv-links:: ivtv-checkout @echo creating ivtv symbolic links... @find ivtv/driver -name '*.[ch]' -type f -exec ln -sf '{}' . \; @find ivtv/i2c-drivers -name '*.[ch]' -type f -exec ln -sf '{}' . \; ivtv:: ivtv-links @echo '#define IVTV_DRIVER_VERSION_COMMENT ' \ '"(v4l-dvb + ivtv virtual merge)' \ "`svn info ivtv | grep Revision`"'"' > ivtv-svnversion.h @echo ivtv trunk merged. Run make to build the entire tree. cx88-ivtv:: @echo creating cx88-ivtv symbolic links... @ln -sf ../v4l_experimental/cx88-ivtv.c . ################################################# # Old instalation rule old-install:: rminstall @echo -e "\nInstalling new V4L modules at $(DEST)..." @strip --strip-debug $(inst-m) -install -d $(DEST) -install -m 644 -c $(inst-m) $(DEST) /sbin/depmod -a ${KERNELRELEASE} ################################################# # Tree management rules change changes changelog:: make -C .. changelog update:: make -C .. update commit cvscommit hgcommit:: make -C .. commit push:: make -C .. push ################################################# # build tarballs rules RPWD := $(shell cd .. && pwd) thisdir := $(notdir $(RPWD)) name := $(thisdir) date := $(shell date +%Y%m%d) tardest ?= . snapdir := $(HOME)/snapshot snap := $(name) snapshot snap tarball: update distclean echo $(thisdir) echo $(name) echo $(date) > .snapshot (cd ..; tar czf $(snapdir)/$(snap)-$(date).tar.gz .) cp ChangeLog /$(snapdir)/$(snap)-ChangeLog-$(date) $(MAKE) -C $(snapdir)