1998-08-09 18:46:19 +04:00
|
|
|
# $NetBSD: bsd.kmod.mk,v 1.27 1998/08/09 14:46:19 lukem 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>
|
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
|
|
|
|
|
1997-05-07 23:34:16 +04:00
|
|
|
all: 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
|
|
|
|
.if !defined(BUILD)
|
|
|
|
${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}
|
1996-10-18 06:34:42 +04:00
|
|
|
${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
|
1997-03-25 00:54:12 +03:00
|
|
|
${.ALLSRC} ${.TARGET}
|
|
|
|
.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}
|
|
|
|
/sbin/modload -o ${KMOD} -e${KMOD}_lkmentry ${PROG}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(unload)
|
|
|
|
unload: ${PROG}
|
|
|
|
/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>
|