# set to your kernel tree
KERNEL  = /usr/src/linux-ctsync

# get the Linux architecture. Needed to find proper include file for CFLAGS
ARCH=$(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
# set default flags to compile module
#CFLAGS = -DARCH=um -DCTSYNC_DEBUG -D__KERNEL__ -DMODULE -I$(KERNEL)/include -I$(KERNEL)/arch/um/include -I$(KERNEL)/arch/um/kernel/tt/include -I$(KERNEL)/arch/um/kernel/skas/include
CFLAGS = -DCTSYNC_DEBUG -D__KERNEL__ -DMODULE -I$(KERNEL)/include 
CFLAGS+= -Wall -Wstrict-prototypes -g -fomit-frame-pointer -fno-strict-aliasing

CT_SYNC_MOD	= ct_sync.o
CT_SYNC_OBJS	= ct_sync_main.o ct_sync_sock.o ct_sync_proto.o

all:    $(CT_SYNC_MOD)

# get configuration of kernel
include $(KERNEL)/.config
# modify CFLAGS with architecture specific flags
include $(KERNEL)/arch/${ARCH}/Makefile

# enable the module versions, if configured in kernel source tree
ifdef CONFIG_MODVERSIONS
CFLAGS+= -DMODVERSIONS -include $(KERNEL)/include/linux/modversions.h
endif
# enable SMP, if configured in kernel source tree
ifdef CONFIG_SMP
CFLAGS+= -D__SMP__
endif

$(CT_SYNC_MOD): $(CT_SYNC_OBJS)
	$(LD) -r $^ -o $@

clean:
	rm -f *.o

