wingel@acolyte.hack.org said:
> Is it still possible to build modules outside of the kernel tree? I
> really like the MTD model of building some modules where the Makefile
> looks like this:
> ifndef TOPDIR
> TOPDIR:=$(shell cd ../linux && pwd)
> endif
Er, that's not mine, is it?
My CVS tree has no hacks in the Makefiles, but has GNUmakefiles which look
something like the one below.
The hacking of TOPDIR is for compiling in old kernels without having
compatibility hacks in the Makefile - in the GNUmakefile I set TOPDIR to a
directory in which I have a hacked Rules.make which sets M_OBJS from obj-m,
sets TOPDIR back to OLDTOPDIR and includes the proper $(TOPDIR)/Rules.make.
Making this work with kbuild-2.5 so that I can just check stuff out from my
CVS tree and type 'make' as I do at the moment is something I haven't tried
yet.
# $Id: GNUmakefile,v 1.10 2002/01/03 15:00:54 dwmw2 Exp $
LINUXDIR=/lib/modules/$(shell uname -r)/build
ifndef VERSION
# Someone just typed 'make'
modules:
make -C $(LINUXDIR) SUBDIRS=`pwd` modules
dep:
make -C $(LINUXDIR) SUBDIRS=`pwd` dep
clean:
rm -f *.o */*.o
else
ifndef CONFIG_MTD
# We're being invoked outside a normal kernel build. Fake it
# We add to $CC rather than setting EXTRA_CFLAGS because the local
# header files _must_ appear before the in-kernel ones.
CC += -I$(shell pwd)/../../include
CONFIG_MTD := m
CONFIG_MTD_PARTITIONS := m
CONFIG_MTD_REDBOOT_PARTS := m
#CONFIG_MTD_BOOTLDR_PARTS := m
CONFIG_MTD_AFS_PARTS := m
CONFIG_MTD_CHAR := m
CONFIG_MTD_BLOCK := m
CONFIG_FTL := m
CONFIG_NFTL := m
CFLAGS_nftl.o := -DCONFIG_NFTL_RW
endif
# Normal case - build in-kernel
ifeq ($(VERSION),2)
ifneq ($(PATCHLEVEL),4)
ifneq ($(PATCHLEVEL),5)
OLDTOPDIR := $(TOPDIR)
TOPDIR := $(shell pwd)
endif
endif
endif
ifeq ($(VERSION),2)
ifeq ($(PATCHLEVEL),0)
obj-y += initcalls.o
endif
endif
include Makefile
endif
-- dwmw2- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:31 EST