summaryrefslogtreecommitdiff
path: root/v4l/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/Makefile')
-rw-r--r--v4l/Makefile54
1 files changed, 47 insertions, 7 deletions
diff --git a/v4l/Makefile b/v4l/Makefile
index cd3c8312c..6afa117e2 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -37,12 +37,49 @@ default:: config-compat.h Makefile.media links .version
#################################################
# Object specific rules
--include $(obj)/.kconfig.dep
+# Targets which don't need Makefile.media's rules
+no-makefile-media-targets := %config clean distclean release snapshot snap \
+ tarball release %links start insmod load stop rmmod unload reload \
+ card% update push %commit help debug ivtv% cx88-ivtv lxdialog
+
+# Targets which don't need .myconfig to exist, to keep us from including it
+no-dot-config-targets := $(no-makefile-media-targets) %install remove
+
+dot-config := 1
+ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
+ ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
+ dot-config := 0
+ endif
+endif
+
+makefile-media := 1
+ifneq ($(filter $(no-makefile-media-targets), $(MAKECMDGOALS)),)
+ ifeq ($(filter-out $(no-makefile-media-targets), $(MAKECMDGOALS)),)
+ makefile-media := 0
+ endif
+endif
+
+ifeq ($(dot-config),1)
-include $(obj)/.myconfig
+endif
+
+ifeq ($(makefile-media),1)
-include $(obj)/Makefile.media
-include $(obj)/Makefile.sound
+endif
+
+-include $(obj)/.kconfig.dep
-include $(obj)/Makefile.ivtv
+# make will try to automatically rebuild the Makefile and all includes,
+# and if any of them change, make will start over with the updated files
+
+# If it doesn't exist, this rule will build Makefile.media. If it does
+# exist, it will have dependency information in it, and only be rebuilt
+# when necessary.
+Makefile.media:
+ scripts/make_makefile.pl
+
#################################################
# CFLAGS configuration
@@ -132,7 +169,7 @@ export LC_ALL
#################################################
# all file compilation rule
-all:: allmodconfig default
+all:: default
#################################################
# installation invocation rules
@@ -155,9 +192,6 @@ 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)."
@@ -263,6 +297,13 @@ 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
+# Rule to make a .config if one doesn't exist
+# Ideally, some kind of oldconfig process would be used
+.config: .version
+ @echo "Creating default .config file"
+ ./scripts/make_kconfig.pl $(KDIR)
+ @touch .config
+
.myconfig: .config Kconfig
./scripts/make_myconfig.pl
@@ -281,8 +322,7 @@ config:: links $(CONF) Kconfig
menuconfig:: links $(MCONF) lxdialog Kconfig
$(MCONF) Kconfig
-allyesconfig allmodconfig:: links .version
- @echo "Creating default .config file"
+allyesconfig allmodconfig:: .version
./scripts/make_kconfig.pl $(KDIR) 1
# rule to build kernel conf programs