MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(MKFILE_PATH))

# obj-m specifie we're a kernel module.
obj-m += gpstime_stress_and_verify.o
gpstime_stress_and_verify-objs := src/test.o  

ccflags-y := -I$(src)/../../

# Set the path to the Kernel build utils.
KBUILD=/lib/modules/$(shell uname -r)/build/


GPSTIME_DIR_SYMFILE ?= $(MKFILE_DIR)/../../Module.symvers
ifneq ("$(wildcard $(GPSTIME_DIR_SYMFILE))","")
$(info Using symvers file at $(GPSTIME_DIR_SYMFILE))
else
$(error You need to build the gpstime module in source, or set the GPSTIME_DIR_SYMFILE env var to point at the gpstime's Module.symvers file before building this module)
endif

KBUILD_EXTRA_SYMBOLS := $(GPSTIME_DIR_SYMFILE)

default:
	$(MAKE) -C $(KBUILD) M=$(PWD) modules

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

menuconfig:
	$(MAKE) -C $(KBUILD) M=$(PWD) menuconfig

