2000-01-22 22:31:00 +03:00
|
|
|
# $NetBSD: bsd.kmod.mk,v 1.36 2000/01/22 19:31:01 mycroft Exp $
|
1996-08-23 00:33:02 +04:00
|
|
|
|
1997-10-11 12:16:24 +04:00
|
|
|
.if !target(__initialized__)
|
|
|
|
__initialized__:
|
1996-08-23 00:33:02 +04:00
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
1997-05-07 19:53:28 +04:00
|
|
|
.include <bsd.own.mk>
|
1997-10-11 12:16:24 +04:00
|
|
|
.include <bsd.obj.mk>
|
1999-09-14 05:31:11 +04:00
|
|
|
.include <bsd.depall.mk>
|
1997-05-07 00:54:31 +04:00
|
|
|
.MAIN: all
|
1997-10-11 12:16:24 +04:00
|
|
|
.endif
|
|
|
|
|
1997-05-07 19:53:28 +04:00
|
|
|
.PHONY: cleankmod kmodinstall load unload
|
1997-05-09 17:25:46 +04:00
|
|
|
realinstall: kmodinstall
|
1998-08-09 18:46:19 +04:00
|
|
|
clean cleandir distclean: 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
|
1996-08-23 00:33:02 +04:00
|
|
|
|
1996-10-22 23:41:47 +04:00
|
|
|
CFLAGS+= ${COPTS} -D_KERNEL -D_LKM -I. -I${.CURDIR} -I$S -I$S/arch
|
1996-08-23 00:33:02 +04:00
|
|
|
|
1997-05-09 17:40:34 +04:00
|
|
|
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
|
1998-04-01 20:58:33 +04:00
|
|
|
CLEANFILES+= ${DPSRCS}
|
1998-04-09 04:32:31 +04:00
|
|
|
.if defined(YHEADER)
|
|
|
|
CLEANFILES+= ${SRCS:M*.y:.y=.h}
|
|
|
|
.endif
|
1996-08-28 03:31:47 +04:00
|
|
|
|
1997-05-09 17:25:46 +04:00
|
|
|
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
|
1996-08-23 00:33:02 +04:00
|
|
|
|
|
|
|
.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
|
|
|
|
|
2000-01-22 22:31:00 +03:00
|
|
|
realall: machine-links ${PROG}
|
1996-08-23 10:14:36 +04:00
|
|
|
|
1997-05-07 23:34:16 +04:00
|
|
|
.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}
|
1997-05-09 17:25:46 +04:00
|
|
|
CLEANFILES+=machine ${MACHINE_ARCH}
|
1996-08-23 00:33:02 +04:00
|
|
|
|
1997-01-22 04:34:11 +03:00
|
|
|
cleankmod:
|
1996-08-23 00:33:02 +04:00
|
|
|
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}
|
1997-03-25 00:54:12 +03:00
|
|
|
.if !defined(UPDATE)
|
|
|
|
.PHONY: ${DESTDIR}${KMODDIR}/${PROG}
|
|
|
|
.endif
|
1999-09-05 01:48:33 +04:00
|
|
|
.if !defined(BUILD) && !make(all) && !make(${PROG})
|
1997-03-25 00:54:12 +03:00
|
|
|
${DESTDIR}${KMODDIR}/${PROG}: .MADE
|
|
|
|
.endif
|
|
|
|
|
1997-05-07 01:29:33 +04:00
|
|
|
.PRECIOUS: ${DESTDIR}${KMODDIR}/${PROG}
|
1997-03-25 00:54:12 +03:00
|
|
|
${DESTDIR}${KMODDIR}/${PROG}: ${PROG}
|
1999-08-21 10:17:45 +04:00
|
|
|
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${KMODOWN} \
|
|
|
|
-g ${KMODGRP} -m ${KMODMODE} ${.ALLSRC} ${.TARGET}
|
1997-03-25 00:54:12 +03:00
|
|
|
.endif
|
|
|
|
|
1996-08-23 00:33:02 +04:00
|
|
|
lint: ${LOBJS}
|
|
|
|
.if defined(LOBJS) && !empty(LOBJS)
|
1997-11-04 01:51:23 +03:00
|
|
|
${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
|
1996-08-23 00:33:02 +04:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(load)
|
|
|
|
load: ${PROG}
|
1999-09-22 22:06:21 +04:00
|
|
|
/sbin/modload ${KMOD_LOADFLAGS} -o ${KMOD} -e${KMOD}_lkmentry ${PROG}
|
1996-08-23 00:33:02 +04:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(unload)
|
1999-11-03 01:42:51 +03:00
|
|
|
unload:
|
1996-08-23 00:33:02 +04:00
|
|
|
/sbin/modunload -n ${KMOD}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <bsd.man.mk>
|
1997-03-25 00:54:12 +03:00
|
|
|
.include <bsd.links.mk>
|
1996-08-23 00:33:02 +04:00
|
|
|
.include <bsd.dep.mk>
|
|
|
|
.include <bsd.sys.mk>
|
1999-03-10 09:34:19 +03:00
|
|
|
|
|
|
|
.-include "machine/Makefile.inc"
|