1639a2e50SGarrett Wollman# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2a304bf73SPoul-Henning Kamp# $Id: bsd.kmod.mk,v 1.12 1995/10/02 20:01:43 wollman Exp $ 3639a2e50SGarrett Wollman 4639a2e50SGarrett Wollman.if exists(${.CURDIR}/../Makefile.inc) 5639a2e50SGarrett Wollman.include "${.CURDIR}/../Makefile.inc" 6639a2e50SGarrett Wollman.endif 7639a2e50SGarrett Wollman 8639a2e50SGarrett Wollman.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 9639a2e50SGarrett Wollman 10639a2e50SGarrett Wollman# 11639a2e50SGarrett Wollman# Assume that we are in /usr/src/foo/bar, so /sys is 12639a2e50SGarrett Wollman# ${.CURDIR}/../../sys. We don't bother adding a .PATH since nothing 13639a2e50SGarrett Wollman# actually lives in /sys directly. 14639a2e50SGarrett Wollman# 15639a2e50SGarrett WollmanCFLAGS+=${COPTS} -DKERNEL -I${.CURDIR}/../../sys -W -Wcomment -Wredundant-decls 16639a2e50SGarrett Wollman 17639a2e50SGarrett WollmanKMODGRP?= bin 18639a2e50SGarrett WollmanKMODOWN?= bin 19639a2e50SGarrett WollmanKMODMODE?= 555 20639a2e50SGarrett Wollman 211aa57be3SGarrett Wollman.if defined(VFS_LKM) 221aa57be3SGarrett WollmanCFLAGS+= -DVFS_LKM -DMODVNOPS=${KMOD}vnops -I. 231aa57be3SGarrett WollmanSRCS+= vnode_if.h 241aa57be3SGarrett WollmanCLEANFILES+= vnode_if.h vnode_if.c 251aa57be3SGarrett Wollman.endif 261aa57be3SGarrett Wollman 2727a15c94SGarrett Wollman.if defined(PSEUDO_LKM) 2827a15c94SGarrett WollmanCFLAGS+= -DPSEUDO_LKM 2927a15c94SGarrett Wollman.endif 3027a15c94SGarrett Wollman 31639a2e50SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 32639a2e50SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 33639a2e50SGarrett Wollman 34639a2e50SGarrett Wollman.if !defined(PROG) 35639a2e50SGarrett WollmanPROG= ${KMOD}.o 36639a2e50SGarrett Wollman.endif 37639a2e50SGarrett Wollman 38639a2e50SGarrett Wollman${PROG}: ${DPSRCS} ${OBJS} ${DPADD} 39a304bf73SPoul-Henning Kamp ${LD} -r ${LDFLAGS} -o tmp.o ${OBJS} 40a304bf73SPoul-Henning Kamp.if defined(EXPORT_SYMS) 41a304bf73SPoul-Henning Kamp @rm -f symb.tmp 42a304bf73SPoul-Henning Kamp @for i in ${EXPORT_SYMS} ; do echo $$i >> symb.tmp ; done 43a304bf73SPoul-Henning Kamp symorder -c symb.tmp tmp.o 44a304bf73SPoul-Henning Kamp @rm -f symb.tmp 45a304bf73SPoul-Henning Kamp.endif 46a304bf73SPoul-Henning Kamp mv tmp.o ${.TARGET} 47639a2e50SGarrett Wollman 48639a2e50SGarrett Wollman.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 49639a2e50SGarrett Wollman !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 50639a2e50SGarrett Wollman !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 51639a2e50SGarrett WollmanMAN1= ${KMOD}.4 52639a2e50SGarrett Wollman.endif 53639a2e50SGarrett Wollman 54639a2e50SGarrett Wollman_PROGSUBDIR: .USE 55639a2e50SGarrett Wollman.if defined(SUBDIR) && !empty(SUBDIR) 56639a2e50SGarrett Wollman @for entry in ${SUBDIR}; do \ 57639a2e50SGarrett Wollman (${ECHODIR} "===> $$entry"; \ 58639a2e50SGarrett Wollman if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 59639a2e50SGarrett Wollman cd ${.CURDIR}/$${entry}.${MACHINE}; \ 60639a2e50SGarrett Wollman else \ 61639a2e50SGarrett Wollman cd ${.CURDIR}/$${entry}; \ 62639a2e50SGarrett Wollman fi; \ 63639a2e50SGarrett Wollman ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 64639a2e50SGarrett Wollman done 65639a2e50SGarrett Wollman.endif 66639a2e50SGarrett Wollman 67639a2e50SGarrett Wollman.MAIN: all 68973f098aSGarrett Wollmanall: ${PROG} all-man _PROGSUBDIR 69639a2e50SGarrett Wollman 70639a2e50SGarrett Wollman.if !target(clean) 71639a2e50SGarrett Wollmanclean: _PROGSUBDIR 72639a2e50SGarrett Wollman rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 73639a2e50SGarrett Wollman.endif 74639a2e50SGarrett Wollman 75639a2e50SGarrett Wollman.if !target(cleandir) 76639a2e50SGarrett Wollmancleandir: _PROGSUBDIR 77639a2e50SGarrett Wollman rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 78639a2e50SGarrett Wollman rm -f ${.CURDIR}/tags .depend 79639a2e50SGarrett Wollman cd ${.CURDIR}; rm -rf obj; 80639a2e50SGarrett Wollman.endif 81639a2e50SGarrett Wollman 82639a2e50SGarrett Wollman.if !target(install) 83639a2e50SGarrett Wollman.if !target(beforeinstall) 84639a2e50SGarrett Wollmanbeforeinstall: 85639a2e50SGarrett Wollman.endif 86639a2e50SGarrett Wollman.if !target(afterinstall) 87639a2e50SGarrett Wollmanafterinstall: 88639a2e50SGarrett Wollman.endif 89639a2e50SGarrett Wollman 90639a2e50SGarrett Wollmanrealinstall: _PROGSUBDIR 91639a2e50SGarrett Wollman ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 92639a2e50SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 93639a2e50SGarrett Wollman.if defined(LINKS) && !empty(LINKS) 94639a2e50SGarrett Wollman @set ${LINKS}; \ 95639a2e50SGarrett Wollman while test $$# -ge 2; do \ 96639a2e50SGarrett Wollman l=${DESTDIR}$$1; \ 97639a2e50SGarrett Wollman shift; \ 98639a2e50SGarrett Wollman t=${DESTDIR}$$1; \ 99639a2e50SGarrett Wollman shift; \ 100639a2e50SGarrett Wollman ${ECHO} $$t -\> $$l; \ 101639a2e50SGarrett Wollman rm -f $$t; \ 10260983531SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 103639a2e50SGarrett Wollman done; true 104639a2e50SGarrett Wollman.endif 105639a2e50SGarrett Wollman 106639a2e50SGarrett Wollmaninstall: afterinstall 107639a2e50SGarrett Wollman.if !defined(NOMAN) 108639a2e50SGarrett Wollmanafterinstall: realinstall maninstall 109639a2e50SGarrett Wollman.else 110639a2e50SGarrett Wollmanafterinstall: realinstall 111639a2e50SGarrett Wollman.endif 112639a2e50SGarrett Wollmanrealinstall: beforeinstall 113639a2e50SGarrett Wollman.endif 114639a2e50SGarrett Wollman 115d9584d76SJordan K. HubbardDISTRIBUTION?= bin 11655ff8fb1SPoul-Henning Kamp.if !target(distribute) 11755ff8fb1SPoul-Henning Kampdistribute: 118ffd87c07SPoul-Henning Kamp cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 11955ff8fb1SPoul-Henning Kamp.endif 12055ff8fb1SPoul-Henning Kamp 121639a2e50SGarrett Wollman.if !target(obj) 122639a2e50SGarrett Wollman.if defined(NOOBJ) 123639a2e50SGarrett Wollmanobj: _PROGSUBDIR 124639a2e50SGarrett Wollman.else 125639a2e50SGarrett Wollmanobj: _PROGSUBDIR 126639a2e50SGarrett Wollman @cd ${.CURDIR}; rm -rf obj; \ 127639a2e50SGarrett Wollman here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ 128639a2e50SGarrett Wollman ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ 129639a2e50SGarrett Wollman if test -d /usr/obj -a ! -d $$dest; then \ 130639a2e50SGarrett Wollman mkdir -p $$dest; \ 131639a2e50SGarrett Wollman else \ 132639a2e50SGarrett Wollman true; \ 133639a2e50SGarrett Wollman fi; 134639a2e50SGarrett Wollman.endif 135639a2e50SGarrett Wollman.endif 136639a2e50SGarrett Wollman 137639a2e50SGarrett Wollman.if !target(tags) 138639a2e50SGarrett Wollmantags: ${SRCS} _PROGSUBDIR 139639a2e50SGarrett Wollman.if defined(PROG) 140639a2e50SGarrett Wollman -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 141639a2e50SGarrett Wollman sed "s;\${.CURDIR}/;;" > tags 142639a2e50SGarrett Wollman.endif 143639a2e50SGarrett Wollman.endif 144639a2e50SGarrett Wollman 145639a2e50SGarrett Wollman.if !defined(NOMAN) 146639a2e50SGarrett Wollman.include <bsd.man.mk> 147639a2e50SGarrett Wollman.elif !target(maninstall) 148639a2e50SGarrett Wollmanmaninstall: 149973f098aSGarrett Wollmanall-man: 150639a2e50SGarrett Wollman.endif 151639a2e50SGarrett Wollman 152639a2e50SGarrett Wollman.if !target(load) 153639a2e50SGarrett Wollmanload: ${PROG} 154639a2e50SGarrett Wollman /sbin/modload -o ${KMOD} -e${KMOD} ${PROG} 155639a2e50SGarrett Wollman.endif 156639a2e50SGarrett Wollman 157639a2e50SGarrett Wollman.if !target(unload) 158639a2e50SGarrett Wollmanunload: ${PROG} 159639a2e50SGarrett Wollman /sbin/modunload -n ${KMOD} 160639a2e50SGarrett Wollman.endif 161639a2e50SGarrett Wollman 1621aa57be3SGarrett WollmanKERN= ${.CURDIR}/../../sys/kern 1631aa57be3SGarrett Wollman 1641aa57be3SGarrett Wollmanvnode_if.h: ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 1651aa57be3SGarrett Wollman sh ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 1661aa57be3SGarrett Wollman 1671aa57be3SGarrett Wollman./vnode_if.h: vnode_if.h 1681aa57be3SGarrett Wollman 169cdaec7b1SBruce Evans_DEPSUBDIR= _PROGSUBDIR 170639a2e50SGarrett Wollman.include <bsd.dep.mk> 171