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# 396aec1278SMax Laier# FIRMWS List of firmware images in format filename:shortname:version 406aec1278SMax Laier# 4141e80f2aSFlorent Thoumie# FIRMWARE_LICENSE 427bd6fde3SFlorent Thoumie# Set to the name of the license the user has to agree on in 437bd6fde3SFlorent Thoumie# order to use this firmware. See /usr/share/doc/legal 447bd6fde3SFlorent Thoumie# 451f089616SRuslan Ermilov# DESTDIR The tree where the module gets installed. [not set] 460b3178a4SMike Smith# 4753996fadSWolfram Schneider# +++ targets +++ 4853996fadSWolfram Schneider# 4953996fadSWolfram Schneider# install: 5017d6c636SRuslan Ermilov# install the kernel module; if the Makefile 5153996fadSWolfram Schneider# does not itself define the target install, the targets 5253996fadSWolfram Schneider# beforeinstall and afterinstall may also be used to cause 5353996fadSWolfram Schneider# actions immediately before and after the install target 5453996fadSWolfram Schneider# is executed. 5553996fadSWolfram Schneider# 5653996fadSWolfram Schneider# load: 571f089616SRuslan Ermilov# Load a module. 5853996fadSWolfram Schneider# 5953996fadSWolfram Schneider# unload: 601f089616SRuslan Ermilov# Unload a module. 6153996fadSWolfram Schneider# 62639a2e50SGarrett Wollman 63b7bbb709SDavid E. O'BrienAWK?= awk 64fe3cac87SNick HibmaKMODLOAD?= /sbin/kldload 65fe3cac87SNick HibmaKMODUNLOAD?= /sbin/kldunload 66f6611608SSheldon HearnOBJCOPY?= objcopy 677bc830bbSWolfram Schneider 6806639be7SPeter Wemm.if defined(KMODDEPS) 691f089616SRuslan Ermilov.error "Do not use KMODDEPS on 5.0+; use MODULE_VERSION/MODULE_DEPEND" 7006639be7SPeter Wemm.endif 7106639be7SPeter Wemm 720ac2fc87SRuslan Ermilov.include <bsd.init.mk> 73639a2e50SGarrett Wollman 74639a2e50SGarrett Wollman.SUFFIXES: .out .o .c .cc .cxx .C .y .l .s .S 75639a2e50SGarrett Wollman 7606d6e4fcSTom Rhodes.if ${CC} == "icc" 775a19f6d9STom RhodesCFLAGS:= ${CFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/} 78daaea395SWarner Losh.else 79f165cb7cSRuslan Ermilov. if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing) 80db0cd7e1SDavid E. O'BrienCFLAGS+= -fno-strict-aliasing 81db0cd7e1SDavid E. O'Brien. endif 825d3b2922SRuslan ErmilovWERROR?= -Werror 8306d6e4fcSTom Rhodes.endif 84daaea395SWarner LoshCFLAGS+= ${WERROR} 8548aea4daSRuslan ErmilovCFLAGS+= -D_KERNEL 868fe644b2SMike SmithCFLAGS+= -DKLD_MODULE 874a2d2630SBruce Evans 88021886ffSBruce Evans# Don't use any standard or source-relative include directories. 8906d6e4fcSTom Rhodes.if ${CC} == "icc" 9006d6e4fcSTom RhodesNOSTDINC= -X 9106d6e4fcSTom Rhodes.else 92732be1f2SJung-uk KimC_DIALECT= -std=c99 9306d6e4fcSTom RhodesNOSTDINC= -nostdinc 9406d6e4fcSTom Rhodes.endif 95732be1f2SJung-uk KimCFLAGS+= ${C_DIALECT} 96da3bcc92SAlexander KabaevCFLAGS:= ${CFLAGS:N-I*} ${NOSTDINC} ${INCLMAGIC} ${CFLAGS:M-I*} 978fa793d0SBrian Feldman.if defined(KERNBUILDDIR) 980c063641SGleb SmirnoffCFLAGS+= -DHAVE_KERNEL_OPTION_HEADERS -include ${KERNBUILDDIR}/opt_global.h 998fa793d0SBrian Feldman.endif 100021886ffSBruce Evans 1011f089616SRuslan Ermilov# Add -I paths for system headers. Individual module makefiles don't 102021886ffSBruce Evans# need any -I paths for this. Similar defaults for .PATH can't be 103021886ffSBruce Evans# set because there are no standard paths for non-headers. 10474455e55SWarner LoshCFLAGS+= -I. -I@ 1054a2d2630SBruce Evans 10602b199f1SMax Laier# Add -I path for altq headers as they are included via net/if_var.h 10702b199f1SMax Laier# for example. 10802b199f1SMax LaierCFLAGS+= -I@/contrib/altq 10902b199f1SMax Laier 11006d6e4fcSTom Rhodes.if ${CC} != "icc" 111a92a2144SPeter WemmCFLAGS+= -finline-limit=${INLINE_LIMIT} 11285aa25caSWarner LoshCFLAGS+= --param inline-unit-growth=100 11385aa25caSWarner LoshCFLAGS+= --param large-function-growth=1000 11406d6e4fcSTom Rhodes.endif 1152a51529fSPeter Wemm 1160b3178a4SMike Smith# Disallow common variables, and if we end up with commons from 1170b3178a4SMike Smith# somewhere unexpected, allocate storage for them in the module itself. 11806d6e4fcSTom Rhodes.if ${CC} != "icc" 1190b3178a4SMike SmithCFLAGS+= -fno-common 12006d6e4fcSTom Rhodes.endif 1210b3178a4SMike SmithLDFLAGS+= -d -warn-common 1220b3178a4SMike Smith 1239e4be63dSBruce EvansCFLAGS+= ${DEBUG_FLAGS} 12483c457dcSIan Dowse.if ${MACHINE_ARCH} == amd64 12583c457dcSIan DowseCFLAGS+= -fno-omit-frame-pointer 12683c457dcSIan Dowse.endif 1279e4be63dSBruce Evans 128fded756eSPeter Grehan.if ${MACHINE_ARCH} == "powerpc" 12955a5dcc8SPeter GrehanCFLAGS+= -mlongcall -fno-omit-frame-pointer 130fded756eSPeter Grehan.endif 131fded756eSPeter Grehan 1326aec1278SMax Laier.if defined(FIRMWS) 1336aec1278SMax Laier.if !exists(@) 1346aec1278SMax Laier${KMOD:S/$/.c/}: @ 1356aec1278SMax Laier.else 1366aec1278SMax Laier${KMOD:S/$/.c/}: @/tools/fw_stub.awk 1376aec1278SMax Laier.endif 1387bd6fde3SFlorent Thoumie ${AWK} -f @/tools/fw_stub.awk ${FIRMWS} -m${KMOD} -c${KMOD:S/$/.c/g} \ 1397bd6fde3SFlorent Thoumie ${FIRMWARE_LICENSE:C/.+/-l/}${FIRMWARE_LICENSE} 1406aec1278SMax Laier 1416aec1278SMax LaierSRCS+= ${KMOD:S/$/.c/} 1426aec1278SMax LaierCLEANFILES+= ${KMOD:S/$/.c/} 1436aec1278SMax Laier 1446aec1278SMax Laier.for _firmw in ${FIRMWS} 1456aec1278SMax Laier${_firmw:C/\:.*$/.fwo/}: ${_firmw:C/\:.*$//} 1466aec1278SMax Laier @${ECHO} ${_firmw:C/\:.*$//} ${.ALLSRC:M*${_firmw:C/\:.*$//}} 147009b3d3dSMax Laier @if [ -e ${_firmw:C/\:.*$//} ]; then \ 148ba6a2bb3SMarcel Moolenaar ${LD} -b binary --no-warn-mismatch ${LDFLAGS} \ 149ba6a2bb3SMarcel Moolenaar -r -d -o ${.TARGET} ${_firmw:C/\:.*$//}; \ 150ff8e7669SMax Laier else \ 151ff8e7669SMax Laier ln -s ${.ALLSRC:M*${_firmw:C/\:.*$//}} ${_firmw:C/\:.*$//}; \ 152ba6a2bb3SMarcel Moolenaar ${LD} -b binary --no-warn-mismatch ${LDFLAGS} \ 153ba6a2bb3SMarcel Moolenaar -r -d -o ${.TARGET} ${_firmw:C/\:.*$//}; \ 154ff8e7669SMax Laier rm ${_firmw:C/\:.*$//}; \ 155ff8e7669SMax Laier fi 1566aec1278SMax Laier 1576aec1278SMax LaierOBJS+= ${_firmw:C/\:.*$/.fwo/} 1586aec1278SMax Laier.endfor 1596aec1278SMax Laier.endif 1606aec1278SMax Laier 161639a2e50SGarrett WollmanOBJS+= ${SRCS:N*.h:R:S/$/.o/g} 162639a2e50SGarrett Wollman 163639a2e50SGarrett Wollman.if !defined(PROG) 16490f60fc9SMike SmithPROG= ${KMOD}.ko 16590f60fc9SMike Smith.endif 166639a2e50SGarrett Wollman 167817b59bfSRuslan Ermilov.if !defined(DEBUG_FLAGS) 168f6611608SSheldon HearnFULLPROG= ${PROG} 169f6611608SSheldon Hearn.else 170f6611608SSheldon HearnFULLPROG= ${PROG}.debug 1711558abf6SRuslan Ermilov${PROG}: ${FULLPROG} ${PROG}.symbols 1721558abf6SRuslan Ermilov ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.symbols\ 17398b45a8fSRuslan Ermilov ${FULLPROG} ${.TARGET} 1741558abf6SRuslan Ermilov${PROG}.symbols: ${FULLPROG} 17598b45a8fSRuslan Ermilov ${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET} 176f6611608SSheldon Hearn.endif 177f6611608SSheldon Hearn 1784d6bcc83SPeter Wemm.if ${MACHINE_ARCH} != amd64 179f6611608SSheldon Hearn${FULLPROG}: ${KMOD}.kld 18009be11baSPeter Wemm ${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld 181817b59bfSRuslan Ermilov.if !defined(DEBUG_FLAGS) 182817b59bfSRuslan Ermilov ${OBJCOPY} --strip-debug ${.TARGET} 1834c293d35SRuslan Ermilov.endif 1844d6bcc83SPeter Wemm.endif 18509be11baSPeter Wemm 18693f03548SMike SmithEXPORT_SYMS?= NO 18793f03548SMike Smith.if ${EXPORT_SYMS} != YES 1881f089616SRuslan ErmilovCLEANFILES+= export_syms 1890b3178a4SMike Smith.endif 1900b3178a4SMike Smith 1914d6bcc83SPeter Wemm.if ${MACHINE_ARCH} != amd64 19209be11baSPeter Wemm${KMOD}.kld: ${OBJS} 1934d6bcc83SPeter Wemm.else 1944d6bcc83SPeter Wemm${FULLPROG}: ${OBJS} 1954d6bcc83SPeter Wemm.endif 1960b3178a4SMike Smith ${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS} 1970b3178a4SMike Smith.if defined(EXPORT_SYMS) 19893f03548SMike Smith.if ${EXPORT_SYMS} != YES 1990b3178a4SMike Smith.if ${EXPORT_SYMS} == NO 2008b3ae668SDag-Erling Smørgrav :> export_syms 2010b3178a4SMike Smith.elif !exists(${.CURDIR}/${EXPORT_SYMS}) 2021f089616SRuslan Ermilov echo ${EXPORT_SYMS} > export_syms 2030b3178a4SMike Smith.else 2041f089616SRuslan Ermilov grep -v '^#' < ${EXPORT_SYMS} > export_syms 2050b3178a4SMike Smith.endif 2060b3178a4SMike Smith awk -f ${SYSDIR}/conf/kmod_syms.awk ${.TARGET} \ 2071f089616SRuslan Ermilov export_syms | xargs -J% ${OBJCOPY} % ${.TARGET} 20893f03548SMike Smith.endif 2090b3178a4SMike Smith.endif 2104d6bcc83SPeter Wemm.if !defined(DEBUG_FLAGS) && ${MACHINE_ARCH} == amd64 2114d6bcc83SPeter Wemm ${OBJCOPY} --strip-debug ${.TARGET} 2124d6bcc83SPeter Wemm.endif 2130b3178a4SMike Smith 2144a2d2630SBruce Evans_ILINKS=@ machine 215df3a103dSWarner Losh.if ${MACHINE} != ${MACHINE_ARCH} 216df3a103dSWarner Losh_ILINKS+=${MACHINE_ARCH} 217df3a103dSWarner Losh.endif 218639a2e50SGarrett Wollman 219b25a566dSRuslan Ermilovall: objwarn ${PROG} 2204a2d2630SBruce Evans 221db00e6c5SDavid E. O'Brienbeforedepend: ${_ILINKS} 222985f41afSWarner Losh 223f3cc9575SWarner Losh# Ensure that the links exist without depending on it when it exists which 224f3cc9575SWarner Losh# causes all the modules to be rebuilt when the directory pointed to changes. 225f3cc9575SWarner Losh.for _link in ${_ILINKS} 226f3cc9575SWarner Losh.if !exists(${.OBJDIR}/${_link}) 227f3cc9575SWarner Losh${OBJS}: ${_link} 228f3cc9575SWarner Losh.endif 229f3cc9575SWarner Losh.endfor 2304a2d2630SBruce Evans 2319a8631b3SWarner Losh# Search for kernel source tree in standard places. 2329a8631b3SWarner Losh.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys 233776f50b9SRuslan Ermilov.if !defined(SYSDIR) && exists(${_dir}/kern/) 2349a8631b3SWarner LoshSYSDIR= ${_dir} 2359a8631b3SWarner Losh.endif 2369a8631b3SWarner Losh.endfor 237776f50b9SRuslan Ermilov.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) 2389a8631b3SWarner Losh.error "can't find kernel source tree" 2399a8631b3SWarner Losh.endif 2409a8631b3SWarner Losh 2414a2d2630SBruce Evans${_ILINKS}: 2429a8631b3SWarner Losh @case ${.TARGET} in \ 243df3a103dSWarner Losh ${MACHINE_ARCH}) \ 2449a8631b3SWarner Losh path=${SYSDIR}/${MACHINE_ARCH}/include ;; \ 245df3a103dSWarner Losh machine) \ 246df3a103dSWarner Losh path=${SYSDIR}/${MACHINE}/include ;; \ 24708a04a89SPeter Wemm @) \ 2489a8631b3SWarner Losh path=${SYSDIR} ;; \ 24908a04a89SPeter Wemm esac ; \ 25008a04a89SPeter Wemm path=`(cd $$path && /bin/pwd)` ; \ 25108a04a89SPeter Wemm ${ECHO} ${.TARGET} "->" $$path ; \ 25240244cc2SDavid E. O'Brien ln -sf $$path ${.TARGET} 2534a2d2630SBruce Evans 25474465532SRuslan ErmilovCLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} 255361186e5SMaxime Henrion 256817b59bfSRuslan Ermilov.if defined(DEBUG_FLAGS) 2571558abf6SRuslan ErmilovCLEANFILES+= ${FULLPROG} ${PROG}.symbols 258361186e5SMaxime Henrion.endif 259639a2e50SGarrett Wollman 260639a2e50SGarrett Wollman.if !target(install) 261639a2e50SGarrett Wollman 262ea87b3cbSDavid E. O'Brien_INSTALLFLAGS:= ${INSTALLFLAGS} 263e902c1bbSTim Vanderhoek.for ie in ${INSTALLFLAGS_EDIT} 264e902c1bbSTim Vanderhoek_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} 265e902c1bbSTim Vanderhoek.endfor 266e902c1bbSTim Vanderhoek 2672b06260dSRuslan Ermilov.if !target(realinstall) 2682b06260dSRuslan Ermilovrealinstall: _kmodinstall 2692b06260dSRuslan Ermilov.ORDER: beforeinstall _kmodinstall 2702b06260dSRuslan Ermilov_kmodinstall: 271d2893b16SRuslan Ermilov ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ 2722b06260dSRuslan Ermilov ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR} 27398b45a8fSRuslan Ermilov.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) 27498b45a8fSRuslan Ermilov ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ 2751558abf6SRuslan Ermilov ${_INSTALLFLAGS} ${PROG}.symbols ${DESTDIR}${KMODDIR} 276d24864f7SRuslan Ermilov.endif 2772b06260dSRuslan Ermilov 2782b06260dSRuslan Ermilov.include <bsd.links.mk> 2792b06260dSRuslan Ermilov 2804875819cSJake Burkholder.if !defined(NO_XREF) 2812b06260dSRuslan Ermilovafterinstall: _kldxref 2822b06260dSRuslan Ermilov.ORDER: realinstall _kldxref 2832b06260dSRuslan Ermilov.ORDER: _installlinks _kldxref 2842b06260dSRuslan Ermilov_kldxref: 285be1d673dSRuslan Ermilov @if type kldxref >/dev/null 2>&1; then \ 286be1d673dSRuslan Ermilov ${ECHO} kldxref ${DESTDIR}${KMODDIR}; \ 287be1d673dSRuslan Ermilov kldxref ${DESTDIR}${KMODDIR}; \ 288be1d673dSRuslan Ermilov fi 289505222d3SPeter Wemm.endif 29022a8b405SMaxime Henrion.endif # !target(realinstall) 291639a2e50SGarrett Wollman 29222a8b405SMaxime Henrion.endif # !target(install) 293639a2e50SGarrett Wollman 294639a2e50SGarrett Wollman.if !target(load) 2959a8631b3SWarner Loshload: ${PROG} 2961f089616SRuslan Ermilov ${KMODLOAD} -v ${.OBJDIR}/${PROG} 297639a2e50SGarrett Wollman.endif 298639a2e50SGarrett Wollman 299639a2e50SGarrett Wollman.if !target(unload) 300fe3cac87SNick Hibmaunload: 3011f089616SRuslan Ermilov ${KMODUNLOAD} -v ${PROG} 30208a04a89SPeter Wemm.endif 3031aa57be3SGarrett Wollman 3046b1bb559SWarner Losh.if defined(KERNBUILDDIR) 3056b1bb559SWarner Losh.PATH: ${KERNBUILDDIR} 3066b1bb559SWarner LoshCFLAGS+= -I${KERNBUILDDIR} 3076b1bb559SWarner Losh.for _src in ${SRCS:Mopt_*.h} 3086b1bb559SWarner LoshCLEANFILES+= ${_src} 3096b1bb559SWarner Losh.if !target(${_src}) 3106b1bb559SWarner Losh${_src}: 31140244cc2SDavid E. O'Brien ln -sf ${KERNBUILDDIR}/${_src} ${.TARGET} 3126b1bb559SWarner Losh.endif 3136b1bb559SWarner Losh.endfor 3146b1bb559SWarner Losh.else 3154fea6704SBruce Evans.for _src in ${SRCS:Mopt_*.h} 3164fea6704SBruce EvansCLEANFILES+= ${_src} 3174fea6704SBruce Evans.if !target(${_src}) 3184fea6704SBruce Evans${_src}: 3198b3ae668SDag-Erling Smørgrav :> ${.TARGET} 3204fea6704SBruce Evans.endif 3214fea6704SBruce Evans.endfor 3226b1bb559SWarner Losh.endif 3234fea6704SBruce Evans 324dbac8ff4SJohn BaldwinMFILES?= dev/acpica/acpi_if.m dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \ 3258ca4df32SSøren Schmidt dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \ 3268cad31a4SWarner Losh dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \ 3278ca4df32SSøren Schmidt dev/mii/miibus_if.m dev/ofw/ofw_bus_if.m \ 3287e820aaaSMike Smith dev/pccard/card_if.m dev/pccard/power_if.m dev/pci/pci_if.m \ 3297e820aaaSMike Smith dev/pci/pcib_if.m dev/ppbus/ppbus_if.m dev/smbus/smbus_if.m \ 330268597acSMarcel Moolenaar dev/sound/pcm/ac97_if.m dev/sound/pcm/channel_if.m \ 3319465d7f1SMarcel Moolenaar dev/sound/pcm/feeder_if.m dev/sound/pcm/mixer_if.m \ 332206b17d7SAlexander Leidinger dev/sound/midi/mpu_if.m dev/sound/midi/mpufoi_if.m \ 333206b17d7SAlexander Leidinger dev/sound/midi/synth_if.m dev/usb/usb_if.m isa/isa_if.m \ 334206b17d7SAlexander Leidinger kern/bus_if.m kern/cpufreq_if.m kern/device_if.m kern/serdev_if.m \ 3356810ad6fSSam Leffler libkern/iconv_converter_if.m opencrypto/cryptodev_if.m \ 336dbac8ff4SJohn Baldwin pc98/pc98/canbus_if.m 3377fecffecSDoug Rabson 3387fecffecSDoug Rabson.for _srcsrc in ${MFILES} 3394fea6704SBruce Evans.for _ext in c h 3404fea6704SBruce Evans.for _src in ${SRCS:M${_srcsrc:T:R}.${_ext}} 3414fea6704SBruce EvansCLEANFILES+= ${_src} 3424fea6704SBruce Evans.if !target(${_src}) 343f3cc9575SWarner Losh.if !exists(@) 3444fea6704SBruce Evans${_src}: @ 3459f73f0e8SRuslan Ermilov.else 3469fa411aeSDavid E. O'Brien${_src}: @/tools/makeobjops.awk @/${_srcsrc} 3474fea6704SBruce Evans.endif 3489fa411aeSDavid E. O'Brien ${AWK} -f @/tools/makeobjops.awk @/${_srcsrc} -${_ext} 3494fea6704SBruce Evans.endif 3504fea6704SBruce Evans.endfor # _src 3514fea6704SBruce Evans.endfor # _ext 3524fea6704SBruce Evans.endfor # _srcsrc 3534fea6704SBruce Evans 354a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Mvnode_if.c) 35578b2c868SBrian FeldmanCLEANFILES+= vnode_if.c 356f3cc9575SWarner Losh.if !exists(@) 35778b2c868SBrian Feldmanvnode_if.c: @ 3589f73f0e8SRuslan Ermilov.else 35978b2c868SBrian Feldmanvnode_if.c: @/tools/vnode_if.awk @/kern/vnode_if.src 3604fea6704SBruce Evans.endif 36178b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -c 3624fea6704SBruce Evans.endif 36378b2c868SBrian Feldman 364a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Mvnode_if.h) 3659f73f0e8SRuslan ErmilovCLEANFILES+= vnode_if.h vnode_if_newproto.h vnode_if_typedef.h 36678b2c868SBrian Feldman.if !exists(@) 3679f73f0e8SRuslan Ermilovvnode_if.h vnode_if_newproto.h vnode_if_typedef.h: @ 3689f73f0e8SRuslan Ermilov.else 3699f73f0e8SRuslan Ermilovvnode_if.h vnode_if_newproto.h vnode_if_typedef.h: @/tools/vnode_if.awk \ 3709f73f0e8SRuslan Ermilov @/kern/vnode_if.src 37178b2c868SBrian Feldman.endif 3729f73f0e8SRuslan Ermilovvnode_if.h: vnode_if_newproto.h vnode_if_typedef.h 37378b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -h 3749f73f0e8SRuslan Ermilovvnode_if_newproto.h: 37578b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -p 3769f73f0e8SRuslan Ermilovvnode_if_typedef.h: 37778b2c868SBrian Feldman ${AWK} -f @/tools/vnode_if.awk @/kern/vnode_if.src -q 37878b2c868SBrian Feldman.endif 3791aa57be3SGarrett Wollman 3804e91eaf2SWarner Losh.for _i in mii pccard 381a7d30e5fSDavid E. O'Brien.if !empty(SRCS:M${_i}devs.h) 382dba6dd17SWarner LoshCLEANFILES+= ${_i}devs.h 3832d3ce713SDavid E. O'Brien.if !exists(@) 384dba6dd17SWarner Losh${_i}devs.h: @ 3859f73f0e8SRuslan Ermilov.else 386dba6dd17SWarner Losh${_i}devs.h: @/tools/${_i}devs2h.awk @/dev/${_i}/${_i}devs 3872d3ce713SDavid E. O'Brien.endif 388dba6dd17SWarner Losh ${AWK} -f @/tools/${_i}devs2h.awk @/dev/${_i}/${_i}devs 3892d3ce713SDavid E. O'Brien.endif 390dba6dd17SWarner Losh.endfor # _i 3912d3ce713SDavid E. O'Brien 392a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Musbdevs.h) 3934e91eaf2SWarner LoshCLEANFILES+= usbdevs.h 3944e91eaf2SWarner Losh.if !exists(@) 3954e91eaf2SWarner Loshusbdevs.h: @ 3964e91eaf2SWarner Losh.else 3974e91eaf2SWarner Loshusbdevs.h: @/tools/usbdevs2h.awk @/dev/usb/usbdevs 3984e91eaf2SWarner Losh.endif 3994e91eaf2SWarner Losh ${AWK} -f @/tools/usbdevs2h.awk @/dev/usb/usbdevs -h 4004e91eaf2SWarner Losh.endif 4014e91eaf2SWarner Losh 402a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Musbdevs_data.h) 4034e91eaf2SWarner LoshCLEANFILES+= usbdevs_data.h 4044e91eaf2SWarner Losh.if !exists(@) 4054e91eaf2SWarner Loshusbdevs_data.h: @ 4064e91eaf2SWarner Losh.else 4074e91eaf2SWarner Loshusbdevs_data.h: @/tools/usbdevs2h.awk @/dev/usb/usbdevs 4084e91eaf2SWarner Losh.endif 4094e91eaf2SWarner Losh ${AWK} -f @/tools/usbdevs2h.awk @/dev/usb/usbdevs -d 4104e91eaf2SWarner Losh.endif 4114e91eaf2SWarner Losh 412a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Macpi_quirks.h) 413684c1c1dSNate LawsonCLEANFILES+= acpi_quirks.h 414684c1c1dSNate Lawson.if !exists(@) 415684c1c1dSNate Lawsonacpi_quirks.h: @ 4169f73f0e8SRuslan Ermilov.else 417684c1c1dSNate Lawsonacpi_quirks.h: @/tools/acpi_quirks2h.awk @/dev/acpica/acpi_quirks 418684c1c1dSNate Lawson.endif 419684c1c1dSNate Lawson ${AWK} -f @/tools/acpi_quirks2h.awk @/dev/acpica/acpi_quirks 420684c1c1dSNate Lawson.endif 421684c1c1dSNate Lawson 422a7d30e5fSDavid E. O'Brien.if !empty(SRCS:Massym.s) 423705d63cdSIan DowseCLEANFILES+= assym.s genassym.o 424705d63cdSIan Dowseassym.s: genassym.o 42588314df8SJohn Baldwin.if defined(KERNBUILDDIR) 42688314df8SJohn Baldwingenassym.o: opt_global.h 42788314df8SJohn Baldwin.endif 428705d63cdSIan Dowse.if !exists(@) 429705d63cdSIan Dowseassym.s: @ 430705d63cdSIan Dowse.else 431705d63cdSIan Dowseassym.s: @/kern/genassym.sh 432705d63cdSIan Dowse.endif 433705d63cdSIan Dowse sh @/kern/genassym.sh genassym.o > ${.TARGET} 4347751015fSRuslan Ermilov.if exists(@) 4357751015fSRuslan Ermilovgenassym.o: @/${MACHINE_ARCH}/${MACHINE_ARCH}/genassym.c 4367751015fSRuslan Ermilov.endif 4377751015fSRuslan Ermilovgenassym.o: @ machine ${SRCS:Mopt_*.h} 438705d63cdSIan Dowse ${CC} -c ${CFLAGS:N-fno-common} \ 439705d63cdSIan Dowse @/${MACHINE_ARCH}/${MACHINE_ARCH}/genassym.c 440705d63cdSIan Dowse.endif 441705d63cdSIan Dowse 442766f7d6eSMark Murraylint: ${SRCS} 443bbb467cdSRuslan Ermilov ${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC:M*.c} 444766f7d6eSMark Murray 44588314df8SJohn Baldwin.if defined(KERNBUILDDIR) 44688314df8SJohn Baldwin${OBJS}: opt_global.h 44788314df8SJohn Baldwin.endif 44888314df8SJohn Baldwin 44968e00b92SJordan K. Hubbard.include <bsd.dep.mk> 45047da63c3SBruce Evans 45174465532SRuslan Ermilovcleandepend: cleanilinks 45274465532SRuslan Ermilov# .depend needs include links so we remove them only together. 45374465532SRuslan Ermilovcleanilinks: 45474465532SRuslan Ermilov rm -f ${_ILINKS} 45574465532SRuslan Ermilov 456f2bffe0fSRuslan Ermilov.if !exists(${.OBJDIR}/${DEPENDFILE}) 457589d9341SBruce Evans${OBJS}: ${SRCS:M*.h} 45847da63c3SBruce Evans.endif 45947da63c3SBruce Evans 460afba897fSBruce Evans.include <bsd.obj.mk> 461ddc474a8SRuslan Ermilov.include "kern.mk" 462