xref: /freebsd/Makefile.libcompat (revision 7eb9f7558cfc528dd67db3bc8f82314870615903)
1dba75e9fSBryan Drewery# $FreeBSD$
2dba75e9fSBryan Drewery
3dba75e9fSBryan Drewery.if !targets(__<${_this:T}>__)
4dba75e9fSBryan Drewery__<${_this:T}>__:
5dba75e9fSBryan Drewery
6dba75e9fSBryan Drewery# Makefile for the compatibility libraries.
769b4d461SJohn Baldwin# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
8dba75e9fSBryan Drewery
9bbcf7eddSBrooks Davis.include <bsd.compat.mk>
1007394091SBryan Drewery
11dba75e9fSBryan Drewery# Yes, the flags are redundant.
12dfa09989SBryan DreweryLIBCOMPATWMAKEENV+= \
13*7eb9f755SWarner Losh		INSTALL="${INSTALL_CMD} -U" \
14dba75e9fSBryan Drewery		PATH=${TMPPATH} \
1535fb812aSBryan Drewery		SYSROOT=${LIBCOMPATTMP} \
16dba75e9fSBryan Drewery		LIBDIR=/usr/lib${libcompat} \
17dba75e9fSBryan Drewery		SHLIBDIR=/usr/lib${libcompat} \
18dba75e9fSBryan Drewery		DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
19d1dd034dSBryan Drewery.if ${MK_META_MODE} != "no"
20d1dd034dSBryan Drewery# Don't rebuild build-tools targets during normal build.
21dbbb03c2SBryan DreweryLIBCOMPATWMAKEENV+=	BUILD_TOOLS_META=.NOMETA
22d1dd034dSBryan Drewery.endif
23f661dbeeSBryan DreweryLIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
2476c5029cSBryan Drewery		CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
25f661dbeeSBryan Drewery		CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
26dba75e9fSBryan Drewery		DESTDIR=${LIBCOMPATTMP} \
27dba75e9fSBryan Drewery		-DNO_CPU_CFLAGS \
28dba75e9fSBryan Drewery		MK_CTF=no \
29dba75e9fSBryan Drewery		-DNO_LINT \
30dba75e9fSBryan Drewery		MK_TESTS=no
31dba75e9fSBryan DreweryLIBCOMPATWMAKE+=	${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
321031b94fSBryan Drewery			OBJTOP=${LIBCOMPAT_OBJTOP} \
331031b94fSBryan Drewery			OBJROOT='$${OBJTOP}/' \
34996e4759SBryan Drewery			MAKEOBJDIRPREFIX= \
35dba75e9fSBryan Drewery			MK_MAN=no MK_HTML=no
3691da7698SBryan DreweryLIBCOMPATIMAKE+=	${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
3752f9bacbSJohn Baldwin			${IMAKE_INSTALL} \
38429882e6SBryan Drewery			-DLIBRARIES_ONLY
39dba75e9fSBryan Drewery
40ad91146cSEd Maste_LC_LIBDIRS.yes=		lib
410d849865SEd Maste_LC_LIBDIRS.yes+=		gnu/lib
42048ce093SBryan Drewery_LC_LIBDIRS.${MK_CDDL:tl}+=	cddl/lib
43048ce093SBryan Drewery_LC_LIBDIRS.${MK_CRYPT:tl}+=	secure/lib
44048ce093SBryan Drewery_LC_LIBDIRS.${MK_KERBEROS:tl}+=	kerberos5/lib
45dba75e9fSBryan Drewery
461b337a34SBryan Drewery_LC_INCDIRS=	\
471b337a34SBryan Drewery		include \
481b337a34SBryan Drewery		lib/ncurses/ncursesw \
491b337a34SBryan Drewery		${_LC_LIBDIRS.yes}
501b337a34SBryan Drewery
51127b666cSBryan Drewery.if ${MK_FILE} != "no"
52127b666cSBryan Drewery_libmagic=	lib/libmagic
53127b666cSBryan Drewery.endif
546f1f2b19SBryan Drewery.if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64"
556f1f2b19SBryan Drewery_jevents=	lib/libpmc/pmu-events
566f1f2b19SBryan Drewery.endif
576f1f2b19SBryan Drewery
586f1f2b19SBryan Drewery
59dba75e9fSBryan Drewery# Shared logic
60dba75e9fSBryan Drewerybuild${libcompat}: .PHONY
61dba75e9fSBryan Drewery	@echo
62dba75e9fSBryan Drewery	@echo "--------------------------------------------------------------"
635dab1313SBrooks Davis	@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
64dba75e9fSBryan Drewery	@echo "--------------------------------------------------------------"
6575766799SEd Maste.if ${MK_CLEAN} == "yes"
6667d2f51aSBryan Drewery	rm -rf ${LIBCOMPATTMP}
6767d2f51aSBryan Drewery.else
686e6be2bbSBryan Drewery	${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
696e6be2bbSBryan Drewery		echo ">>> Deleting stale files in build${libcompat} tree..."; \
706e6be2bbSBryan Drewery		cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
7167d2f51aSBryan Drewery		    DESTDIR=${LIBCOMPATTMP} \
726e6be2bbSBryan Drewery		    delete-old delete-old-libs >/dev/null; \
736e6be2bbSBryan Drewery	fi
7475766799SEd Maste.endif	# MK_CLEAN == "yes"
7567d2f51aSBryan Drewery
76dba75e9fSBryan Drewery	mkdir -p ${LIBCOMPATTMP}/usr/include
7755a5b46aSAlex Richardson	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
78dba75e9fSBryan Drewery	    -p ${LIBCOMPATTMP}/usr >/dev/null
7955a5b46aSAlex Richardson	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
80dba75e9fSBryan Drewery	    -p ${LIBCOMPATTMP}/usr/include >/dev/null
8155a5b46aSAlex Richardson	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
82dba75e9fSBryan Drewery	    -p ${LIBCOMPATTMP}/usr >/dev/null
83dba75e9fSBryan Drewery.if ${MK_DEBUG_FILES} != "no"
8455a5b46aSAlex Richardson	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
85dba75e9fSBryan Drewery	    -p ${LIBCOMPATTMP}/usr/lib >/dev/null
8655a5b46aSAlex Richardson	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
87dba75e9fSBryan Drewery	    -p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
88dba75e9fSBryan Drewery.endif
89dba75e9fSBryan Drewery	mkdir -p ${WORLDTMP}
90dba75e9fSBryan Drewery	ln -sf ${.CURDIR}/sys ${WORLDTMP}
916d75a7a8SBryan Drewery.for _t in ${_obj} includes
921b337a34SBryan Drewery.for _dir in ${_LC_INCDIRS}
93ce6c8db5SBryan Drewery	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
94ce6c8db5SBryan Drewery	    DIRPRFX=${_dir}/ ${_t}
95dba75e9fSBryan Drewery.endfor
96dba75e9fSBryan Drewery.endfor
97127b666cSBryan Drewery.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents}
98c4273800SBryan Drewery.for _t in ${_obj} build-tools
99dba75e9fSBryan Drewery	${_+_}cd ${.CURDIR}/${_dir}; \
100dba75e9fSBryan Drewery	    WORLDTMP=${WORLDTMP} \
101dba75e9fSBryan Drewery	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
1021031b94fSBryan Drewery	    ${MAKE} SSP_CFLAGS= DESTDIR= \
1034dc89c4dSBryan Drewery	    OBJTOP=${LIBCOMPAT_OBJTOP} \
1044dc89c4dSBryan Drewery	    OBJROOT='$${OBJTOP}/' \
105996e4759SBryan Drewery	    MAKEOBJDIRPREFIX= \
10601b7ad04SEd Maste	    DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \
10701b7ad04SEd Maste	    MK_CTF=no MK_RETPOLINE=no MK_WARNS=no \
108c4273800SBryan Drewery	    ${_t}
109c4273800SBryan Drewery.endfor
110dba75e9fSBryan Drewery.endfor
111dba75e9fSBryan Drewery	${_+_}cd ${.CURDIR}; \
112dba75e9fSBryan Drewery	    ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
113dba75e9fSBryan Drewery
114dba75e9fSBryan Drewerydistribute${libcompat} install${libcompat}: .PHONY
115dba75e9fSBryan Drewery.for _dir in ${_LC_LIBDIRS.yes}
116dba75e9fSBryan Drewery	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
117dba75e9fSBryan Drewery.endfor
118dba75e9fSBryan Drewery
119a4330302SBrooks Davis.endif # !targets(__<${_this:T}>__)
120