#
# Makefile for the Linux 2.6 wrapfs
# $Id: Makefile,v 1.14 2004/07/30 19:51:49 cwright Exp $
#

# this is where your kernel sources are
LINUXSRC = /lib/modules/$(shell uname -r)/build
# this should point to where your kernel headers are
TOPINC = -I${LINUXSRC}/include

# Fedora Core has the annoying habit of changing the kernel prototypes on us.
FEDORAVER=$(shell rpm -q fedora-release | cut -d- -f3)
KERNELEXTRA=x$(shell uname -r | cut -d- -f 2 -s)
ifeq ($(FEDORAVER),2)
ifneq ($(KERNELEXTRA),x)
EXTRA_CFLAGS += -DFEDORACORE2
endif
endif

# allow custmom override of TOPINC and LINUXSRC
-include fistdev.mk

CC	= gcc
EXTRA_CFLAGS += -DFISTGEN -I. ${TOPINC} ${EXTRACFLAGS} -O2 -Wall -Wno-unused -fno-strict-aliasing -Werror
UCFLAGS = -DFISTGEN -I. ${TOPINC} -g -O2 -Wall -Wno-unused # -Werror

obj-m := wrapfs.o
ADD_M_SRC = FIST_MOD_SRC FIST_AUX_SRC
wrapfs-objs :=    fist_wrapfs.o \
	dentry.o file.o inode.o main.o super.o print.o \
	${ADD_M_SRC:.c=.o}

BINS	= fist_ioctl FIST_USER_BINS

all:	${BINS}
	make -C ${LINUXSRC} SUBDIRS=$(PWD) modules


fist_ioctl: fist_ioctl.c
	${CC} -o $@ $? ${UCFLAGS}

FIST_UBIN_RULES

memtest:
	perl match-malloc.pl log.txt

TAGS:
	etags -t *.[hc]



clean:
	rm -f ${obj-m:.o=.ko} ${wrapfs-objs} *.d .*.o.cmd .*.flags \#* *~
	rm -f ${BINS} TAGS
# dependencies
${wrapfs-objs}: wrapfs.h fist.h fist_wrapfs.h FIST_MOD_HDR

# additional makefile rules, if any
FIST_ADDMK

