set extra_cflags to indicate compilation against -mm kernels
With the addition of topdir-mm.patch into the -mm tree (since 2.6.13-rc3-mm2), it is now possible for Makefile to detect whether a cvs subtree is being built against -mm or not... -mm kernels now have a .mm file in the top level directory.
inside Makefile:
mm-kernel := $(TOPDIR)/.mm
ifneq ($(mm-kernel),)MM_KERNEL_CFLAGS := -DMM_KERNEL=$(shell cat $(mm-kernel) 2> /dev/null)
ifneq ($(MM_KERNEL_CFLAGS),-DMM_KERNEL=)EXTRA_CFLAGS += $(MM_KERNEL_CFLAGS)
endif
endif
inside C files:
#ifdef MM_KERNEL
/* code needed by -mm kernel only */
#else
/* original code for compilation against -linus */ #endif
This should probably be documented somewhere, but I don't know where it goes.......
Signature · 1 line
Michael Krufky
Quoted 7 lines · Michael Krufky
With the addition of topdir-mm.patch into the -mm tree (since 2.6.13-rc3-mm2), it is now possible for
Makefileto detect whether a cvs subtree is being built against -mm or not... -mm kernels now have a .mm file in the top level directory.inside
Makefile:
Quoted 7 lines
mm-kernel := $(TOPDIR)/.mm
ifneq ($(mm-kernel),)MM_KERNEL_CFLAGS:= -DMM_KERNEL=$(shell cat $(mm-kernel) 2>/dev/null)
ifneq ($(MM_KERNEL_CFLAGS),-DMM_KERNEL=)EXTRA_CFLAGS+= $(MM_KERNEL_CFLAGS)
endif
endif
Hi Michael.
The content of the .mm file seems to be insignificant - '1'. The important issue is that the file is present.
Also please do not use $(TOPDIR) - it is deprecated.
The following is enough:EXTRA_CFLAGS += $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL)
If the file exist in the root of the kernel src tree MM_KERNEL will be added to EXTRA_CFLAGS.
Sam
Quoted 22 lines · Sam Ravnborg
Quoted 4 lines · Michael Krufky
With the addition of topdir-mm.patch into the -mm tree (since 2.6.13-rc3-mm2), it is now possible for
Makefileto detect whether a cvs subtree is being built against -mm or not... -mm kernels now have a .mm file in the top level directory.inside
Makefile:Quoted 9 lines
mm-kernel := $(TOPDIR)/.mm
ifneq ($(mm-kernel),)MM_KERNEL_CFLAGS:= -DMM_KERNEL=$(shell cat $(mm-kernel) 2>/dev/null)
ifneq ($(MM_KERNEL_CFLAGS),-DMM_KERNEL=)EXTRA_CFLAGS+= $(MM_KERNEL_CFLAGS)
endif
endifHi Michael.
The content of the .mm file seems to be insignificant - '1'. The important issue is that the file is present.
Also please do not use $(TOPDIR) - it is deprecated.
Quoted 6 lines
The following is enough:
EXTRA_CFLAGS+= $(if $(wildcard $(srctree)/.mm), -DMM_KERNEL)If the file exist in the root of the kernel src tree
MM_KERNELwill be added toEXTRA_CFLAGS.
Sam-
Thank you! I knew there might be a more efficient way to do that, so I'm glad I sent that to LKML for you to see ;-)
Still, I think it should be added into the documentation somewhere... I'd be happy to submit a patch, I just don't know where it should go. Obviously, this is specific to -mm kernels only. Do you know?
Signature · 1 line
Michael Krufky