xref: /freebsd/Makefile.libcompat (revision 2bfd8b5b9419b0ceb3dd0295fdf413d32969e5b2)
1# $FreeBSD$
2
3.if !targets(__<${_this:T}>__)
4__<${_this:T}>__:
5
6# Makefile for the compatibility libraries.
7# - 32-bit compat libraries on PowerPC, and AMD64.
8
9.include <bsd.compat.mk>
10
11# Yes, the flags are redundant.
12LIBCOMPATWMAKEENV+= \
13		INSTALL="${INSTALL_CMD} -U" \
14		PATH=${TMPPATH} \
15		SYSROOT=${WORLDTMP} \
16		LIBDIR=/usr/lib${libcompat} \
17		SHLIBDIR=/usr/lib${libcompat} \
18		DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
19.if ${MK_META_MODE} != "no"
20# Don't rebuild build-tools targets during normal build.
21LIBCOMPATWMAKEENV+=	BUILD_TOOLS_META=.NOMETA
22.endif
23LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
24		CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
25		CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
26		DESTDIR=${WORLDTMP} \
27		-DNO_CPU_CFLAGS \
28		MK_BOOT=no \
29		MK_CTF=no \
30		MK_TESTS=no
31LIBCOMPATWMAKE+=	${TIME_ENV} ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
32			OBJTOP=${LIBCOMPAT_OBJTOP} \
33			OBJROOT='$${OBJTOP}/' \
34			MAKEOBJDIRPREFIX= \
35			MK_MAN=no MK_HTML=no
36LIBCOMPATIMAKE+=	${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
37			${IMAKE_INSTALL} \
38			-DLIBRARIES_ONLY
39
40_LC_LIBDIRS.yes=		lib
41_LC_LIBDIRS.yes+=		gnu/lib
42_LC_LIBDIRS.${MK_CDDL:tl}+=	cddl/lib
43_LC_LIBDIRS.${MK_CRYPT:tl}+=	secure/lib
44_LC_LIBDIRS.${MK_KERBEROS:tl}+=	kerberos5/lib
45
46_LC_INCDIRS=	\
47		include \
48		lib/ncurses/tinfo \
49		${_LC_LIBDIRS.yes}
50
51.if ${MK_FILE} != "no"
52_libmagic=	lib/libmagic
53.endif
54.if ${MK_PMC} != "no"
55_jevents=	lib/libpmc/pmu-events
56.endif
57
58
59# Shared logic
60build${libcompat}: .PHONY
61	@echo
62	@echo "--------------------------------------------------------------"
63	@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
64	@echo "--------------------------------------------------------------"
65	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
66	    -p ${WORLDTMP}/usr >/dev/null
67.if ${MK_DEBUG_FILES} != "no"
68	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
69	    -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
70.endif
71.for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents}
72.for _t in ${_obj} build-tools
73	${_+_}cd ${.CURDIR}/${_dir}; \
74	    WORLDTMP=${WORLDTMP} \
75	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
76	    ${MAKE} DESTDIR= \
77	    OBJTOP=${LIBCOMPAT_OBJTOP} \
78	    OBJROOT='$${OBJTOP}/' \
79	    MAKEOBJDIRPREFIX= \
80	    DIRPRFX=${_dir}/ \
81	    -DNO_LINT \
82	    -DNO_CPU_CFLAGS \
83	    MK_ASAN=no \
84	    MK_CTF=no \
85	    MK_RETPOLINE=no \
86	    MK_SSP=no \
87	    MK_UBSAN=no \
88	    MK_WERROR=no \
89	    ${_t}
90.endfor
91.endfor
92	${_+_}cd ${.CURDIR}; \
93	    ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
94
95distribute${libcompat} install${libcompat}: .PHONY
96.for _dir in ${_LC_LIBDIRS.yes}
97	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
98.endfor
99
100.endif # !targets(__<${_this:T}>__)
101