summaryrefslogtreecommitdiff
path: root/v4l/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/Makefile')
-rw-r--r--v4l/Makefile82
1 files changed, 43 insertions, 39 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index d20e68d4e..663369674 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -17,7 +17,12 @@ else
ifneq ($(SRCDIR),)
KDIR := $(SRCDIR)
else
+ifneq ($(KERNELRELEASE),)
KDIR := /lib/modules/$(KERNELRELEASE)/build
+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
+
+endif
endif
endif
@@ -133,9 +138,6 @@ remove rminstall:: media-rminstall ivtv-rminstall
#################################################
# Compiling preparation rules
-Makefile.media:: .version
- scripts/make_makefile.pl
-
.version::
ifneq ($(KERNELRELEASE),)
@echo -e VERSION=$(VERSION)\\nPATCHLEVEL:=$(PATCHLEVEL)\\nSUBLEVEL:=$(SUBLEVEL)\\nKERNELRELEASE:=$(KERNELRELEASE) > $(obj)/.version
@@ -147,28 +149,32 @@ else
@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
+Makefile.media:: .version
+ scripts/make_makefile.pl $(KDIR)
+
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
+ @echo "Seeking for a version at $(DIR)/Makefile."
+ @perl \
+ -e 'open IN,"$(DIR)/Makefile"; ' \
+ -e 'while (<IN>) {' \
+ -e ' if (/^VERSION\s*=\s*([0-9]+)/){ $$version=$$1; }' \
+ -e ' elsif (/^PATCHLEVEL\s*=\s*([0-9]+)/){ $$level=$$1; }' \
+ -e ' elsif (/^SUBLEVEL\s*=\s*([0-9]+)/){ $$sublevel=$$1; }' \
+ -e ' elsif (/^EXTRAVERSION\s*=\s*([^\s]+)\n/){ $$extra=$$1; }' \
+ -e '};' \
+ -e 'printf ("VERSION=%s\nPATCHLEVEL:=%s\nSUBLEVEL:=%s\nKERNELRELEASE:=%s.%s.%s%s\n",' \
+ -e ' $$version,$$level,$$sublevel,$$version,$$level,$$sublevel,$$extra);' \
+ -e '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
@@ -181,20 +187,19 @@ links::
@find ../linux/sound -name '*.[ch]' -type f -exec ln -sf '{}' . \;
config-compat.h:: .myconfig
- @echo \#ifndef __CONFIG_COMPAT_H__ > config-compat.h
- @echo \#define __CONFIG_COMPAT_H__ >> config-compat.h
- @echo >> config-compat.h
- @echo \#include \<linux\/config\.h\> >> config-compat.h
- @echo >> config-compat.h
- @grep "CONFIG\_" .myconfig | grep -v "\:\= n" | \
- sed s/"CONFIG\_"/"\#undef CONFIG\_"/1 | \
- sed s/"\:\= .*"/""/1 >> config-compat.h >> config-compat.h
- @echo >> config-compat.h
- @grep "CONFIG\_" .myconfig | grep -v "\:\= n" | \
- sed s/"CONFIG\_"/"\#define CONFIG\_"/1 | \
- sed s/"\:\="/""/1 >> config-compat.h >> config-compat.h
- @echo >> config-compat.h
- @echo \#endif >> config-compat.h
+ @perl \
+ -e 'print "#ifndef __CONFIG_COMPAT_H__\n";' \
+ -e 'print "#define __CONFIG_COMPAT_H__\n\n";' \
+ -e 'print "#include <linux/config.h>\n\n";' \
+ -e 'while(<>) {' \
+ -e ' next unless /^(\S+)\s*:= (\S+)$$/;' \
+ -e ' print "#undef $$1\n";' \
+ -e ' if($$2 eq "n") { next; }' \
+ -e ' elsif($$2 eq "m") { print "#define $$1_MODULE 1\n"; }' \
+ -e ' elsif($$2 eq "y") { print "#define $$1 1\n"; }' \
+ -e ' else { print "#define $$1 $$2\n"; }' \
+ -e '} print "\n#endif\n";' \
+ < .myconfig > config-compat.h
kernel-links makelinks::
cd ..; v4l/scripts/makelinks.sh $(KDIR)
@@ -216,8 +221,9 @@ clean::
distclean:: clean
-rm -f .version .*.o.flags .*.o.d Makefile.media \
- Kconfig Kconfig.kern .config .config.cmd
+ Kconfig Kconfig.kern .config .config.cmd .myconfig
-rm -rf .tmp_versions
+ -rm -f scripts/lxdialog scripts/kconfig
@find .. -name '*.orig' -exec rm '{}' \;
@find .. -name '*.rej' -exec rm '{}' \;
@@ -250,29 +256,27 @@ LXDIALOG_DIR := $(shell if [ -d $(KDIR)/scripts/kconfig/lxdialog ]; then echo kc
LXDIALOG_LNK := $(if $(LXDIALOG_DIR),scripts/kconfig,scripts/lxdialog)
LXDIALOG := $(KDIR)/scripts/$(LXDIALOG_DIR)lxdialog/lxdialog
+.myconfig : .config
+ ./scripts/make_myconfig.pl
+
xconfig:: links .version $(QCONF)
- ./scripts/make_kconfig.pl
+ ./scripts/make_kconfig.pl $(KDIR)
$(QCONF) Kconfig
- ./scripts/make_noconfig.pl
gconfig:: links .version $(GCONF)
- ./scripts/make_kconfig.pl
+ ./scripts/make_kconfig.pl $(KDIR)
$(QCONF) Kconfig
- ./scripts/make_noconfig.pl
config:: links .version $(CONF)
- ./scripts/make_kconfig.pl
+ ./scripts/make_kconfig.pl $(KDIR)
$(CONF) Kconfig
- ./scripts/make_noconfig.pl
menuconfig:: links .version $(MCONF) lxdialog
- ./scripts/make_kconfig.pl
+ ./scripts/make_kconfig.pl $(KDIR)
$(MCONF) Kconfig
- ./scripts/make_noconfig.pl
allyesconfig allmodconfig:: links .version
- ./scripts/make_kconfig.pl 1
- ./scripts/make_noconfig.pl
+ ./scripts/make_kconfig.pl $(KDIR) 1
# rule to build kernel conf programs
KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0