1639a2e50SGarrett Wollman# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2e9dcb6beSPoul-Henning Kamp# $Id: bsd.kmod.mk,v 1.14 1995/10/15 16:46:00 phk 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 21e9dcb6beSPoul-Henning KampEXPORT_SYMS?= _${KMOD} 22e9dcb6beSPoul-Henning Kamp 231aa57be3SGarrett Wollman.if defined(VFS_LKM) 241aa57be3SGarrett WollmanCFLAGS+= -DVFS_LKM -DMODVNOPS=${KMOD}vnops -I. 251aa57be3SGarrett WollmanSRCS+= vnode_if.h 261aa57be3SGarrett WollmanCLEANFILES+= vnode_if.h vnode_if.c 271aa57be3SGarrett Wollman.endif 281aa57be3SGarrett Wollman 2927a15c94SGarrett Wollman.if defined(PSEUDO_LKM) 3027a15c94SGarrett WollmanCFLAGS+= -DPSEUDO_LKM 3127a15c94SGarrett Wollman.endif 3227a15c94SGarrett Wollman 33639a2e50SGarrett WollmanDPSRCS+= ${SRCS:M*.h} 34639a2e50SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 35639a2e50SGarrett Wollman 36639a2e50SGarrett Wollman.if !defined(PROG) 37639a2e50SGarrett WollmanPROG= ${KMOD}.o 38639a2e50SGarrett Wollman.endif 39639a2e50SGarrett Wollman 40639a2e50SGarrett Wollman${PROG}: ${DPSRCS} ${OBJS} ${DPADD} 41a304bf73SPoul-Henning Kamp ${LD} -r ${LDFLAGS} -o tmp.o ${OBJS} 42a304bf73SPoul-Henning Kamp.if defined(EXPORT_SYMS) 43a304bf73SPoul-Henning Kamp @rm -f symb.tmp 44a304bf73SPoul-Henning Kamp @for i in ${EXPORT_SYMS} ; do echo $$i >> symb.tmp ; done 45a304bf73SPoul-Henning Kamp symorder -c symb.tmp tmp.o 46a304bf73SPoul-Henning Kamp @rm -f symb.tmp 47a304bf73SPoul-Henning Kamp.endif 48a304bf73SPoul-Henning Kamp mv tmp.o ${.TARGET} 49639a2e50SGarrett Wollman 50639a2e50SGarrett Wollman.if !defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ 51639a2e50SGarrett Wollman !defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ 52639a2e50SGarrett Wollman !defined(MAN7) && !defined(MAN8) && !defined(NOMAN) 53639a2e50SGarrett WollmanMAN1= ${KMOD}.4 54639a2e50SGarrett Wollman.endif 55639a2e50SGarrett Wollman 56639a2e50SGarrett Wollman_PROGSUBDIR: .USE 57639a2e50SGarrett Wollman.if defined(SUBDIR) && !empty(SUBDIR) 58639a2e50SGarrett Wollman @for entry in ${SUBDIR}; do \ 59639a2e50SGarrett Wollman (${ECHODIR} "===> $$entry"; \ 60639a2e50SGarrett Wollman if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 61639a2e50SGarrett Wollman cd ${.CURDIR}/$${entry}.${MACHINE}; \ 62639a2e50SGarrett Wollman else \ 63639a2e50SGarrett Wollman cd ${.CURDIR}/$${entry}; \ 64639a2e50SGarrett Wollman fi; \ 65639a2e50SGarrett Wollman ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 66639a2e50SGarrett Wollman done 67639a2e50SGarrett Wollman.endif 68639a2e50SGarrett Wollman 69639a2e50SGarrett Wollman.MAIN: all 70973f098aSGarrett Wollmanall: ${PROG} all-man _PROGSUBDIR 71639a2e50SGarrett Wollman 72639a2e50SGarrett Wollman.if !target(clean) 73639a2e50SGarrett Wollmanclean: _PROGSUBDIR 74639a2e50SGarrett Wollman rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 75639a2e50SGarrett Wollman.endif 76639a2e50SGarrett Wollman 77639a2e50SGarrett Wollman.if !target(cleandir) 78639a2e50SGarrett Wollmancleandir: _PROGSUBDIR 79639a2e50SGarrett Wollman rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} 80639a2e50SGarrett Wollman rm -f ${.CURDIR}/tags .depend 81639a2e50SGarrett Wollman cd ${.CURDIR}; rm -rf obj; 82639a2e50SGarrett Wollman.endif 83639a2e50SGarrett Wollman 84639a2e50SGarrett Wollman.if !target(install) 85639a2e50SGarrett Wollman.if !target(beforeinstall) 86639a2e50SGarrett Wollmanbeforeinstall: 87639a2e50SGarrett Wollman.endif 88639a2e50SGarrett Wollman.if !target(afterinstall) 89639a2e50SGarrett Wollmanafterinstall: 90639a2e50SGarrett Wollman.endif 91639a2e50SGarrett Wollman 92639a2e50SGarrett Wollmanrealinstall: _PROGSUBDIR 93639a2e50SGarrett Wollman ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 94639a2e50SGarrett Wollman ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} 95639a2e50SGarrett Wollman.if defined(LINKS) && !empty(LINKS) 96639a2e50SGarrett Wollman @set ${LINKS}; \ 97639a2e50SGarrett Wollman while test $$# -ge 2; do \ 98639a2e50SGarrett Wollman l=${DESTDIR}$$1; \ 99639a2e50SGarrett Wollman shift; \ 100639a2e50SGarrett Wollman t=${DESTDIR}$$1; \ 101639a2e50SGarrett Wollman shift; \ 102639a2e50SGarrett Wollman ${ECHO} $$t -\> $$l; \ 103639a2e50SGarrett Wollman rm -f $$t; \ 10460983531SJordan K. Hubbard ln ${LN_FLAGS} $$l $$t; \ 105639a2e50SGarrett Wollman done; true 106639a2e50SGarrett Wollman.endif 107639a2e50SGarrett Wollman 108639a2e50SGarrett Wollmaninstall: afterinstall 109639a2e50SGarrett Wollman.if !defined(NOMAN) 110639a2e50SGarrett Wollmanafterinstall: realinstall maninstall 111639a2e50SGarrett Wollman.else 112639a2e50SGarrett Wollmanafterinstall: realinstall 113639a2e50SGarrett Wollman.endif 114639a2e50SGarrett Wollmanrealinstall: beforeinstall 115639a2e50SGarrett Wollman.endif 116639a2e50SGarrett Wollman 117d9584d76SJordan K. HubbardDISTRIBUTION?= bin 11855ff8fb1SPoul-Henning Kamp.if !target(distribute) 11955ff8fb1SPoul-Henning Kampdistribute: 120ffd87c07SPoul-Henning Kamp cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 12155ff8fb1SPoul-Henning Kamp.endif 12255ff8fb1SPoul-Henning Kamp 123639a2e50SGarrett Wollman.if !target(obj) 124639a2e50SGarrett Wollman.if defined(NOOBJ) 125639a2e50SGarrett Wollmanobj: _PROGSUBDIR 126639a2e50SGarrett Wollman.else 127639a2e50SGarrett Wollmanobj: _PROGSUBDIR 128639a2e50SGarrett Wollman @cd ${.CURDIR}; rm -rf obj; \ 129639a2e50SGarrett Wollman here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ 130639a2e50SGarrett Wollman ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ 131639a2e50SGarrett Wollman if test -d /usr/obj -a ! -d $$dest; then \ 132639a2e50SGarrett Wollman mkdir -p $$dest; \ 133639a2e50SGarrett Wollman else \ 134639a2e50SGarrett Wollman true; \ 135639a2e50SGarrett Wollman fi; 136639a2e50SGarrett Wollman.endif 137639a2e50SGarrett Wollman.endif 138639a2e50SGarrett Wollman 139639a2e50SGarrett Wollman.if !target(tags) 140639a2e50SGarrett Wollmantags: ${SRCS} _PROGSUBDIR 141639a2e50SGarrett Wollman.if defined(PROG) 142639a2e50SGarrett Wollman -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 143639a2e50SGarrett Wollman sed "s;\${.CURDIR}/;;" > tags 144639a2e50SGarrett Wollman.endif 145639a2e50SGarrett Wollman.endif 146639a2e50SGarrett Wollman 147639a2e50SGarrett Wollman.if !defined(NOMAN) 148639a2e50SGarrett Wollman.include <bsd.man.mk> 149639a2e50SGarrett Wollman.elif !target(maninstall) 150639a2e50SGarrett Wollmanmaninstall: 151973f098aSGarrett Wollmanall-man: 152639a2e50SGarrett Wollman.endif 153639a2e50SGarrett Wollman 154639a2e50SGarrett Wollman.if !target(load) 155639a2e50SGarrett Wollmanload: ${PROG} 156639a2e50SGarrett Wollman /sbin/modload -o ${KMOD} -e${KMOD} ${PROG} 157639a2e50SGarrett Wollman.endif 158639a2e50SGarrett Wollman 159639a2e50SGarrett Wollman.if !target(unload) 160639a2e50SGarrett Wollmanunload: ${PROG} 161639a2e50SGarrett Wollman /sbin/modunload -n ${KMOD} 162639a2e50SGarrett Wollman.endif 163639a2e50SGarrett Wollman 1641aa57be3SGarrett WollmanKERN= ${.CURDIR}/../../sys/kern 1651aa57be3SGarrett Wollman 1661aa57be3SGarrett Wollmanvnode_if.h: ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 1671aa57be3SGarrett Wollman sh ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 1681aa57be3SGarrett Wollman 1691aa57be3SGarrett Wollman./vnode_if.h: vnode_if.h 1701aa57be3SGarrett Wollman 171cdaec7b1SBruce Evans_DEPSUBDIR= _PROGSUBDIR 172639a2e50SGarrett Wollman.include <bsd.dep.mk> 173