xref: /freebsd/Makefile.libcompat (revision 5abaf0866445a61c11665fffc148ecd13a7bb9ac)
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_LC_INCDIRS=	\
49		include \
50		lib/ncurses/tinfo \
51		${_LC_LIBDIRS.yes}
52
53.if ${MK_FILE} != "no"
54_libmagic=	lib/libmagic
55.endif
56.if ${MK_PMC} != "no"
57_jevents=	lib/libpmc/pmu-events
58.endif
59
60
61# Shared logic
62build${libcompat}: .PHONY
63	@echo
64	@echo "--------------------------------------------------------------"
65	@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
66	@echo "--------------------------------------------------------------"
67	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
68	    -p ${WORLDTMP}/usr >/dev/null
69.if ${MK_DEBUG_FILES} != "no"
70	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
71	    -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
72.endif
73.for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents}
74.for _t in ${_obj} build-tools
75	${_+_}cd ${.CURDIR}/${_dir}; \
76	    WORLDTMP=${WORLDTMP} \
77	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
78	    ${MAKE} DESTDIR= \
79	    OBJTOP=${LIBCOMPAT_OBJTOP} \
80	    OBJROOT='$${OBJTOP}/' \
81	    MAKEOBJDIRPREFIX= \
82	    DIRPRFX=${_dir}/ \
83	    -DNO_LINT \
84	    -DNO_CPU_CFLAGS \
85	    MK_ASAN=no \
86	    MK_CTF=no \
87	    MK_RETPOLINE=no \
88	    MK_SSP=no \
89	    MK_UBSAN=no \
90	    MK_WERROR=no \
91	    ${_t}
92.endfor
93.endfor
94	${_+_}cd ${.CURDIR}; \
95	    ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
96
97distribute${libcompat} install${libcompat}: .PHONY
98.for _dir in ${_LC_LIBDIRS.yes}
99	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
100.endfor
101
102.endif # !targets(__<${_this:T}>__)
103