1# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 2# $Id: bsd.kmod.mk,v 1.19 1996/04/03 12:08:52 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# 15CWARNFLAGS?= -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \ 16 -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \ 17 -Winline 18 19CFLAGS+=${COPTS} -DKERNEL -DACTUALLY_LKM_NOT_KERNEL -I${.CURDIR}/../../sys \ 20 ${CWARNFLAGS} 21 22EXPORT_SYMS?= _${KMOD} 23 24.if defined(VFS_LKM) 25CFLAGS+= -DVFS_LKM -DMODVNOPS=${KMOD}vnops -I. 26SRCS+= vnode_if.h 27CLEANFILES+= vnode_if.h vnode_if.c 28.endif 29 30.if defined(PSEUDO_LKM) 31CFLAGS+= -DPSEUDO_LKM 32.endif 33 34DPSRCS+= ${SRCS:M*.h} 35OBJS+= ${SRCS:N*.h:R:S/$/.o/g} 36 37.if !defined(PROG) 38PROG= ${KMOD}.o 39.endif 40 41${PROG}: ${DPSRCS} ${OBJS} ${DPADD} 42 ${LD} -r ${LDFLAGS} -o tmp.o ${OBJS} 43.if defined(EXPORT_SYMS) 44 @rm -f symb.tmp 45 @for i in ${EXPORT_SYMS} ; do echo $$i >> symb.tmp ; done 46 symorder -c symb.tmp tmp.o 47 @rm -f symb.tmp 48.endif 49 mv tmp.o ${.TARGET} 50 51.if !defined(NOMAN) 52.include <bsd.man.mk> 53.if !defined(_MANPAGES) || empty(_MANPAGES) 54MAN1= ${KMOD}.4 55.endif 56 57.elif !target(maninstall) 58maninstall: 59all-man: 60.endif 61 62_PROGSUBDIR: .USE 63.if defined(SUBDIR) && !empty(SUBDIR) 64 @for entry in ${SUBDIR}; do \ 65 (${ECHODIR} "===> $$entry"; \ 66 if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ 67 cd ${.CURDIR}/$${entry}.${MACHINE}; \ 68 else \ 69 cd ${.CURDIR}/$${entry}; \ 70 fi; \ 71 ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ 72 done 73.endif 74 75.MAIN: all 76all: ${PROG} all-man _PROGSUBDIR 77 78CLEANFILES+=${PROG} ${OBJS} 79 80.if !target(install) 81.if !target(beforeinstall) 82beforeinstall: 83.endif 84.if !target(afterinstall) 85afterinstall: 86.endif 87 88realinstall: _PROGSUBDIR 89 ${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ 90 ${INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR} 91.if defined(LINKS) && !empty(LINKS) 92 @set ${LINKS}; \ 93 while test $$# -ge 2; do \ 94 l=${DESTDIR}$$1; \ 95 shift; \ 96 t=${DESTDIR}$$1; \ 97 shift; \ 98 ${ECHO} $$t -\> $$l; \ 99 rm -f $$t; \ 100 ln ${LN_FLAGS} $$l $$t; \ 101 done; true 102.endif 103 104install: afterinstall 105.if !defined(NOMAN) 106afterinstall: realinstall maninstall 107.else 108afterinstall: realinstall 109.endif 110realinstall: beforeinstall 111.endif 112 113DISTRIBUTION?= bin 114.if !target(distribute) 115distribute: 116 cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies 117.endif 118 119.if !target(tags) 120tags: ${SRCS} _PROGSUBDIR 121.if defined(PROG) 122 -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ 123 sed "s;\${.CURDIR}/;;" > tags 124.endif 125.endif 126 127 128.if !target(load) 129load: ${PROG} 130 /sbin/modload -o ${KMOD} -e${KMOD} ${PROG} 131.endif 132 133.if !target(unload) 134unload: ${PROG} 135 /sbin/modunload -n ${KMOD} 136.endif 137 138KERN= ${.CURDIR}/../../sys/kern 139 140vnode_if.h: ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 141 sh ${KERN}/vnode_if.sh ${KERN}/vnode_if.src 142 143./vnode_if.h: vnode_if.h 144 145_DEPSUBDIR= _PROGSUBDIR 146_SUBDIRUSE: _PROGSUBDIR 147.include <bsd.obj.mk> 148.include <bsd.dep.mk> 149 150