1997-01-22 04:34:11 +03:00
|
|
|
# $NetBSD: bsd.kmod.mk,v 1.7 1997/01/22 01:34:11 cgd Exp $
|
1996-08-23 00:33:02 +04:00
|
|
|
|
1996-08-28 03:31:47 +04:00
|
|
|
S!= cd ${.CURDIR}/..;pwd
|
1996-08-23 10:14:36 +04:00
|
|
|
|
|
|
|
KERN= $S/kern
|
1996-08-23 00:33:02 +04:00
|
|
|
|
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S
|
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
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
|
|
|
|
1996-08-28 03:31:47 +04:00
|
|
|
CLEANFILES+= machine ${MACHINE}
|
|
|
|
|
1996-08-23 00:33:02 +04:00
|
|
|
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
|
|
|
|
|
|
|
|
.MAIN: all
|
1996-08-23 10:14:36 +04:00
|
|
|
all: machine ${PROG} _SUBDIRUSE
|
|
|
|
|
|
|
|
machine:
|
|
|
|
ln -s $S/arch/${MACHINE}/include machine
|
|
|
|
ln -s machine ${MACHINE}
|
1996-08-23 00:33:02 +04:00
|
|
|
|
|
|
|
.if !target(clean)
|
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}
|
|
|
|
|
1997-01-22 04:34:11 +03:00
|
|
|
clean: _SUBDIRUSE cleankmod
|
|
|
|
cleandir: _SUBDIRUSE cleankmod
|
|
|
|
.else
|
1996-08-23 00:33:02 +04:00
|
|
|
cleandir: _SUBDIRUSE clean
|
1997-01-22 04:34:11 +03:00
|
|
|
.endif
|
1996-08-23 00:33:02 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# if no beforedepend target is defined, generate an empty target here
|
|
|
|
#
|
|
|
|
.if !target(beforedepend)
|
1996-10-22 23:41:47 +04:00
|
|
|
beforedepend: machine
|
1996-08-23 00:33:02 +04:00
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# define various install targets
|
|
|
|
#
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(realinstall)
|
|
|
|
realinstall:
|
1996-10-18 06:34:42 +04:00
|
|
|
${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
|
1996-08-23 00:33:02 +04:00
|
|
|
${PROG} ${DESTDIR}${KMODDIR}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
install: maninstall _SUBDIRUSE
|
|
|
|
.if defined(LINKS) && !empty(LINKS)
|
|
|
|
@set ${LINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
|
|
|
l=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
t=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
${ECHO} $$t -\> $$l; \
|
|
|
|
rm -f $$t; \
|
|
|
|
ln $$l $$t; \
|
|
|
|
done; true
|
|
|
|
.endif
|
|
|
|
|
|
|
|
maninstall: afterinstall
|
|
|
|
afterinstall: realinstall
|
|
|
|
realinstall: beforeinstall
|
|
|
|
.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
|
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|
|
|
|
|
|
|
|
.if !defined(NOMAN)
|
|
|
|
.include <bsd.man.mk>
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <bsd.obj.mk>
|
|
|
|
.include <bsd.dep.mk>
|
|
|
|
.include <bsd.subdir.mk>
|
|
|
|
.include <bsd.sys.mk>
|