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