903e50b23c67bcebda4e788b98f2905720b935d7
[dragonfly.git] / sys / conf / kern.fwd.mk
1 # $DragonFly: src/sys/conf/kern.fwd.mk,v 1.1 2006/11/19 07:49:34 sephe Exp $
2
3 # Create forwarding headers for ${SYSDIR}/cpu/${MACHINE_ARCH}/*.h in
4 # ${_MACHINE_FWD}/include/machine and share the directory among module build
5 # directories.
6 # Define _MACHINE_FWD before inclusion of this file.
7 .if !defined(_MACHINE_FWD)
8 .error you must define _MACHINE_FWD in which to generate forwarding headers.
9 .endif
10
11 _cpu_hdrs!=     echo ${SYSDIR}/cpu/${MACHINE_ARCH}/include/*.h
12 _FWDHDRS=
13 .for _h in ${_cpu_hdrs}
14 _fwd:=  ${_MACHINE_FWD}/include/machine/${_h:T}
15 _FWDHDRS:=      ${_FWDHDRS} ${_fwd}
16 ${_fwd}: ${_h}
17 .endfor
18 ${_MACHINE_FWD} ${_MACHINE_FWD}/include/machine:
19         @mkdir -p ${.TARGET}
20
21 forwarding-headers: ${_MACHINE_FWD}/include/machine ${_FWDHDRS}
22         @touch ${_MACHINE_FWD}/.done
23
24 ${_FWDHDRS}:
25         @(echo "creating forwarding header ${.TARGET}" 1>&2; \
26         echo "/*" ; \
27         echo " * CONFIG-GENERATED FILE, DO NOT EDIT" ; \
28         echo " */" ; \
29         echo ; \
30         echo "#ifndef _MACHINE_${.TARGET:T:S/./_/g:U:R}_H_" ; \
31         echo "#define _MACHINE_${.TARGET:T:S/./_/g:U:R}_H_" ; \
32         echo "#include <cpu/${.TARGET:T}>" ; \
33         echo "#endif" ; \
34         echo) > ${.TARGET}