diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-15 15:40:24 -0700 |
---|---|---|
committer | Trent Piepho <xyzzy@speakeasy.org> | 2007-10-15 15:40:24 -0700 |
commit | 09548f43dff7a5df0628fa1ead14cb588e3e188f (patch) | |
tree | f2ebce43c50a0345c6ec86673443693ead5f0b24 /v4l | |
parent | 2a5ba01ad8705048de15cd90526ecac11a2e006e (diff) | |
download | mediapointer-dvb-s2-09548f43dff7a5df0628fa1ead14cb588e3e188f.tar.gz mediapointer-dvb-s2-09548f43dff7a5df0628fa1ead14cb588e3e188f.tar.bz2 |
build: Let kernel directory be specified by setting KDIR
From: Trent Piepho <xyzzy@speakeasy.org>
Will compare KDIR to SRCDIR and if not equal regenerate .version from the
kernel specified in KDIR. The regeneration of .version is forced by making it
a .PHONY rule.
It was necessary to redo the way the release and .version targets worked. The
new way avoids the duplication of code that existed before. The release
target doesn't do anything. If release is specified as a goal, then .version
regeration is forced (via .PHONY).
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Diffstat (limited to 'v4l')
-rw-r--r-- | v4l/Makefile | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/v4l/Makefile b/v4l/Makefile index d1d8056c2..f97274db1 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -26,12 +26,20 @@ ifeq ($(wildcard $(SRCDIR)/Makefile),) SRCDIR := $(OUTDIR) endif +ifneq ($(origin KDIR), undefined) +ifneq ($(KDIR),$(SRCDIR)) +KERNELRELEASE := +override DIR := $(KDIR) +.PHONY: $(obj)/.version +endif +endif + endif # TOPDIR ################################################# # default compilation rule -default:: config-compat.h Makefile.media links $(obj)/.version oss +default:: config-compat.h Makefile.media links oss @echo Kernel build directory is $(OUTDIR) $(MAKE) -C $(OUTDIR) SUBDIRS=$(PWD) $(MYCFLAGS) modules ./scripts/rmmod.pl check @@ -39,7 +47,7 @@ default:: config-compat.h Makefile.media links $(obj)/.version oss # Object specific rules # Targets which don't need Makefile.media's rules -no-makefile-media-targets := %config clean distclean release snapshot snap \ +no-makefile-media-targets := %config clean distclean snapshot snap \ tarball release %links start insmod load stop rmmod unload reload \ card% update push %commit help debug cx88-ivtv lxdialog @@ -196,27 +204,16 @@ remove rminstall:: media-rminstall ################################################# # Compiling preparation rules -$(obj)/.version: -ifneq ($(KERNELRELEASE),) - @echo -e VERSION=$(VERSION)\\nPATCHLEVEL:=$(PATCHLEVEL)\\nSUBLEVEL:=$(SUBLEVEL)\\nKERNELRELEASE:=$(KERNELRELEASE) > $(obj)/.version -ifneq ($(SRCDIR),) - @echo -e SRCDIR=$(SRCDIR)\\n >> $(obj)/.version -endif -ifneq ($(OUTDIR),) - @echo -e OUTDIR=$(OUTDIR)\\n >> $(obj)/.version -endif -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 +.PHONY: release +ifneq ($(filter release,$(MAKECMDGOALS)),) +.PHONY: $(obj)/.version endif +release: + @true -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 +$(obj)/.version: ifneq ($(DIR),) - @echo "Searching $(DIR)/Makefile for kernel version." + @echo "Searching in $(DIR)/Makefile for kernel version." @perl \ -e '$$d="$(DIR)"; ' \ -e 'S: open IN,"$$d/Makefile"; ' \ @@ -237,7 +234,11 @@ ifneq ($(DIR),) echo "*** Warning: You should configure and build kernel before compiling V4L"; \ fi else - @echo "No version specified. Using `uname -r`." +ifneq ($(VER),) + @echo "Forcing kernel version to $(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 + @echo No version yet, 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 endif endif |