
ifeq ($(KERNELRELEASE),)
TOPDIR = ..

include $(TOPDIR)/Preamble.make
else
# We are included by kbuild.

OUR_TOPDIR	:= $(M)/..

include $(OUR_TOPDIR)/Config.make

endif

#
# As 2.6 kbuild is unhappy seeing SUBDIRS, this is a safe one to
# set globally.  Do not include trailing slashes.
#
SAFE_SUBDIRS :=

SAFE_SUBDIRS += ocfs2

ifneq ($(KERNELRELEASE),)
#
# Called under kbuild 2.6
#

obj-m	+= $(addsuffix /,$(SAFE_SUBDIRS))
INSTALL_MOD_DIR := fs/ocfs2

else
#
# Called from a regular "make". Just forward to kbuild.
#

ALL_RULES = build-modules

CLEAN_RULES = clean-modules

INSTALL_RULES = install-modules

# Traverse subdirs via Makebo for "make dist"
ifeq ($(MAKECMDGOALS),dist-all)
SUBDIRS = $(SAFE_SUBDIRS)
endif

build-modules:
	$(MAKE) -C ocfs2 stamp-md5
	$(MAKE) -C ocfs2/cluster stamp-md5
	$(MAKE) -C ocfs2/dlm stamp-md5
	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules

install-modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) modules_install

clean-modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURDIR) clean
	-rm ocfs2/stamp-md5
	-rm ocfs2/cluster/stamp-md5
	-rm ocfs2/dlm/stamp-md5

include $(TOPDIR)/Postamble.make

endif
