1# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2# $Id: bsd.kmod.mk,v 1.10 1995/02/25 20:51:11 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 27.if defined(PSEUDO_LKM) 28CFLAGS+= -DPSEUDO_LKM 29.endif 30 31DPSRCS+= ${SRCS:M*.h} 32OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 33 34.if !defined(PROG) 35PROG= ${KMOD}.o 36.endif 37 38${PROG}: ${DPSRCS} ${OBJS} ${DPADD} 39 ${LD} -r ${LDFLAGS} -o ${.TARGET} ${OBJS} 40 41.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 42 !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 43 !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 44MAN1= ${KMOD}.4 45.endif 46 47_PROGSUBDIR: .USE 48.if defined(SUBDIR) && !empty(SUBDIR) 49 @for entry in ${SUBDIR}; do \ 50 (${ECHODIR} "===> $$entry"; \ 51 if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 52 cd ${.CURDIR}/$${entry}.${MACHINE}; \ 53 else \ 54 cd ${.CURDIR}/$${entry}; \ 55 fi; \ 56 ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 57 done 58.endif 59 60.MAIN: all 61all: ${PROG} _PROGSUBDIR 62 63.if !target(clean) 64clean: _PROGSUBDIR 65 rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 66.endif 67 68.if !target(cleandir) 69cleandir: _PROGSUBDIR 70 rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 71 rm -f ${.CURDIR}/tags .depend 72 cd ${.CURDIR}; rm -rf obj; 73.endif 74 75.if !target(install) 76.if !target(beforeinstall) 77beforeinstall: 78.endif 79.if !target(afterinstall) 80afterinstall: 81.endif 82 83realinstall: _PROGSUBDIR 84 ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 85 ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 86.if defined(LINKS) && !empty(LINKS) 87 @set ${LINKS}; \ 88 while test $$# -ge 2; do \ 89 l=${DESTDIR}$$1; \ 90 shift; \ 91 t=${DESTDIR}$$1; \ 92 shift; \ 93 ${ECHO} $$t -\> $$l; \ 94 rm -f $$t; \ 95 ln ${LN_FLAGS} $$l $$t; \ 96 done; true 97.endif 98 99install: afterinstall 100.if !defined(NOMAN) 101afterinstall: realinstall maninstall 102.else 103afterinstall: realinstall 104.endif 105realinstall: beforeinstall 106.endif 107 108DISTRIBUTION?= bin 109.if !target(distribute) 110distribute: 111 cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 112.endif 113 114.if !target(obj) 115.if defined(NOOBJ) 116obj: _PROGSUBDIR 117.else 118obj: _PROGSUBDIR 119 @cd ${.CURDIR}; rm -rf obj; \ 120 here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ 121 ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ 122 if test -d /usr/obj -a ! -d $$dest; then \ 123 mkdir -p $$dest; \ 124 else \ 125 true; \ 126 fi; 127.endif 128.endif 129 130.if !target(tags) 131tags: ${SRCS} _PROGSUBDIR 132.if defined(PROG) 133 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 134 sed "s;\${.CURDIR}/;;" > tags 135.endif 136.endif 137 138.if !defined(NOMAN) 139.include <bsd.man.mk> 140.elif !target(maninstall) 141maninstall: 142.endif 143 144.if !target(load) 145load: ${PROG} 146 /sbin/modload -o ${KMOD} -e${KMOD} ${PROG} 147.endif 148 149.if !target(unload) 150unload: ${PROG} 151 /sbin/modunload -n ${KMOD} 152.endif 153 154KERN= ${.CURDIR}/../../sys/kern 155 156vnode_if.h: ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 157 sh ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 158 159./vnode_if.h: vnode_if.h 160 161_DEPSUBDIR= _PROGSUBDIR 162.include <bsd.dep.mk> 163