summaryrefslogtreecommitdiff
path: root/v4l/Makefile
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2006-08-31 16:42:12 -0700
committerTrent Piepho <xyzzy@speakeasy.org>2006-08-31 16:42:12 -0700
commit529dc5a3d5c603f87061f8e44cd2947b10e27af0 (patch)
tree234987e9f7382f8f3538f607571934861466f0f6 /v4l/Makefile
parentae00b25c2d3cb4ccca19d197bba285ebca7896a5 (diff)
downloadmediapointer-dvb-s2-529dc5a3d5c603f87061f8e44cd2947b10e27af0.tar.gz
mediapointer-dvb-s2-529dc5a3d5c603f87061f8e44cd2947b10e27af0.tar.bz2
Re-write make_makefile.pl, re-work v4l/Makefile
From: Trent Piepho <xyzzy@speakeasy.org> The make_makefile.pl script is re-written. The old one was nasty. This one will correctly handle Makefile lines that are continued with a backslash. It will also generate a dependency list of the Makefile used to create Makefile.media. This way if any change, Makefile.media will be automatically re-made by make. The whole business where make_makefile.pl would call make_kconfig.pl is removed. The underlying logic of the main Makefile is completely changed. Make has a feature where it will make sure any included files are up-to-date, and then restart itself if any were updated. We now take advantage of this feature. Detect when make is building only targets which do not need include files like .myconfig or Makefile.media, and don't include them in those cases. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
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