xref: /freebsd/Makefile.libcompat (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1dba75e9fSBryan Drewery.if !targets(__<${_this:T}>__)
2dba75e9fSBryan Drewery__<${_this:T}>__:
3dba75e9fSBryan Drewery
4dba75e9fSBryan Drewery# Makefile for the compatibility libraries.
5a1b67573SMike Karels# - 32-bit compat libraries on some 64-bit architectures
6dba75e9fSBryan Drewery
791d7edd5SJessica Clarke.if defined(_LIBCOMPATS)
891d7edd5SJessica Clarke
9bbcf7eddSBrooks Davis.include <bsd.compat.mk>
1007394091SBryan Drewery
1191d7edd5SJessica Clarke.for libcompatidx _LIBCOMPAT libcompat in ${_LIBCOMPATS:range:@i@${i} ${_LIBCOMPATS:[$i]} ${libcompats:[$i]}@}
1291d7edd5SJessica Clarke
13dba75e9fSBryan Drewery# Yes, the flags are redundant.
1491d7edd5SJessica ClarkeLIB${_LIBCOMPAT}WMAKEENV+= \
157eb9f755SWarner Losh		INSTALL="${INSTALL_CMD} -U" \
16dba75e9fSBryan Drewery		PATH=${TMPPATH} \
17724123b9SBrooks Davis		SYSROOT=${WORLDTMP} \
18dba75e9fSBryan Drewery		LIBDIR=/usr/lib${libcompat} \
19dba75e9fSBryan Drewery		SHLIBDIR=/usr/lib${libcompat} \
20ac175bd3SAlex Richardson		LIBDATADIR=/usr/lib${libcompat} \
218aaa1230SJessica Clarke		DTRACE="${LIB${_LIBCOMPAT}DTRACE:U${DTRACE}}"
22d1dd034dSBryan Drewery.if ${MK_META_MODE} != "no"
23d1dd034dSBryan Drewery# Don't rebuild build-tools targets during normal build.
2491d7edd5SJessica ClarkeLIB${_LIBCOMPAT}WMAKEENV+=	BUILD_TOOLS_META=.NOMETA
25d1dd034dSBryan Drewery.endif
265d4f8df4SJessica ClarkeLIB${_LIBCOMPAT}WMAKEFLAGS+= CC=${${XCC} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \
275d4f8df4SJessica Clarke		CXX=${${XCXX} ${LIB${_LIBCOMPAT}CXXFLAGS} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \
285d4f8df4SJessica Clarke		CPP=${${XCPP} ${LIB${_LIBCOMPAT}CFLAGS}:L:Q} \
29724123b9SBrooks Davis		DESTDIR=${WORLDTMP} \
30dba75e9fSBryan Drewery		-DNO_CPU_CFLAGS \
3103f6e182SWarner Losh		MK_BOOT=no \
32dba75e9fSBryan Drewery		MK_CTF=no \
3303f6e182SWarner Losh		MK_TESTS=no
3491d7edd5SJessica ClarkeLIB${_LIBCOMPAT}WMAKE+=	${TIME_ENV} ${LIB${_LIBCOMPAT}WMAKEENV} ${MAKE} \
3591d7edd5SJessica Clarke			${LIB${_LIBCOMPAT}WMAKEFLAGS} \
3691d7edd5SJessica Clarke			OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \
371031b94fSBryan Drewery			OBJROOT='$${OBJTOP}/' \
381c024976SJohn Baldwin			UNIVERSE_TOOLCHAIN_PATH=${UNIVERSE_TOOLCHAIN_PATH} \
39996e4759SBryan Drewery			MAKEOBJDIRPREFIX= \
400a5e35a7SJessica Clarke			MK_INCLUDES=no \
41dba75e9fSBryan Drewery			MK_MAN=no MK_HTML=no
4291d7edd5SJessica ClarkeLIB${_LIBCOMPAT}IMAKE+=	${LIB${_LIBCOMPAT}WMAKE:NINSTALL=*:NDESTDIR=*} \
4352f9bacbSJohn Baldwin			${IMAKE_INSTALL} \
44429882e6SBryan Drewery			-DLIBRARIES_ONLY
45dba75e9fSBryan Drewery
4610afc5eaSJessica Clarke# Shared logic
4710afc5eaSJessica Clarkebuild${libcompat}: .PHONY
4810afc5eaSJessica Clarke	@echo
4910afc5eaSJessica Clarke	@echo "--------------------------------------------------------------"
5091d7edd5SJessica Clarke	@echo ">>> stage 4.3.${libcompatidx}: building lib${libcompat} shim libraries"
5110afc5eaSJessica Clarke	@echo "--------------------------------------------------------------"
5210afc5eaSJessica Clarke	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
5310afc5eaSJessica Clarke	    -p ${WORLDTMP}/usr >/dev/null
5410afc5eaSJessica Clarke.if ${MK_DEBUG_FILES} != "no"
5510afc5eaSJessica Clarke	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
5610afc5eaSJessica Clarke	    -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
5710afc5eaSJessica Clarke.endif
5810afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
5910afc5eaSJessica Clarke	    WORLDTMP=${WORLDTMP} \
6010afc5eaSJessica Clarke	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
6110afc5eaSJessica Clarke	    ${MAKE} -f Makefile.inc1 \
6210afc5eaSJessica Clarke	    DESTDIR= \
6391d7edd5SJessica Clarke	    OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \
6410afc5eaSJessica Clarke	    OBJROOT='$${OBJTOP}/' \
65*834f73d2SJohn Baldwin	    UNIVERSE_TOOLCHAIN_PATH=${UNIVERSE_TOOLCHAIN_PATH} \
6610afc5eaSJessica Clarke	    MAKEOBJDIRPREFIX= \
6710afc5eaSJessica Clarke	    -DNO_LINT \
6810afc5eaSJessica Clarke	    -DNO_CPU_CFLAGS \
6910afc5eaSJessica Clarke	    MK_ASAN=no \
7010afc5eaSJessica Clarke	    MK_CTF=no \
7110afc5eaSJessica Clarke	    MK_RETPOLINE=no \
7210afc5eaSJessica Clarke	    MK_SSP=no \
7310afc5eaSJessica Clarke	    MK_UBSAN=no \
7410afc5eaSJessica Clarke	    MK_WERROR=no \
7510afc5eaSJessica Clarke	    _lc_build-tools
7610afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
7791d7edd5SJessica Clarke	    ${LIB${_LIBCOMPAT}WMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
7810afc5eaSJessica Clarke
7910afc5eaSJessica Clarkedistribute${libcompat} install${libcompat}: .PHONY
8010afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
8191d7edd5SJessica Clarke	    ${LIB${_LIBCOMPAT}IMAKE} -f Makefile.inc1 _lc_${.TARGET:S/${libcompat}$//}
8291d7edd5SJessica Clarke
8391d7edd5SJessica Clarke.endfor # libcompatidx _LIBCOMPAT libcompat
8491d7edd5SJessica Clarke
8591d7edd5SJessica Clarke.endif # defined(_LIBCOMPATS)
8610afc5eaSJessica Clarke
8710afc5eaSJessica Clarke# These depend on MK_*, which could vary between the native and compat
8810afc5eaSJessica Clarke# architectures. Thus targets using them are run within a compat sub-make
8910afc5eaSJessica Clarke# rather than the native make environment.
9010afc5eaSJessica Clarke
91ad91146cSEd Maste_LC_LIBDIRS.yes=		lib
920d849865SEd Maste_LC_LIBDIRS.yes+=		gnu/lib
93048ce093SBryan Drewery_LC_LIBDIRS.${MK_CDDL:tl}+=	cddl/lib
94048ce093SBryan Drewery_LC_LIBDIRS.${MK_CRYPT:tl}+=	secure/lib
95048ce093SBryan Drewery_LC_LIBDIRS.${MK_KERBEROS:tl}+=	kerberos5/lib
96dba75e9fSBryan Drewery
97127b666cSBryan Drewery.if ${MK_FILE} != "no"
98127b666cSBryan Drewery_libmagic=	lib/libmagic
99127b666cSBryan Drewery.endif
100689c7e79SMitchell Horne.if ${MK_PMC} != "no"
1016f1f2b19SBryan Drewery_jevents=	lib/libpmc/pmu-events
1026f1f2b19SBryan Drewery.endif
1036f1f2b19SBryan Drewery
10410afc5eaSJessica Clarke_lc_build-tools:
105cc46927fSBaptiste Daroussin.for _dir in lib/ncurses/tinfo ${_libmagic} ${_jevents}
106c4273800SBryan Drewery.for _t in ${_obj} build-tools
10710afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ ${_t}
108c4273800SBryan Drewery.endfor
109dba75e9fSBryan Drewery.endfor
110dba75e9fSBryan Drewery
11110afc5eaSJessica Clarke_lc_distribute _lc_install:
112dba75e9fSBryan Drewery.for _dir in ${_LC_LIBDIRS.yes}
11310afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}/${_dir}; ${MAKE} ${.TARGET:S/^_lc_//}
114dba75e9fSBryan Drewery.endfor
115dba75e9fSBryan Drewery
116a4330302SBrooks Davis.endif # !targets(__<${_this:T}>__)
117