xref: /freebsd/Makefile.libcompat (revision 0a5e35a7b1811308bcb2aa2e6c7e7bd49dfc9770)
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
991d7edd5SJessica Clarke.if defined(_LIBCOMPATS)
1091d7edd5SJessica Clarke
11bbcf7eddSBrooks Davis.include <bsd.compat.mk>
1207394091SBryan Drewery
1391d7edd5SJessica Clarke.for libcompatidx _LIBCOMPAT libcompat in ${_LIBCOMPATS:range:@i@${i} ${_LIBCOMPATS:[$i]} ${libcompats:[$i]}@}
1491d7edd5SJessica Clarke
15dba75e9fSBryan Drewery# Yes, the flags are redundant.
1691d7edd5SJessica ClarkeLIB${_LIBCOMPAT}WMAKEENV+= \
177eb9f755SWarner Losh		INSTALL="${INSTALL_CMD} -U" \
18dba75e9fSBryan Drewery		PATH=${TMPPATH} \
19724123b9SBrooks Davis		SYSROOT=${WORLDTMP} \
20dba75e9fSBryan Drewery		LIBDIR=/usr/lib${libcompat} \
21dba75e9fSBryan Drewery		SHLIBDIR=/usr/lib${libcompat} \
22ac175bd3SAlex Richardson		LIBDATADIR=/usr/lib${libcompat} \
23dba75e9fSBryan Drewery		DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
24d1dd034dSBryan Drewery.if ${MK_META_MODE} != "no"
25d1dd034dSBryan Drewery# Don't rebuild build-tools targets during normal build.
2691d7edd5SJessica ClarkeLIB${_LIBCOMPAT}WMAKEENV+=	BUILD_TOOLS_META=.NOMETA
27d1dd034dSBryan Drewery.endif
28537f945fSJessica ClarkeLIB${_LIBCOMPAT}WMAKEFLAGS+= CC="${XCC} ${LIB${_LIBCOMPAT}CFLAGS:@v@${v:Q}@}" \
29537f945fSJessica Clarke		CXX="${XCXX} ${LIB${_LIBCOMPAT}CXXFLAGS:@v@${v:Q}@} ${LIB${_LIBCOMPAT}CFLAGS:@v@${v:Q}@}" \
30537f945fSJessica Clarke		CPP="${XCPP} ${LIB${_LIBCOMPAT}CFLAGS:@v@${v:Q}@}" \
31724123b9SBrooks Davis		DESTDIR=${WORLDTMP} \
32dba75e9fSBryan Drewery		-DNO_CPU_CFLAGS \
3303f6e182SWarner Losh		MK_BOOT=no \
34dba75e9fSBryan Drewery		MK_CTF=no \
3503f6e182SWarner Losh		MK_TESTS=no
3691d7edd5SJessica ClarkeLIB${_LIBCOMPAT}WMAKE+=	${TIME_ENV} ${LIB${_LIBCOMPAT}WMAKEENV} ${MAKE} \
3791d7edd5SJessica Clarke			${LIB${_LIBCOMPAT}WMAKEFLAGS} \
3891d7edd5SJessica Clarke			OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \
391031b94fSBryan Drewery			OBJROOT='$${OBJTOP}/' \
40996e4759SBryan Drewery			MAKEOBJDIRPREFIX= \
41*0a5e35a7SJessica Clarke			MK_INCLUDES=no \
42dba75e9fSBryan Drewery			MK_MAN=no MK_HTML=no
4391d7edd5SJessica ClarkeLIB${_LIBCOMPAT}IMAKE+=	${LIB${_LIBCOMPAT}WMAKE:NINSTALL=*:NDESTDIR=*} \
4452f9bacbSJohn Baldwin			${IMAKE_INSTALL} \
45429882e6SBryan Drewery			-DLIBRARIES_ONLY
46dba75e9fSBryan Drewery
4710afc5eaSJessica Clarke# Shared logic
4810afc5eaSJessica Clarkebuild${libcompat}: .PHONY
4910afc5eaSJessica Clarke	@echo
5010afc5eaSJessica Clarke	@echo "--------------------------------------------------------------"
5191d7edd5SJessica Clarke	@echo ">>> stage 4.3.${libcompatidx}: building lib${libcompat} shim libraries"
5210afc5eaSJessica Clarke	@echo "--------------------------------------------------------------"
5310afc5eaSJessica Clarke	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
5410afc5eaSJessica Clarke	    -p ${WORLDTMP}/usr >/dev/null
5510afc5eaSJessica Clarke.if ${MK_DEBUG_FILES} != "no"
5610afc5eaSJessica Clarke	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
5710afc5eaSJessica Clarke	    -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null
5810afc5eaSJessica Clarke.endif
5910afc5eaSJessica Clarke	${_+_}cd ${.CURDIR}; \
6010afc5eaSJessica Clarke	    WORLDTMP=${WORLDTMP} \
6110afc5eaSJessica Clarke	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
6210afc5eaSJessica Clarke	    ${MAKE} -f Makefile.inc1 \
6310afc5eaSJessica Clarke	    DESTDIR= \
6491d7edd5SJessica Clarke	    OBJTOP=${LIB${_LIBCOMPAT}_OBJTOP} \
6510afc5eaSJessica Clarke	    OBJROOT='$${OBJTOP}/' \
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