Merge branch 'vendor/BINUTILS221'
[dragonfly.git] / sys / conf / kern.fwd.mk
1 # $DragonFly: src/sys/conf/kern.fwd.mk,v 1.7 2007/01/10 16:41:37 corecode 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 # _FWDHDRS fills in missing <machine/BLAH.h> headers from <cpu/BLAH.h>,
12 # allowing us to omit forwarding-only header files in each platform
13 # architecture's machine/ directory.
14 #
15 _cpu_hdrs!=     echo ${SYSDIR}/cpu/${MACHINE_ARCH}/include/*.h
16 _FWDHDRS=
17 .for _h in ${_cpu_hdrs}
18 _fwd:=  ${_MACHINE_FWD}/include/machine/${_h:T}
19 _FWDHDRS:=      ${_FWDHDRS} ${_fwd}
20 ${_fwd}: ${_h}
21 .endfor
22
23 # _LHDRS mimics _LHDRS from /usr/src/include/Makefile, directly linking
24 # sys/BLAH.h as <BLAH.h> for certain header files.  These are used to
25 # mimic a standard user include topology.  Only the virtual kernel
26 # build uses these.  e.g. in order for #include <fcntl.h> to work.
27 #
28 _lhdrs= aio.h errno.h fcntl.h linker_set.h poll.h syslog.h \
29         termios.h ucontext.h
30 _LHDRS=
31 .for _h in ${_lhdrs}
32 _fwd:=  ${_MACHINE_FWD}/include/${_h}
33 _LHDRS:=        ${_LHDRS} ${_fwd}
34 ${_fwd}: ${SYSDIR}/sys/${_h}
35 .endfor
36
37 .ORDER: ${_MACHINE_FWD}/include/machine ${_FWDHDRS} ${_LHDRS}
38
39 ${_MACHINE_FWD} ${_MACHINE_FWD}/include/machine:
40         @mkdir -p ${.TARGET}
41
42 FORWARD_HEADERS_COOKIE= ${_MACHINE_FWD}/.done
43 ${FORWARD_HEADERS_COOKIE}: ${_MACHINE_FWD}/include/machine ${_FWDHDRS} ${_LHDRS}
44         @touch ${.TARGET}
45
46 ${_FWDHDRS}:
47         @(echo "creating machine/ forwarding header ${.TARGET}" 1>&2; \
48         echo "/*" ; \
49         echo " * CONFIG-GENERATED FILE, DO NOT EDIT" ; \
50         echo " */" ; \
51         echo ; \
52         echo "#ifndef _MACHINE_${.TARGET:T:S/./_/g:U}_" ; \
53         echo "#define _MACHINE_${.TARGET:T:S/./_/g:U}_" ; \
54         echo "#include <cpu/${.TARGET:T}>" ; \
55         echo "#endif" ; \
56         echo) > ${.TARGET}
57
58 ${_LHDRS}:
59         @(echo "creating sys/ forwarding header ${.TARGET}" 1>&2; \
60         echo "/*" ; \
61         echo " * CONFIG-GENERATED FILE, DO NOT EDIT" ; \
62         echo " */" ; \
63         echo ; \
64         echo "#ifndef _${.TARGET:T:S/./_/g:U}_" ; \
65         echo "#define _${.TARGET:T:S/./_/g:U}_" ; \
66         echo "#include <sys/${.TARGET:T}>" ; \
67         echo "#endif" ; \
68         echo) > ${.TARGET}
69