#
# Makefile for the Linux 2.2 wrapfs
#

# this should point to where your kernel headers are
TOPINC	= -I/lib/modules/$(shell uname -r)/build/include
# allow custmom override of TOPINC for fistgen developers
-include fistdev.mk

CC	:= $(shell ./kwhich gcc272 2>/dev/null || ./kwhich kgcc 2>/dev/null || echo cc)
CFLAGS	= -D__KERNEL__ -DMODULE -DFISTGEN -I. ${TOPINC} -O2 -Wall -Wno-unused -Werror
UCFLAGS = -DFISTGEN -I. ${TOPINC} -g -O2 -Wall -Wno-unused # -Werror

O_TARGET := wrapfs.o
ADD_M_SRC = FIST_MOD_SRC FIST_AUX_SRC
# vm_area.o is not needed if we use generic_file_mmap
O_OBJS   := fist_wrapfs.o \
	dentry.o file.o inode.o main.o super.o print.o \
	${ADD_M_SRC:.c=.o}

M_OBJS   := $(O_TARGET)

BINS	:=	fist_ioctl FIST_USER_BINS

all:	${O_TARGET} ${BINS}

${O_TARGET}: ${O_OBJS}
	ld -o ${O_TARGET} -r ${O_OBJS}

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

FIST_UBIN_RULES

TAGS:
	etags -t *.[hc]

clean:
	rm -f ${O_TARGET} ${O_OBJS} *.d .*.flags \#* *~
	rm -f ${BINS} TAGS

# dependencies
${O_OBJS}: wrapfs.h fist.h fist_wrapfs.h FIST_MOD_HDR

# additional makefile rules, if any
FIST_ADDMK
