obj-m += my_shmem.o
MY_CFLAGS += -g -DDEBUG
ccflags-y += ${MY_CFLAGS}
CC += ${MY_CFLAGS}

KDIR := /lib/modules/$(shell uname -r)/build
KDIR_CROSS := ${HOME}/Git/linux
KDIR_UOE := /disk/scratch/s2018374/linux
KDIR_SSHFS := /tmp/inf-sshfs/linux

PWD := $(shell pwd)
GITDIR := $(shell git rev-parse --show-toplevel)

all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules
	EXTRA_CFLAGS="$(MY_CFLAGS)"

all-cross:
	$(MAKE) -C $(KDIR_CROSS) M=$(PWD) modules
	EXTRA_CFLAGS="$(MY_CFLAGS)"

all-uoe:
	$(MAKE) -C $(KDIR_UOE) M=$(PWD) modules
	EXTRA_CFLAGS="$(MY_CFLAGS)"

all-sshfs:
	$(MAKE) -C $(KDIR_SSHFS) M=$(PWD) modules
	EXTRA_CFLAGS="$(MY_CFLAGS)"

clean:
	$(MAKE) -C $(KDIR) M=$(PWD) clean

clean-cross:
	$(MAKE) -C $(KDIR_CROSS) M=$(PWD) clean

clean-uoe:
	$(MAKE) -C $(KDIR_UOE) M=$(PWD) clean

clean-sshfs:
	$(MAKE) -C $(KDIR_SSHFS) M=$(PWD) clean


# Extra
install:
	cp my_shmem.ko $(GITDIR)/test/shared 
