1639a2e50SGarrett Wollman# From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 27f3dea24SPeter Wemm# $FreeBSD$ 353996fadSWolfram Schneider# 41f089616SRuslan Ermilov# The include file <bsd.kmod.mk> handles building and installing loadable 51f089616SRuslan Ermilov# kernel modules. 653996fadSWolfram Schneider# 753996fadSWolfram Schneider# 853996fadSWolfram Schneider# +++ variables +++ 953996fadSWolfram Schneider# 1053996fadSWolfram Schneider# CLEANFILES Additional files to remove for the clean and cleandir targets. 1153996fadSWolfram Schneider# 121f089616SRuslan Ermilov# EXPORT_SYMS A list of symbols that should be exported from the module, 131f089616SRuslan Ermilov# or the name of a file containing a list of symbols, or YES 141f089616SRuslan Ermilov# to export all symbols. If not defined, no symbols are 151f089616SRuslan Ermilov# exported. 161f089616SRuslan Ermilov# 17fe3cac87SNick Hibma# KMOD The name of the kernel module to build. 1853996fadSWolfram Schneider# 193bdfa9e5SDavid E. O'Brien# KMODDIR Base path for kernel modules (see kld(4)). [/boot/kernel] 2053996fadSWolfram Schneider# 211f089616SRuslan Ermilov# KMODOWN Module file owner. [${BINOWN}] 2253996fadSWolfram Schneider# 231f089616SRuslan Ermilov# KMODGRP Module file group. [${BINGRP}] 2453996fadSWolfram Schneider# 251f089616SRuslan Ermilov# KMODMODE Module file mode. [${BINMODE}] 2653996fadSWolfram Schneider# 27fe3cac87SNick Hibma# KMODLOAD Command to load a kernel module [/sbin/kldload] 287bc830bbSWolfram Schneider# 29fe3cac87SNick Hibma# KMODUNLOAD Command to unload a kernel module [/sbin/kldunload] 307bc830bbSWolfram Schneider# 317fecffecSDoug Rabson# MFILES Optionally a list of interfaces used by the module. 327fecffecSDoug Rabson# This file contains a default list of interfaces. 3353996fadSWolfram Schneider# 341f089616SRuslan Ermilov# PROG The name of the kernel module to build. 351f089616SRuslan Ermilov# If not supplied, ${KMOD}.ko is used. 361f089616SRuslan Ermilov# 371f089616SRuslan Ermilov# SRCS List of source files. 381f089616SRuslan Ermilov# 391f089616SRuslan Ermilov# DESTDIR The tree where the module gets installed. [not set] 400b3178a4SMike Smith# 4153996fadSWolfram Schneider# +++ targets +++ 4253996fadSWolfram Schneider# 4353996fadSWolfram Schneider# install: 4417d6c636SRuslan Ermilov# install the kernel module; if the Makefile 4553996fadSWolfram Schneider# does not itself define the target install, the targets 4653996fadSWolfram Schneider# beforeinstall and afterinstall may also be used to cause 4753996fadSWolfram Schneider# actions immediately before and after the install target 4853996fadSWolfram Schneider# is executed. 4953996fadSWolfram Schneider# 5053996fadSWolfram Schneider# load: 511f089616SRuslan Ermilov# Load a module. 5253996fadSWolfram Schneider# 5353996fadSWolfram Schneider# unload: 541f089616SRuslan Ermilov# Unload a module. 5553996fadSWolfram Schneider# 56639a2e50SGarrett Wollman 57b7bbb709SDavid E. O'BrienAWK?= awk 58fe3cac87SNick HibmaKMODLOAD?= /sbin/kldload 59fe3cac87SNick HibmaKMODUNLOAD?= /sbin/kldunload 60f6611608SSheldon HearnOBJCOPY?= objcopy 617bc830bbSWolfram Schneider 6206639be7SPeter Wemm.if defined(KMODDEPS) 631f089616SRuslan Ermilov.error "Do not use KMODDEPS on 5.0+; use MODULE_VERSION/MODULE_DEPEND" 6406639be7SPeter Wemm.endif 6506639be7SPeter Wemm 660ac2fc87SRuslan Ermilov.include <bsd.init.mk> 67639a2e50SGarrett Wollman 68639a2e50SGarrett Wollman.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 69639a2e50SGarrett Wollman 7006d6e4fcSTom Rhodes.if ${CC} == "icc" 715a19f6d9STom RhodesCFLAGS:= ${CFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/} 72daaea395SWarner Losh.else 73f165cb7cSRuslan Ermilov. if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing) 74db0cd7e1SDavid E. O'BrienCFLAGS+= -fno-strict-aliasing 75db0cd7e1SDavid E. O'Brien. endif 76daaea395SWarner LoshWERROR?= -Werror 7706d6e4fcSTom Rhodes.endif 78daaea395SWarner LoshCFLAGS+= ${WERROR} 7948aea4daSRuslan ErmilovCFLAGS+= -D_KERNEL 808fe644b2SMike SmithCFLAGS+= -DKLD_MODULE 814a2d2630SBruce Evans 82021886ffSBruce Evans# Don't use any standard or source-relative include directories. 83021886ffSBruce Evans# Since -nostdinc will annull any previous -I paths, we repeat all 84021886ffSBruce Evans# such paths after -nostdinc. It doesn't seem to be possible to 85021886ffSBruce Evans# add to the front of `make' variable. 86021886ffSBruce Evans_ICFLAGS:= ${CFLAGS:M-I*} 8706d6e4fcSTom Rhodes.if ${CC} == "icc" 8806d6e4fcSTom RhodesNOSTDINC= -X 8906d6e4fcSTom Rhodes.else 9006d6e4fcSTom RhodesNOSTDINC= -nostdinc 9106d6e4fcSTom Rhodes.endif 9206d6e4fcSTom RhodesCFLAGS+= ${NOSTDINC} -I- ${INCLMAGIC} ${_ICFLAGS} 938fa793d0SBrian Feldman.if defined(KERNBUILDDIR) 9475504450SBrian FeldmanCFLAGS+= -include ${KERNBUILDDIR}/opt_global.h 958fa793d0SBrian Feldman.endif 96021886ffSBruce Evans 971f089616SRuslan Ermilov# Add -I paths for system headers. Individual module makefiles don't 98021886ffSBruce Evans# need any -I paths for this. Similar defaults for .PATH can't be 99021886ffSBruce Evans# set because there are no standard paths for non-headers. 10074455e55SWarner LoshCFLAGS+= -I. -I@ 1014a2d2630SBruce Evans 10202b199f1SMax Laier# Add -I path for altq headers as they are included via net/if_var.h 10302b199f1SMax Laier# for example. 10402b199f1SMax LaierCFLAGS+= -I@/contrib/altq 10502b199f1SMax Laier 106a0b845feSBruce Evans# Add a -I path to standard headers like <stddef.h>. Use a relative 107a0b845feSBruce Evans# path to src/include if possible. If the @ symlink hasn't been built 108a0b845feSBruce Evans# yet, then we can't tell if the relative path exists. Add both the 109a0b845feSBruce Evans# potential relative path and an absolute path in that case. 110a0b845feSBruce Evans.if exists(@) 111a0b845feSBruce Evans.if exists(@/../include) 112a0b845feSBruce EvansCFLAGS+= -I@/../include 113a0b845feSBruce Evans.else 114b3e17ba2SSatoshi AsamiCFLAGS+= -I${DESTDIR}/usr/include 115b3e17ba2SSatoshi Asami.endif 116a0b845feSBruce Evans.else # !@ 117a0b845feSBruce EvansCFLAGS+= -I@/../include -I${DESTDIR}/usr/include 118a0b845feSBruce Evans.endif # @ 11956bac51bSPoul-Henning Kamp 12006d6e4fcSTom Rhodes.if ${CC} != "icc" 121a92a2144SPeter WemmCFLAGS+= -finline-limit=${INLINE_LIMIT} 12206d6e4fcSTom Rhodes.endif 1232a51529fSPeter Wemm 1240b3178a4SMike Smith# Disallow common variables, and if we end up with commons from 1250b3178a4SMike Smith# somewhere unexpected, allocate storage for them in the module itself. 12606d6e4fcSTom Rhodes.if ${CC} != "icc" 1270b3178a4SMike SmithCFLAGS+= -fno-common 12806d6e4fcSTom Rhodes.endif 1290b3178a4SMike SmithLDFLAGS+= -d -warn-common 1300b3178a4SMike Smith 1319e4be63dSBruce EvansCFLAGS+= ${DEBUG_FLAGS} 13283c457dcSIan Dowse.if ${MACHINE_ARCH} == amd64 13383c457dcSIan DowseCFLAGS+= -fno-omit-frame-pointer 13483c457dcSIan Dowse.endif 1359e4be63dSBruce Evans 136fded756eSPeter Grehan.if ${MACHINE_ARCH} == "powerpc" 13755a5dcc8SPeter GrehanCFLAGS+= -mlongcall -fno-omit-frame-pointer 138fded756eSPeter Grehan.endif 139fded756eSPeter Grehan 140639a2e50SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 141639a2e50SGarrett Wollman 142639a2e50SGarrett Wollman.if !defined(PROG) 14390f60fc9SMike SmithPROG= ${KMOD}.ko 14490f60fc9SMike Smith.endif 145639a2e50SGarrett Wollman 146817b59bfSRuslan Ermilov.if !defined(DEBUG_FLAGS) 147f6611608SSheldon HearnFULLPROG= ${PROG} 148f6611608SSheldon Hearn.else 149f6611608SSheldon HearnFULLPROG= ${PROG}.debug 150f6611608SSheldon Hearn${PROG}: ${FULLPROG} 151f6611608SSheldon Hearn ${OBJCOPY} --strip-debug ${FULLPROG} ${PROG} 152f6611608SSheldon Hearn.endif 153f6611608SSheldon Hearn 1544d6bcc83SPeter Wemm.if ${MACHINE_ARCH} != amd64 155f6611608SSheldon Hearn${FULLPROG}: ${KMOD}.kld 15609be11baSPeter Wemm ${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld 157817b59bfSRuslan Ermilov.if !defined(DEBUG_FLAGS) 158817b59bfSRuslan Ermilov ${OBJCOPY} --strip-debug ${.TARGET} 1594c293d35SRuslan Ermilov.endif 1604d6bcc83SPeter Wemm.endif 16109be11baSPeter Wemm 16293f03548SMike SmithEXPORT_SYMS?= NO 16393f03548SMike Smith.if ${EXPORT_SYMS} != YES 1641f089616SRuslan ErmilovCLEANFILES+= export_syms 1650b3178a4SMike Smith.endif 1660b3178a4SMike Smith 1674d6bcc83SPeter Wemm.if ${MACHINE_ARCH} != amd64 16809be11baSPeter Wemm${KMOD}.kld: ${OBJS} 1694d6bcc83SPeter Wemm.else 1704d6bcc83SPeter Wemm${FULLPROG}: ${OBJS} 1714d6bcc83SPeter Wemm.endif 1720b3178a4SMike Smith ${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS} 1730b3178a4SMike Smith.if defined(EXPORT_SYMS) 17493f03548SMike Smith.if ${EXPORT_SYMS} != YES 1750b3178a4SMike Smith.if ${EXPORT_SYMS} == NO 1761f089616SRuslan Ermilov touch export_syms 1770b3178a4SMike Smith.elif !exists(${.CURDIR}/${EXPORT_SYMS}) 1781f089616SRuslan Ermilov echo ${EXPORT_SYMS} > export_syms 1790b3178a4SMike Smith.else 1801f089616SRuslan Ermilov grep -v '^#' < ${EXPORT_SYMS} > export_syms 1810b3178a4SMike Smith.endif 1820b3178a4SMike Smith awk -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \ 1831f089616SRuslan Ermilov export_syms | xargs -J% ${OBJCOPY} % ${.TARGET} 18493f03548SMike Smith.endif 1850b3178a4SMike Smith.endif 1864d6bcc83SPeter Wemm.if !defined(DEBUG_FLAGS) && ${MACHINE_ARCH} == amd64 1874d6bcc83SPeter Wemm ${OBJCOPY} --strip-debug ${.TARGET} 1884d6bcc83SPeter Wemm.endif 1890b3178a4SMike Smith 1904a2d2630SBruce Evans_ILINKS=@ machine 191df3a103dSWarner Losh.if ${MACHINE} != ${MACHINE_ARCH} 192df3a103dSWarner Losh_ILINKS+=${MACHINE_ARCH} 193df3a103dSWarner Losh.endif 194639a2e50SGarrett Wollman 195b25a566dSRuslan Ermilovall: objwarn ${PROG} 1964a2d2630SBruce Evans 197db00e6c5SDavid E. O'Brienbeforedepend: ${_ILINKS} 198985f41afSWarner Losh 199f3cc9575SWarner Losh# Ensure that the links exist without depending on it when it exists which 200f3cc9575SWarner Losh# causes all the modules to be rebuilt when the directory pointed to changes. 201f3cc9575SWarner Losh.for _link in ${_ILINKS} 202f3cc9575SWarner Losh.if !exists(${.OBJDIR}/${_link}) 203f3cc9575SWarner Losh${OBJS}: ${_link} 204f3cc9575SWarner Losh.endif 205f3cc9575SWarner Losh.endfor 2064a2d2630SBruce Evans 2079a8631b3SWarner Losh# Search for kernel source tree in standard places. 2089a8631b3SWarner Losh.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys 209776f50b9SRuslan Ermilov.if !defined(SYSDIR) && exists(${_dir}/kern/) 2109a8631b3SWarner LoshSYSDIR= ${_dir} 2119a8631b3SWarner Losh.endif 2129a8631b3SWarner Losh.endfor 213776f50b9SRuslan Ermilov.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) 2149a8631b3SWarner Losh.error "can't find kernel source tree" 2159a8631b3SWarner Losh.endif 2169a8631b3SWarner Losh 2174a2d2630SBruce Evans${_ILINKS}: 2189a8631b3SWarner Losh @case ${.TARGET} in \ 219df3a103dSWarner Losh ${MACHINE_ARCH}) \ 2209a8631b3SWarner Losh path=${SYSDIR}/${MACHINE_ARCH}/include ;; \ 221df3a103dSWarner Losh machine) \ 222df3a103dSWarner Losh path=${SYSDIR}/${MACHINE}/include ;; \ 22308a04a89SPeter Wemm @) \ 2249a8631b3SWarner Losh path=${SYSDIR} ;; \ 22508a04a89SPeter Wemm esac ; \ 22608a04a89SPeter Wemm path=`(cd $$path && /bin/pwd)` ; \ 22708a04a89SPeter Wemm ${ECHO} ${.TARGET} "->" $$path ; \ 22808a04a89SPeter Wemm ln -s $$path ${.TARGET} 2294a2d2630SBruce Evans 2301f089616SRuslan ErmilovCLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} ${_ILINKS} 231361186e5SMaxime Henrion 232817b59bfSRuslan Ermilov.if defined(DEBUG_FLAGS) 233361186e5SMaxime HenrionCLEANFILES+= ${FULLPROG} 234361186e5SMaxime Henrion.endif 235639a2e50SGarrett Wollman 236639a2e50SGarrett Wollman.if !target(install) 237639a2e50SGarrett Wollman 238ea87b3cbSDavid E. O'Brien_INSTALLFLAGS:= ${INSTALLFLAGS} 239e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 240e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 241e902c1bbSTim Vanderhoek.endfor 242e902c1bbSTim Vanderhoek 2431f089616SRuslan Ermilov.if !target(install.debug) && defined(DEBUG_FLAGS) 244b25a566dSRuslan Ermilovinstall.debug: 2452cbc81ffSRuslan Ermilov cd ${.CURDIR}; ${MAKE} -DINSTALL_DEBUG install 2462cbc81ffSRuslan Ermilov.endif 247a4c00586SDag-Erling Smørgrav 2482b06260dSRuslan Ermilov.if !target(realinstall) 2492b06260dSRuslan Ermilovrealinstall: _kmodinstall 2502b06260dSRuslan Ermilov.ORDER: beforeinstall _kmodinstall 2512b06260dSRuslan Ermilov_kmodinstall: 252817b59bfSRuslan Ermilov.if defined(DEBUG_FLAGS) && defined(INSTALL_DEBUG) 253d2893b16SRuslan Ermilov ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ 2542b06260dSRuslan Ermilov ${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR} 2552cbc81ffSRuslan Ermilov.else 256d2893b16SRuslan Ermilov ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ 2572b06260dSRuslan Ermilov ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR} 2582b06260dSRuslan Ermilov 2592b06260dSRuslan Ermilov.include <bsd.links.mk> 2602b06260dSRuslan Ermilov 2614875819cSJake Burkholder.if !defined(NO_XREF) 2622b06260dSRuslan Ermilovafterinstall: _kldxref 2632b06260dSRuslan Ermilov.ORDER: realinstall _kldxref 2642b06260dSRuslan Ermilov.ORDER: _installlinks _kldxref 2652b06260dSRuslan Ermilov_kldxref: 266be1d673dSRuslan Ermilov @if type kldxref >/dev/null 2>&1; then \ 267be1d673dSRuslan Ermilov ${ECHO} kldxref ${DESTDIR}${KMODDIR}; \ 268be1d673dSRuslan Ermilov kldxref ${DESTDIR}${KMODDIR}; \ 269be1d673dSRuslan Ermilov fi 270505222d3SPeter Wemm.endif 2712cbc81ffSRuslan Ermilov.endif 27222a8b405SMaxime Henrion.endif # !target(realinstall) 273639a2e50SGarrett Wollman 27422a8b405SMaxime Henrion.endif # !target(install) 275639a2e50SGarrett Wollman 276639a2e50SGarrett Wollman.if !target(load) 2779a8631b3SWarner Loshload: ${PROG} 2781f089616SRuslan Ermilov ${KMODLOAD} -v ${.OBJDIR}/${PROG} 279639a2e50SGarrett Wollman.endif 280639a2e50SGarrett Wollman 281639a2e50SGarrett Wollman.if !target(unload) 282fe3cac87SNick Hibmaunload: 2831f089616SRuslan Ermilov ${KMODUNLOAD} -v ${PROG} 28408a04a89SPeter Wemm.endif 2851aa57be3SGarrett Wollman 2866b1bb559SWarner Losh.if defined(KERNBUILDDIR) 2876b1bb559SWarner Losh.PATH: ${KERNBUILDDIR} 2886b1bb559SWarner LoshCFLAGS+= -I${KERNBUILDDIR} 2896b1bb559SWarner Losh.for _src in ${SRCS:Mopt_*.h} 2906b1bb559SWarner LoshCLEANFILES+= ${_src} 2916b1bb559SWarner Losh.if !target(${_src}) 2926b1bb559SWarner Losh${_src}: 29331e81ae4SJoerg Wunsch ln -s ${KERNBUILDDIR}/${_src} ${.TARGET} 2946b1bb559SWarner Losh.endif 2956b1bb559SWarner Losh.endfor 2966b1bb559SWarner Losh.else 2974fea6704SBruce Evans.for _src in ${SRCS:Mopt_*.h} 2984fea6704SBruce EvansCLEANFILES+= ${_src} 2994fea6704SBruce Evans.if !target(${_src}) 3004fea6704SBruce Evans${_src}: 3014fea6704SBruce Evans touch ${.TARGET} 3024fea6704SBruce Evans.endif 3034fea6704SBruce Evans.endfor 3046b1bb559SWarner Losh.endif 3054fea6704SBruce Evans 3068ca4df32SSøren SchmidtMFILES?= dev/acpica/acpi_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \ 3078ca4df32SSøren Schmidt dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \ 3088ca4df32SSøren Schmidt dev/mii/miibus_if.m dev/ofw/ofw_bus_if.m \ 3097e820aaaSMike Smith dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ 3107e820aaaSMike Smith dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \ 311268597acSMarcel Moolenaar dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ 312268597acSMarcel Moolenaar dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m dev/uart/uart_if.m \ 313335e4ff3SNate Lawson dev/usb/usb_if.m isa/isa_if.m \ 314335e4ff3SNate Lawson kern/bus_if.m kern/cpufreq_if.m kern/device_if.m \ 315268597acSMarcel Moolenaar libkern/iconv_converter_if.m opencrypto/crypto_if.m \ 31621a0216eSMarius Strobl pc98/pc98/canbus_if.m pci/agp_if.m 3177fecffecSDoug Rabson 3187fecffecSDoug Rabson.for _srcsrc in ${MFILES} 3194fea6704SBruce Evans.for _ext in c h 3204fea6704SBruce Evans.for _src in ${SRCS:M${_srcsrc:T:R}.${_ext}} 3214fea6704SBruce EvansCLEANFILES+= ${_src} 3224fea6704SBruce Evans.if !target(${_src}) 323f3cc9575SWarner Losh.if !exists(@) 3244fea6704SBruce Evans${_src}: @ 3259f73f0e8SRuslan Ermilov.else 3269fa411aeSDavid E. O'Brien${_src}: @/tools/makeobjops.awk @/${_srcsrc} 3274fea6704SBruce Evans.endif 3289fa411aeSDavid E. O'Brien ${AWK} -f @/tools/makeobjops.awk @/${_srcsrc} -${_ext} 3294fea6704SBruce Evans.endif 3304fea6704SBruce Evans.endfor # _src 3314fea6704SBruce Evans.endfor # _ext 3324fea6704SBruce Evans.endfor # _srcsrc 3334fea6704SBruce Evans 334a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Mvnode_if.c) 33578b2c868SBrian FeldmanCLEANFILES+= vnode_if.c 336f3cc9575SWarner Losh.if !exists(@) 33778b2c868SBrian Feldmanvnode_if.c: @ 3389f73f0e8SRuslan Ermilov.else 33978b2c868SBrian Feldmanvnode_if.c: @/tools/vnode_if.awk @/kern/vnode_if.src 3404fea6704SBruce Evans.endif 34178b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -c 3424fea6704SBruce Evans.endif 34378b2c868SBrian Feldman 344a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Mvnode_if.h) 3459f73f0e8SRuslan ErmilovCLEANFILES+= vnode_if.h vnode_if_newproto.h vnode_if_typedef.h 34678b2c868SBrian Feldman.if !exists(@) 3479f73f0e8SRuslan Ermilovvnode_if.h vnode_if_newproto.h vnode_if_typedef.h: @ 3489f73f0e8SRuslan Ermilov.else 3499f73f0e8SRuslan Ermilovvnode_if.h vnode_if_newproto.h vnode_if_typedef.h: @/tools/vnode_if.awk \ 3509f73f0e8SRuslan Ermilov @/kern/vnode_if.src 35178b2c868SBrian Feldman.endif 3529f73f0e8SRuslan Ermilovvnode_if.h: vnode_if_newproto.h vnode_if_typedef.h 35378b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -h 3549f73f0e8SRuslan Ermilovvnode_if_newproto.h: 35578b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -p 3569f73f0e8SRuslan Ermilovvnode_if_typedef.h: 35778b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -q 35878b2c868SBrian Feldman.endif 3591aa57be3SGarrett Wollman 3604e91eaf2SWarner Losh.for _i in mii pccard 361a7d30e5fSDavid E. O'Brien.if !empty(SRCS:M${_i}devs.h) 362dba6dd17SWarner LoshCLEANFILES+= ${_i}devs.h 3632d3ce713SDavid E. O'Brien.if !exists(@) 364dba6dd17SWarner Losh${_i}devs.h: @ 3659f73f0e8SRuslan Ermilov.else 366dba6dd17SWarner Losh${_i}devs.h: @/tools/${_i}devs2h.awk @/dev/${_i}/${_i}devs 3672d3ce713SDavid E. O'Brien.endif 368dba6dd17SWarner Losh ${AWK} -f @/tools/${_i}devs2h.awk @/dev/${_i}/${_i}devs 3692d3ce713SDavid E. O'Brien.endif 370dba6dd17SWarner Losh.endfor # _i 3712d3ce713SDavid E. O'Brien 372a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Musbdevs.h) 3734e91eaf2SWarner LoshCLEANFILES+= usbdevs.h 3744e91eaf2SWarner Losh.if !exists(@) 3754e91eaf2SWarner Loshusbdevs.h: @ 3764e91eaf2SWarner Losh.else 3774e91eaf2SWarner Loshusbdevs.h: @/tools/usbdevs2h.awk @/dev/usb/usbdevs 3784e91eaf2SWarner Losh.endif 3794e91eaf2SWarner Losh ${AWK} -f @/tools/usbdevs2h.awk @/dev/usb/usbdevs -h 3804e91eaf2SWarner Losh.endif 3814e91eaf2SWarner Losh 382a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Musbdevs_data.h) 3834e91eaf2SWarner LoshCLEANFILES+= usbdevs_data.h 3844e91eaf2SWarner Losh.if !exists(@) 3854e91eaf2SWarner Loshusbdevs_data.h: @ 3864e91eaf2SWarner Losh.else 3874e91eaf2SWarner Loshusbdevs_data.h: @/tools/usbdevs2h.awk @/dev/usb/usbdevs 3884e91eaf2SWarner Losh.endif 3894e91eaf2SWarner Losh ${AWK} -f @/tools/usbdevs2h.awk @/dev/usb/usbdevs -d 3904e91eaf2SWarner Losh.endif 3914e91eaf2SWarner Losh 392a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Macpi_quirks.h) 393684c1c1dSNate LawsonCLEANFILES+= acpi_quirks.h 394684c1c1dSNate Lawson.if !exists(@) 395684c1c1dSNate Lawsonacpi_quirks.h: @ 3969f73f0e8SRuslan Ermilov.else 397684c1c1dSNate Lawsonacpi_quirks.h: @/tools/acpi_quirks2h.awk @/dev/acpica/acpi_quirks 398684c1c1dSNate Lawson.endif 399684c1c1dSNate Lawson ${AWK} -f @/tools/acpi_quirks2h.awk @/dev/acpica/acpi_quirks 400684c1c1dSNate Lawson.endif 401684c1c1dSNate Lawson 402a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Massym.s) 403705d63cdSIan DowseCLEANFILES+= assym.s genassym.o 404705d63cdSIan Dowseassym.s: genassym.o 405705d63cdSIan Dowse.if !exists(@) 406705d63cdSIan Dowseassym.s: @ 407705d63cdSIan Dowse.else 408705d63cdSIan Dowseassym.s: @/kern/genassym.sh 409705d63cdSIan Dowse.endif 410705d63cdSIan Dowse sh @/kern/genassym.sh genassym.o > ${.TARGET} 411705d63cdSIan Dowsegenassym.o: @/${MACHINE_ARCH}/${MACHINE_ARCH}/genassym.c @ machine 412705d63cdSIan Dowse ${CC} -c ${CFLAGS:N-fno-common} \ 413705d63cdSIan Dowse @/${MACHINE_ARCH}/${MACHINE_ARCH}/genassym.c 414705d63cdSIan Dowse.endif 415705d63cdSIan Dowse 416766f7d6eSMark Murraylint: ${SRCS} 417bbb467cdSRuslan Ermilov ${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC:M*.c} 418766f7d6eSMark Murray 41968e00b92SJordan K. Hubbard.include <bsd.dep.mk> 42047da63c3SBruce Evans 421f2bffe0fSRuslan Ermilov.if !exists(${.OBJDIR}/${DEPENDFILE}) 422589d9341SBruce Evans${OBJS}: ${SRCS:M*.h} 42347da63c3SBruce Evans.endif 42447da63c3SBruce Evans 425afba897fSBruce Evans.include <bsd.obj.mk> 426ddc474a8SRuslan Ermilov.include "kern.mk" 427