kmod.mk revision 5257
1# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2# $Id: bsd.kmod.mk,v 1.4 1994/11/13 21:05:21 phk Exp $ 3 4.if exists(${.CURDIR}/../Makefile.inc) 5.include "${.CURDIR}/../Makefile.inc" 6.endif 7 8.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 9 10# 11# Assume that we are in /usr/src/foo/bar, so /sys is 12# ${.CURDIR}/../../sys. We don't bother adding a .PATH since nothing 13# actually lives in /sys directly. 14# 15CFLAGS+=${COPTS} -DKERNEL -I${.CURDIR}/../../sys -W -Wcomment -Wredundant-decls 16 17KMODGRP?= bin 18KMODOWN?= bin 19KMODMODE?= 555 20 21.if defined(VFS_LKM) 22CFLAGS+= -DVFS_LKM -DMODVNOPS=${KMOD}vnops -I. 23SRCS+= vnode_if.h 24CLEANFILES+= vnode_if.h vnode_if.c 25.endif 26 27DPSRCS+= ${SRCS:M*.h} 28OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 29 30.if !defined(PROG) 31PROG= ${KMOD}.o 32.endif 33 34${PROG}: ${DPSRCS} ${OBJS} ${DPADD} 35 ${LD} -r ${LDFLAGS} -o ${.TARGET} ${OBJS} 36 37MKDEP= -p 38 39.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 40 !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 41 !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 42MAN1= ${KMOD}.4 43.endif 44 45_PROGSUBDIR: .USE 46.if defined(SUBDIR) && !empty(SUBDIR) 47 @for entry in ${SUBDIR}; do \ 48 (${ECHODIR} "===> $$entry"; \ 49 if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 50 cd ${.CURDIR}/$${entry}.${MACHINE}; \ 51 else \ 52 cd ${.CURDIR}/$${entry}; \ 53 fi; \ 54 ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 55 done 56.endif 57 58.MAIN: all 59all: ${PROG} _PROGSUBDIR 60 61.if !target(clean) 62clean: _PROGSUBDIR 63 rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 64.endif 65 66.if !target(cleandir) 67cleandir: _PROGSUBDIR 68 rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 69 rm -f ${.CURDIR}/tags .depend 70 cd ${.CURDIR}; rm -rf obj; 71.endif 72 73.if !target(install) 74.if !target(beforeinstall) 75beforeinstall: 76.endif 77.if !target(afterinstall) 78afterinstall: 79.endif 80 81realinstall: _PROGSUBDIR 82 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 83 ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 84.if defined(LINKS) && !empty(LINKS) 85 @set ${LINKS}; \ 86 while test $$# -ge 2; do \ 87 l=${DESTDIR}$$1; \ 88 shift; \ 89 t=${DESTDIR}$$1; \ 90 shift; \ 91 ${ECHO} $$t -\> $$l; \ 92 rm -f $$t; \ 93 ln $$l $$t; \ 94 done; true 95.endif 96 97install: afterinstall 98.if !defined(NOMAN) 99afterinstall: realinstall maninstall 100.else 101afterinstall: realinstall 102.endif 103realinstall: beforeinstall 104.endif 105 106DISTRIBUTION?= bindist 107.if !target(distribute) 108distribute: 109 cd ${.CURDIR} ; $(MAKE) install DESTDIR=${RELEASEDIR}/${DISTRIBUTION} SHARED=copies 110.endif 111 112.if !target(obj) 113.if defined(NOOBJ) 114obj: _PROGSUBDIR 115.else 116obj: _PROGSUBDIR 117 @cd ${.CURDIR}; rm -rf obj; \ 118 here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ 119 ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ 120 if test -d /usr/obj -a ! -d $$dest; then \ 121 mkdir -p $$dest; \ 122 else \ 123 true; \ 124 fi; 125.endif 126.endif 127 128.if !target(tags) 129tags: ${SRCS} _PROGSUBDIR 130.if defined(PROG) 131 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 132 sed "s;\${.CURDIR}/;;" > tags 133.endif 134.endif 135 136.if !defined(NOMAN) 137.include <bsd.man.mk> 138.elif !target(maninstall) 139maninstall: 140.endif 141 142.if !target(load) 143load: ${PROG} 144 /sbin/modload -o ${KMOD} -e${KMOD} ${PROG} 145.endif 146 147.if !target(unload) 148unload: ${PROG} 149 /sbin/modunload -n ${KMOD} 150.endif 151 152KERN= ${.CURDIR}/../../sys/kern 153 154vnode_if.h: ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 155 sh ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 156 157./vnode_if.h: vnode_if.h 158 159.include <bsd.dep.mk> 160