O_TARGET := ocfs.o

VERFILE = Common/ocfsver.c

CPARTNER = \
	Common/ocfsgenalloc.c	\
	Common/ocfsgensysfile.c	\
	Common/ocfsgencreate.c	\
	Common/ocfsgenutil.c	\
	Common/ocfsgenmisc.c	\
	Common/ocfsgentrans.c	\
	Common/ocfsgendirnode.c	\
	Common/ocfsgenvolcfg.c	\
	Linux/ocfsiosup.c	\
	Linux/ocfsmount.c	\
	Linux/ocfsfile.c	\
	Linux/ocfsmain.c	\
	Linux/ocfsport.c	\
	Linux/ocfsbitmap.c	\
	Linux/ocfsproc.c	\
	Linux/ocfsioctl.c	\
	Linux/ocfshash.c	\
	Linux/ocfsconf.c	\
	Linux/ocfsfilp.c 	\
	Linux/ocfsipc.c		\
	Common/ocfsgennm.c	\
	Common/ocfsgenvote.c	\
	Common/ocfsgendlm.c 

CALONE = Linux/ocfsdlm.c

SUPPORT = Support/divdi3.c

CFILES = $(CPARTNER) $(CALONE) $(SUPPORT)

HTEMP1 = $(subst .c,.h,$(CPARTNER))
HTEMP2 = $(subst Common,Common/inc,$(HTEMP1))
HPARTNER = $(subst Linux,Linux/inc,$(HTEMP2))

HALONE = \
	Common/inc/ocfs.h	\
	Common/inc/ocfsdef.h	\
	Common/inc/ocfserr.h	\
	Common/inc/ocfstrace.h	\
	Common/inc/ocfsvol.h	\
	Common/inc/ocfscom.h	\
	Common/inc/ocfsdisk.h	\
	Common/inc/ocfstrans.h	\
	Common/inc/ocfsconst.h	\
	Common/inc/ocfsdlm.h	\
	Common/inc/ocfsver.h	\
	Linux/inc/ocfsdlmp.h

HFILES = $(HPARTNER) $(HALONE)

OBJS = $(subst .c,.o,$(CFILES))
VEROBJ = $(subst .c,.o,$(VERFILE))

obj-y    := $(OBJS) $(VEROBJ)
obj-m    := $(O_TARGET)

EXTRA_CFLAGS += -DALLOW_INODE_UPDATES_WITH_NO_OIN
EXTRA_CFLAGS += -DPARANOID_LOCKS
EXTRA_CFLAGS += -ICommon/inc -ILinux/inc

include $(TOPDIR)/Rules.make

$(CFILES): $(HFILES)

$(VERFILE): ocfsver.sh $(CFILES) $(HFILES)
	@/bin/sh ./ocfsver.sh $@ $(VERSION) $(CFILES) $(HFILES)

clean:
	rm -f Common/*.o Linux/*.o Common/*.p Linux/*.p Common/*.s Linux/*.s $(VERFILE)
