NetBSD/share/mk/bsd.kmod.mk

99 lines
1.9 KiB
Makefile
Raw Normal View History

1997-05-07 21:17:20 +04:00
# $NetBSD: bsd.kmod.mk,v 1.15 1997/05/07 17:17:20 mycroft Exp $
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
1997-05-07 19:53:28 +04:00
.include <bsd.own.mk>
1997-05-07 00:54:31 +04:00
.MAIN: all
1997-05-07 19:53:28 +04:00
.PHONY: cleankmod kmodinstall load unload
install: kmodinstall
clean cleandir: cleankmod
1997-05-07 00:54:31 +04:00
1997-05-07 19:53:28 +04:00
S!= cd ${.CURDIR}/..;pwd
KERN= $S/kern
1997-05-07 19:53:28 +04:00
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
CFLAGS+= ${COPTS} -D_KERNEL -D_LKM -I. -I${.CURDIR} -I$S -I$S/arch
1996-08-28 03:31:47 +04:00
CLEANFILES+= machine ${MACHINE}
DPSRCS+= ${SRCS:M*.h}
OBJS+= ${SRCS:N*.h: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 ${PROG}
machine:
ln -s $S/arch/${MACHINE}/include machine
ln -s machine ${MACHINE}
cleankmod:
rm -f a.out [Ee]rrs mklog core *.core \
${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
#
# if no beforedepend target is defined, generate an empty target here
#
.if !target(beforedepend)
beforedepend: machine
.endif
#
# 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
.if !target(lint)
lint: ${LOBJS}
.if defined(LOBJS) && !empty(LOBJS)
@${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
.endif
.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
.if !defined(NOMAN)
.include <bsd.man.mk>
.endif
.include <bsd.obj.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.subdir.mk>
.include <bsd.sys.mk>