]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.libcompat
Merge commit 'acb089b983171667467adc66f56a723b609ed22e' into kbsd/vis
[FreeBSD/FreeBSD.git] / Makefile.libcompat
1 # $FreeBSD$
2
3 .if !targets(__<${_this:T}>__)
4 __<${_this:T}>__:
5
6 # Makefile for the compatibility libraries.
7 # - 32-bit compat libraries on some 64-bit architectures
8
9 .if defined(_LIBCOMPATS)
10
11 .include <bsd.compat.mk>
12
13 .for libcompatidx _LIBCOMPAT libcompat in ${_LIBCOMPATS:range:@i@${i} ${_LIBCOMPATS:[$i]} ${libcompats:[$i]}@}
14
15 # Yes, the flags are redundant.
16 LIB${_LIBCOMPAT}WMAKEENV+= \
17                 INSTALL="${INSTALL_CMD} -U" \
18                 PATH=${TMPPATH} \
19                 SYSROOT=${WORLDTMP} \
20                 LIBDIR=/usr/lib${libcompat} \
21                 SHLIBDIR=/usr/lib${libcompat} \
22                 LIBDATADIR=/usr/lib${libcompat} \
23                 DTRACE="${LIB${_LIBCOMPAT}DTRACE:U${DTRACE}}"
24 .if ${MK_META_MODE} != "no"
25 # Don't rebuild build-tools targets during normal build.
26 LIB${_LIBCOMPAT}WMAKEENV+=      BUILD_TOOLS_META=.NOMETA
27 .endif
28 LIB${_LIBCOMPAT}WMAKEFLAGS+= CC=${${XCC} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \
29                 CXX=${${XCXX} ${LIB${_LIBCOMPAT}CXXFLAGS} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \
30                 CPP=${${XCPP} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \
31                 DESTDIR=${WORLDTMP} \
32                 -DNO_CPU_CFLAGS \
33                 MK_BOOT=no \
34                 MK_CTF=no \
35                 MK_TESTS=no
36 LIB${_LIBCOMPAT}WMAKE+= ${TIME_ENV} ${LIB${_LIBCOMPAT}WMAKEENV} ${MAKE} \
37                         ${LIB${_LIBCOMPAT}WMAKEFLAGS} \
38                         OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \
39                         OBJROOT='$${OBJTOP}/' \
40                         UNIVERSE_TOOLCHAIN_PATH=${UNIVERSE_TOOLCHAIN_PATH} \
41                         MAKEOBJDIRPREFIX= \
42                         MK_INCLUDES=no \
43                         MK_MAN=no MK_HTML=no
44 LIB${_LIBCOMPAT}IMAKE+= ${LIB${_LIBCOMPAT}WMAKE:NINSTALL=*:NDESTDIR=*} \
45                         ${IMAKE_INSTALL} \
46                         -DLIBRARIES_ONLY
47
48 # Shared logic
49 build${libcompat}: .PHONY
50         @echo
51         @echo "--------------------------------------------------------------"
52         @echo ">>> stage 4.3.${libcompatidx}: building lib${libcompat} shim libraries"
53         @echo "--------------------------------------------------------------"
54         ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
55             -p ${WORLDTMP}/usr >/dev/null
56 .if ${MK_DEBUG_FILES} != "no"
57         ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
58             -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
59 .endif
60         ${_+_}cd ${.CURDIR}; \
61             WORLDTMP=${WORLDTMP} \
62             MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
63             ${MAKE} -f Makefile.inc1 \
64             DESTDIR= \
65             OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \
66             OBJROOT='$${OBJTOP}/' \
67             MAKEOBJDIRPREFIX= \
68             -DNO_LINT \
69             -DNO_CPU_CFLAGS \
70             MK_ASAN=no \
71             MK_CTF=no \
72             MK_RETPOLINE=no \
73             MK_SSP=no \
74             MK_UBSAN=no \
75             MK_WERROR=no \
76             _lc_build-tools
77         ${_+_}cd ${.CURDIR}; \
78             ${LIB${_LIBCOMPAT}WMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
79
80 distribute${libcompat} install${libcompat}: .PHONY
81         ${_+_}cd ${.CURDIR}; \
82             ${LIB${_LIBCOMPAT}IMAKE} -f Makefile.inc1 _lc_${.TARGET:S/${libcompat}$//}
83
84 .endfor # libcompatidx _LIBCOMPAT libcompat
85
86 .endif # defined(_LIBCOMPATS)
87
88 # These depend on MK_*, which could vary between the native and compat
89 # architectures. Thus targets using them are run within a compat sub-make
90 # rather than the native make environment.
91
92 _LC_LIBDIRS.yes=                lib
93 _LC_LIBDIRS.yes+=               gnu/lib
94 _LC_LIBDIRS.${MK_CDDL:tl}+=     cddl/lib
95 _LC_LIBDIRS.${MK_CRYPT:tl}+=    secure/lib
96 _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib
97
98 .if ${MK_FILE} != "no"
99 _libmagic=      lib/libmagic
100 .endif
101 .if ${MK_PMC} != "no"
102 _jevents=       lib/libpmc/pmu-events
103 .endif
104
105 _lc_build-tools:
106 .for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents}
107 .for _t in ${_obj} build-tools
108         ${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ ${_t}
109 .endfor
110 .endfor
111
112 _lc_distribute _lc_install:
113 .for _dir in ${_LC_LIBDIRS.yes}
114         ${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} ${.TARGET:S/^_lc_//}
115 .endfor
116
117 .endif # !targets(__<${_this:T}>__)