xref: /freebsd/share/mk/local.dirdeps.mk (revision 4436b51dff5736e74da464946049ea6899a88938)
1# $FreeBSD$
2.if !target(_DIRDEP_USE)
3# we are the 1st makefile
4
5.if !defined(MK_CLANG)
6.include "${SRCTOP}/share/mk/src.opts.mk"
7.endif
8
9# DEP_MACHINE is set before we get here, this may not be.
10DEP_RELDIR ?= ${RELDIR}
11
12.if ${.TARGETS:Uall:M*/*} && empty(DIRDEPS)
13# This little trick let's us do
14#
15# mk -f dirdeps.mk some/dir.i386,bsd
16#
17DIRDEPS := ${.TARGETS:M*/*}
18${.TARGETS:Nall}: all
19.endif
20
21# making universe is special
22.if defined(UNIVERSE_GUARD)
23# these should be done by now
24DIRDEPS_FILTER+= N*.host
25.endif
26
27# pseudo machines get no qualification
28.for m in host common
29M_dep_qual_fixes += C;($m),[^/.,]*$$;\1;
30.endfor
31
32#.info M_dep_qual_fixes=${M_dep_qual_fixes}
33# we want to supress these dependencies for host tools
34# but some libs are sadly needed.
35_need_host_libs= \
36	lib/libc++ \
37	lib/libcxxrt \
38	lib/libdwarf \
39	lib/libmd \
40
41N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToSkip}}:${M_ListToSkip}}
42DIRDEPS_FILTER.host = \
43	${N_host_libs} \
44	Ninclude* \
45	Nlib/csu* \
46	Nlib/[mn]* \
47	Ngnu/lib/csu* \
48	Ngnu/lib/lib[a-r]* \
49	Nusr.bin/xinstall* \
50
51
52DIRDEPS_FILTER+= \
53	Nbin/cat.host \
54	${DIRDEPS_FILTER.xtras:U}
55.endif
56
57# reset this each time
58DIRDEPS_FILTER.xtras=
59.if ${DEP_MACHINE:Npkgs*} != ""
60DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host
61.endif
62
63.if ${DEP_MACHINE} != "host"
64
65# this is how we can handle optional dependencies
66.if ${DEP_RELDIR} == "lib/libc"
67DIRDEPS += lib/libc_nonshared
68.if ${MK_SSP:Uno} != "no"
69DIRDEPS += gnu/lib/libssp/libssp_nonshared
70.endif
71.else
72DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared
73.endif
74
75# some optional things
76.if ${MK_CTF} == "yes" && ${DEP_RELDIR:Mcddl/usr.bin/ctf*} == ""
77DIRDEPS += \
78	cddl/usr.bin/ctfconvert.host \
79	cddl/usr.bin/ctfmerge.host
80.endif
81
82.endif
83
84.if ${MK_CLANG} == "yes" && ${DEP_RELDIR:Nlib/clang/lib*:Nlib/libc*} == ""
85DIRDEPS+= lib/clang/include
86.endif
87
88.if ${MK_STAGING} == "yes"
89# we need targets/pseudo/stage to prep the stage tree
90.if ${DEP_RELDIR} != "targets/pseudo/stage"
91DIRDEPS += targets/pseudo/stage
92.endif
93.endif
94
95DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}}
96CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH}
97CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}}
98BOOT_MACHINE_DIR:= ${BOOT_MACHINE_DIR.${DEP_MACHINE}}
99KERNEL_NAME:= ${KERNEL_NAME.${DEP_MACHINE}}
100