NetBSD/share/mk/bsd.kmod.mk

94 lines
1.9 KiB
Makefile
Raw Normal View History

# $NetBSD: bsd.kmod.mk,v 1.26 1998/04/09 00:32:36 tv Exp $
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
1997-05-07 19:53:28 +04:00
.include <bsd.own.mk>
.include <bsd.obj.mk>
1997-05-07 00:54:31 +04:00
.MAIN: all
.endif
1997-05-07 19:53:28 +04:00
.PHONY: cleankmod kmodinstall load unload
realinstall: kmodinstall
clean cleandir: cleankmod
1997-05-07 00:54:31 +04:00
1997-05-07 23:25:16 +04:00
S?= /sys
1997-05-07 19:53:28 +04:00
KERN= $S/kern
CFLAGS+= ${COPTS} -D_KERNEL -D_LKM -I. -I${.CURDIR} -I$S -I$S/arch
1997-05-09 17:40:34 +04:00
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
1996-08-28 03:31:47 +04:00
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if !defined(PROG)
PROG= ${KMOD}.o
.endif
${PROG}: ${DPSRCS} ${OBJS} ${DPADD}
${LD} -r ${LDFLAGS} -o tmp.o ${OBJS}
mv tmp.o ${.TARGET}
.if !defined(MAN)
MAN= ${KMOD}.4
.endif
all: machine-links ${PROG}
.PHONY: machine-links
beforedepend: machine-links
machine-links:
-rm -f machine && \
ln -s $S/arch/${MACHINE}/include machine
-rm -f ${MACHINE_ARCH} && \
ln -s $S/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH}
CLEANFILES+=machine ${MACHINE_ARCH}
cleankmod:
rm -f a.out [Ee]rrs mklog core *.core \
${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
#
# define various install targets
#
1997-05-07 21:17:20 +04:00
.if !target(kmodinstall)
1997-05-07 19:53:28 +04:00
kmodinstall:: ${DESTDIR}${KMODDIR}/${PROG}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${KMODDIR}/${PROG}
.endif
.if !defined(BUILD)
${DESTDIR}${KMODDIR}/${PROG}: .MADE
.endif
.PRECIOUS: ${DESTDIR}${KMODDIR}/${PROG}
${DESTDIR}${KMODDIR}/${PROG}: ${PROG}
${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
${.ALLSRC} ${.TARGET}
.endif
lint: ${LOBJS}
.if defined(LOBJS) && !empty(LOBJS)
${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
.endif
.if !target(load)
load: ${PROG}
/sbin/modload -o ${KMOD} -e${KMOD}_lkmentry ${PROG}
.endif
.if !target(unload)
unload: ${PROG}
/sbin/modunload -n ${KMOD}
.endif
.include <bsd.man.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>