summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--v4l/Makefile78
-rw-r--r--v4l/Makefile.kernel46
2 files changed, 80 insertions, 44 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index b8eba1a44..6f86925a6 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -244,66 +244,56 @@ reload::
#################################################
# Configuration rules
-# SHELL used by kbuild
-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="$(HOSTCC)" CONFIG_SHELL="$(CONFIG_SHELL)" -f $(KDIR)/scripts/Makefile.build obj
-
-xconfig:: links .version
- -if [ ! -f $(KDIR)/scripts/kconfig/qconf ]; then \
- $(MAKE) -C $(KDIR) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf; \
- fi
+# Kernel config programs
+QCONF := $(KDIR)/scripts/kconfig/qconf
+GCONF := $(KDIR)/scripts/kconfig/gconf
+MCONF := $(KDIR)/scripts/kconfig/mconf
+CONF := $(KDIR)/scripts/kconfig/conf
+
+# lxdialog can be in either scripts/lxdialog or scripts/kconfig/lxdialog
+LXDIALOG_DIR := $(shell if [ -d $(KDIR)/scripts/kconfig/lxdialog ]; then echo kconfig/ ; fi)
+LXDIALOG_LNK := $(if $(LXDIALOG_DIR),scripts/kconfig,scripts/lxdialog)
+LXDIALOG := $(KDIR)/scripts/$(LXDIALOG_DIR)lxdialog/lxdialog
+
+xconfig:: links .version $(QCONF)
./scripts/make_kconfig.pl
- $(KDIR)/scripts/kconfig/qconf Kconfig
+ $(QCONF) Kconfig
./scripts/make_noconfig.pl
-gconfig:: links .version
- -if [ ! -f $(KDIR)/scripts/kconfig/gconf ]; then \
- $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/gconf; \
- fi
+gconfig:: links .version $(GCONF)
./scripts/make_kconfig.pl
- $(KDIR)/scripts/kconfig/gconf Kconfig
+ $(QCONF) Kconfig
./scripts/make_noconfig.pl
-config:: links .version
- -if [ ! -f $(KDIR)/scripts/kconfig/conf ]; then \
- $(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/conf; \
- fi
+config:: links .version $(CONF)
./scripts/make_kconfig.pl
- $(KDIR)/scripts/kconfig/conf Kconfig
+ $(CONF) Kconfig
./scripts/make_noconfig.pl
-menuconfig:: links .version
+menuconfig:: links .version $(MCONF) lxdialog
./scripts/make_kconfig.pl
- -rm scripts/lxdialog scripts/kconfig
- -if [ -d $(KDIR)/scripts/lxdialog ]; then \
- 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 \
- 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; \
- fi
-
- $(KDIR)/scripts/kconfig/mconf Kconfig
+ $(MCONF) Kconfig
./scripts/make_noconfig.pl
allyesconfig allmodconfig:: links .version
./scripts/make_kconfig.pl 1
./scripts/make_noconfig.pl
+# rule to build kernel conf programs
+KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0
+$(QCONF) $(GCONF) $(MCONF) $(CONF):
+ $(MAKE) -C $(KDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(notdir $@)
+
+# lxdialog has two parts, a symlink and the actual binary
+.PHONY: lxdialog
+lxdialog: $(LXDIALOG) $(LXDIALOG_LNK)
+
+$(LXDIALOG_LNK):
+ ln -snf $(KDIR)/$(LXDIALOG_LNK) $(LXDIALOG_LNK)
+
+$(LXDIALOG):
+ $(MAKE) -C $(KDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(LXDIALOG)
+
#################################################
# IVTV link rules
diff --git a/v4l/Makefile.kernel b/v4l/Makefile.kernel
new file mode 100644
index 000000000..b01c17f55
--- /dev/null
+++ b/v4l/Makefile.kernel
@@ -0,0 +1,46 @@
+# This Makefile is used to build sources that are part of the kernel tree.
+# What we want are the various programs used by the kconfig system. We can't
+# just directly call the top-level kernel Makefile, as it doesn't provide
+# targets to only build the kconfig system. It provides targets to build
+# the kconfig system *and then configure the kernel*.
+
+# What we do is include the top-level kernel Makefile here, to get all the
+# variables and rules it defines, and then add our own targets to just build
+# the kconfig system. You can think of this file as a modified version of the
+# top-level kernel Makefile that has "kconfig build only" targets added to it.
+# Each of these new targets has the prefix v4l- so it doesn't conflict with
+# any targets in the kernel Makefile.
+
+# Like the kernel Makefile, this Makefile should have the cwd be the root
+# of the kernel source.
+
+# These should be defined on the command line, to override the kernel Makefile
+# config-targets := 1
+# mixed-targets := 0
+# dot-config := 0
+
+include Makefile
+
+# Used by the config target
+v4l-conf: scripts_basic
+ $(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
+
+# Used by the xconfig target
+v4l-qconf: scripts_basic
+ $(MAKE) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf
+
+# Used by the qconfig target
+v4l-gconf: scripts_basic
+ $(MAKE) $(build)=scripts/kconfig gconf-target=1 scripts/kconfig/gconf
+
+# Used by the menuconfig target, also needs lxdialog
+v4l-mconf: scripts_basic
+ $(MAKE) $(build)=scripts/kconfig scripts/kconfig/mconf
+
+# Rule used for kernel where lxdialog is in directory scripts/lxdialog
+v4l-%/scripts/lxdialog/lxdialog: scripts_basic
+ $(MAKE) $(build)=scripts/lxdialog
+
+# Rule used for kernel where lxdialog is in directory scripts/kconfig/lxdialog
+v4l-%/scripts/kconfig/lxdialog/lxdialog: scripts_basic
+ $(MAKE) $(build)=scripts/kconfig/lxdialog