# DF-5146 kernel-module harness Makefile.
# Compiles the REAL, unmodified /usr/src/sys/dev/drm/drm_hashtab.c
# (via .PATH) into the module, with the same include flags the drm
# module itself uses (cf. /usr/src/sys/dev/drm/drm/Makefile:121-124).
#
#   make            -> baseline build (broken linux/hash.h)
#   make FIX=1      -> fixed build   (fixinc/linux/hash.h wins via -I)
SYSDIR?=	/usr/src/sys
.PATH:		${SYSDIR}/dev/drm

KMOD=		htcollapse
SRCS=		htcollapse.c drm_hashtab.c
SRCS+=		bus_if.h device_if.h pci_if.h opt_ddb.h opt_drm.h

KCFLAGS+=	-I${SYSDIR}/dev/drm/include
KCFLAGS+=	-I${SYSDIR}/dev/drm/include/drm
KCFLAGS+=	-I${SYSDIR}/dev/drm/include/uapi
KCFLAGS+=	-include ${SYSDIR}/dev/drm/kconfig.h
KCFLAGS+=	-DKBUILD_MODNAME=\"htcollapse\"

.if ${FIX:U0} == 1
# Must come FIRST so fixinc/linux/hash.h beats the stock
# ${SYSDIR}/dev/drm/include/linux/hash.h in the include search order.
KCFLAGS:=	-I${.CURDIR}/fixinc ${KCFLAGS}
.endif

.include <bsd.kmod.mk>
