# Makefile : auto-generated by script xcc_lkm.sh
# For 'Learn Linux Kernel Development', Kaiwan N Billimoria, Packt
#  [...]/sysfs_entry_eg
#
# To support cross-compiling for kernel modules:
# For architecture (cpu) 'arch', invoke make as:
# make ARCH=<arch> CROSS_COMPILE=<cross-compiler-prefix> 
ifeq ($(ARCH),arm)
    # *UPDATE* 'KDIR' below to point to the ARM Linux kernel source tree on your box
    KDIR ?= /home/llkd/rpi_kernel
else ifeq ($(ARCH),powerpc)
    # *UPDATE* 'KDIR' below to point to the PPC64 Linux kernel source tree on your box
    KDIR ?= /home/llkd/linux-4.9.1
else
    # x86[-64]: 'KDIR' is the Linux kernel source tree (headers) on your box
    KDIR ?= /lib/modules/$(shell uname -r)/build
endif

PWD	       := $(shell pwd)
obj-m          += sysfs_addrxlate.o
#EXTRA_CFLAGS   += -DDEBUG
$(info Building for: KREL=${KERNELRELEASE} ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} EXTRA_CFLAGS=${EXTRA_CFLAGS})

all:
	make -C $(KDIR) M=$(PWD) modules
install:
	make -C $(KDIR) M=$(PWD) modules_install
clean:
	make -C $(KDIR) M=$(PWD) clean

# 'cb' target is 'C beautifier'
cb:
	indent -linux *.[ch]
