xref: /freebsd/Makefile.libcompat (revision 10afc5eada472f7903238c7021a00f722f49a789)
1dba75e9fSBryan Drewery# $FreeBSD$
2dba75e9fSBryan Drewery
3dba75e9fSBryan Drewery.if !targets(__<${_this:T}>__)
4dba75e9fSBryan Drewery__<${_this:T}>__:
5dba75e9fSBryan Drewery
6dba75e9fSBryan Drewery# Makefile for the compatibility libraries.
7aada8c47SWarner Losh# - 32-bit compat libraries on PowerPC, and AMD64.
8dba75e9fSBryan Drewery
9bbcf7eddSBrooks Davis.include <bsd.compat.mk>
1007394091SBryan Drewery
11dba75e9fSBryan Drewery# Yes, the flags are redundant.
12dfa09989SBryan DreweryLIBCOMPATWMAKEENV+= \
137eb9f755SWarner Losh		INSTALL="${INSTALL_CMD} -U" \
14dba75e9fSBryan Drewery		PATH=${TMPPATH} \
15724123b9SBrooks Davis		SYSROOT=${WORLDTMP} \
16dba75e9fSBryan Drewery		LIBDIR=/usr/lib${libcompat} \
17dba75e9fSBryan Drewery		SHLIBDIR=/usr/lib${libcompat} \
18ac175bd3SAlex Richardson		LIBDATADIR=/usr/lib${libcompat} \
19dba75e9fSBryan Drewery		DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
20d1dd034dSBryan Drewery.if ${MK_META_MODE} != "no"
21d1dd034dSBryan Drewery# Don't rebuild build-tools targets during normal build.
22dbbb03c2SBryan DreweryLIBCOMPATWMAKEENV+=	BUILD_TOOLS_META=.NOMETA
23d1dd034dSBryan Drewery.endif
24f661dbeeSBryan DreweryLIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
2576c5029cSBryan Drewery		CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
26f661dbeeSBryan Drewery		CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
27724123b9SBrooks Davis		DESTDIR=${WORLDTMP} \
28dba75e9fSBryan Drewery		-DNO_CPU_CFLAGS \
2903f6e182SWarner Losh		MK_BOOT=no \
30dba75e9fSBryan Drewery		MK_CTF=no \
3103f6e182SWarner Losh		MK_TESTS=no
3299feb137SWolfram SchneiderLIBCOMPATWMAKE+=	${TIME_ENV} ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
331031b94fSBryan Drewery			OBJTOP=${LIBCOMPAT_OBJTOP} \
341031b94fSBryan Drewery			OBJROOT='$${OBJTOP}/' \
35996e4759SBryan Drewery			MAKEOBJDIRPREFIX= \
36dba75e9fSBryan Drewery			MK_MAN=no MK_HTML=no
3791da7698SBryan DreweryLIBCOMPATIMAKE+=	${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
3852f9bacbSJohn Baldwin			${IMAKE_INSTALL} \
39227f47ceSEd Maste			MK_INCLUDES=no \
40429882e6SBryan Drewery			-DLIBRARIES_ONLY
41dba75e9fSBryan Drewery
42*10afc5eaSJessica Clarke# Shared logic
43*10afc5eaSJessica Clarkebuild${libcompat}: .PHONY
44*10afc5eaSJessica Clarke	@echo
45*10afc5eaSJessica Clarke	@echo "--------------------------------------------------------------"
46*10afc5eaSJessica Clarke	@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
47*10afc5eaSJessica Clarke	@echo "--------------------------------------------------------------"
48*10afc5eaSJessica Clarke	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
49*10afc5eaSJessica Clarke	    -p ${WORLDTMP}/usr >/dev/null
50*10afc5eaSJessica Clarke.if ${MK_DEBUG_FILES} != "no"
51*10afc5eaSJessica Clarke	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
52*10afc5eaSJessica Clarke	    -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
53*10afc5eaSJessica Clarke.endif
54*10afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
55*10afc5eaSJessica Clarke	    WORLDTMP=${WORLDTMP} \
56*10afc5eaSJessica Clarke	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
57*10afc5eaSJessica Clarke	    ${MAKE} -f Makefile.inc1 \
58*10afc5eaSJessica Clarke	    DESTDIR= \
59*10afc5eaSJessica Clarke	    OBJTOP=${LIBCOMPAT_OBJTOP} \
60*10afc5eaSJessica Clarke	    OBJROOT='$${OBJTOP}/' \
61*10afc5eaSJessica Clarke	    MAKEOBJDIRPREFIX= \
62*10afc5eaSJessica Clarke	    -DNO_LINT \
63*10afc5eaSJessica Clarke	    -DNO_CPU_CFLAGS \
64*10afc5eaSJessica Clarke	    MK_ASAN=no \
65*10afc5eaSJessica Clarke	    MK_CTF=no \
66*10afc5eaSJessica Clarke	    MK_RETPOLINE=no \
67*10afc5eaSJessica Clarke	    MK_SSP=no \
68*10afc5eaSJessica Clarke	    MK_UBSAN=no \
69*10afc5eaSJessica Clarke	    MK_WERROR=no \
70*10afc5eaSJessica Clarke	    _lc_build-tools
71*10afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
72*10afc5eaSJessica Clarke	    ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
73*10afc5eaSJessica Clarke
74*10afc5eaSJessica Clarkedistribute${libcompat} install${libcompat}: .PHONY
75*10afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
76*10afc5eaSJessica Clarke	    ${LIBCOMPATIMAKE} -f Makefile.inc1 _lc_${.TARGET:S/${libcompat}$//}
77*10afc5eaSJessica Clarke
78*10afc5eaSJessica Clarke# These depend on MK_*, which could vary between the native and compat
79*10afc5eaSJessica Clarke# architectures. Thus targets using them are run within a compat sub-make
80*10afc5eaSJessica Clarke# rather than the native make environment.
81*10afc5eaSJessica Clarke
82ad91146cSEd Maste_LC_LIBDIRS.yes=		lib
830d849865SEd Maste_LC_LIBDIRS.yes+=		gnu/lib
84048ce093SBryan Drewery_LC_LIBDIRS.${MK_CDDL:tl}+=	cddl/lib
85048ce093SBryan Drewery_LC_LIBDIRS.${MK_CRYPT:tl}+=	secure/lib
86048ce093SBryan Drewery_LC_LIBDIRS.${MK_KERBEROS:tl}+=	kerberos5/lib
87dba75e9fSBryan Drewery
88127b666cSBryan Drewery.if ${MK_FILE} != "no"
89127b666cSBryan Drewery_libmagic=	lib/libmagic
90127b666cSBryan Drewery.endif
91689c7e79SMitchell Horne.if ${MK_PMC} != "no"
926f1f2b19SBryan Drewery_jevents=	lib/libpmc/pmu-events
936f1f2b19SBryan Drewery.endif
946f1f2b19SBryan Drewery
95*10afc5eaSJessica Clarke_lc_build-tools:
96cc46927fSBaptiste Daroussin.for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents}
97c4273800SBryan Drewery.for _t in ${_obj} build-tools
98*10afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ ${_t}
99c4273800SBryan Drewery.endfor
100dba75e9fSBryan Drewery.endfor
101dba75e9fSBryan Drewery
102*10afc5eaSJessica Clarke_lc_distribute _lc_install:
103dba75e9fSBryan Drewery.for _dir in ${_LC_LIBDIRS.yes}
104*10afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} ${.TARGET:S/^_lc_//}
105dba75e9fSBryan Drewery.endfor
106dba75e9fSBryan Drewery
107a4330302SBrooks Davis.endif # !targets(__<${_this:T}>__)
108