# AUFS Makefile for the Linux 2.6.16 and later
# $Id: Makefile,v 1.39 2007/12/17 03:30:17 sfjro Exp $

# the environment variables are not inherited since 2.6.23
ifdef AUFS_EXTRA_CFLAGS
EXTRA_CFLAGS += ${AUFS_EXTRA_CFLAGS}
endif

########################################

ifdef CONFIG_AUFS_RR_SQUASHFS
# cf. squashfs3.2-r2 and sqlzma patch.
EXTRA_CFLAGS += -DSQUASHFS_MAGIC=0x73717368
EXTRA_CFLAGS += -DSQUASHFS_MAGIC_SWAP=0x68737173
EXTRA_CFLAGS += -DSQUASHFS_MAGIC_LZMA=0x71736873
EXTRA_CFLAGS += -DSQUASHFS_MAGIC_LZMA_SWAP=0x73687371
endif

ifdef CONFIG_AUFS_WORKAROUND_FUSE
# it isn't defined in a header file
fuse = $(shell grep '\#.*define.*FUSE_SUPER_MAGIC' ${srctree}/fs/fuse/inode.c | \
	head -n 1 | \
	awk '{print $$3}')
EXTRA_CFLAGS += -DFUSE_SUPER_MAGIC=${fuse}
endif

ifeq ($(strip $(shell test ${SUBLEVEL} -ge 24 && echo t)),t)
ifdef CONFIG_XFS_FS
# it isn't defined in a header file
xfs = $(shell grep '\#.*define.*XFS_SB_MAGIC' ${srctree}/fs/xfs/xfs_sb.h | \
	head -n 1 | \
	awk '{print $$3}')
EXTRA_CFLAGS += -DXFS_SB_MAGIC=${xfs}
endif
endif

ifdef CONFIG_TMPFS
# it isn't defined in a header file
tmpfs = $(shell grep '\#.*define.*TMPFS_MAGIC' ${srctree}/mm/shmem.c | \
	head -n 1 | \
	awk '{print $$3}')
EXTRA_CFLAGS += -DTMPFS_MAGIC=${tmpfs}
endif

########################################

obj-$(CONFIG_AUFS) += aufs.o
aufs-y := module.o super.o sbinfo.o xino.o \
	branch.o cpup.o whout.o plink.o wkq.o dcsub.o vfsub.o wbr_policy.o \
	opts.o \
	dentry.o dinfo.o \
	file.o f_op.o finfo.o \
	dir.o vdir.o \
	inode.o i_op.o i_op_add.o i_op_del.o i_op_ren.o iinfo.o \
	misc.o
#xattr.o
aufs-$(CONFIG_AUFS_SYSAUFS) += sysaufs.o
aufs-$(CONFIG_AUFS_HINOTIFY) += hinotify.o
aufs-$(CONFIG_AUFS_EXPORT) += export.o
#aufs-$(CONFIG_DEBUGFS) += dbgfs.o
aufs-$(CONFIG_AUFS_DEBUG) += debug.o
