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