aboutsummaryrefslogtreecommitdiff
path: root/Makefile.libcompat
blob: 88b1e3f0cf185a12af426ee6724e7daf27d6ece0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# $FreeBSD$

.if !targets(__<${_this:T}>__)
__<${_this:T}>__:

# Makefile for the compatibility libraries.
# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.

.include <bsd.compat.mk>

# Yes, the flags are redundant.
LIBCOMPATWMAKEENV+= \
		INSTALL="${INSTALL_CMD} -U" \
		PATH=${TMPPATH} \
		SYSROOT=${LIBCOMPATTMP} \
		LIBDIR=/usr/lib${libcompat} \
		SHLIBDIR=/usr/lib${libcompat} \
		DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
.if ${MK_META_MODE} != "no"
# Don't rebuild build-tools targets during normal build.
LIBCOMPATWMAKEENV+=	BUILD_TOOLS_META=.NOMETA
.endif
LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
		CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
		CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
		DESTDIR=${LIBCOMPATTMP} \
		-DNO_CPU_CFLAGS \
		MK_CTF=no \
		-DNO_LINT \
		MK_TESTS=no
LIBCOMPATWMAKE+=	${TIME_ENV} ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
			OBJTOP=${LIBCOMPAT_OBJTOP} \
			OBJROOT='$${OBJTOP}/' \
			MAKEOBJDIRPREFIX= \
			MK_MAN=no MK_HTML=no
LIBCOMPATIMAKE+=	${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
			${IMAKE_INSTALL} \
			-DLIBRARIES_ONLY

_LC_LIBDIRS.yes=		lib
_LC_LIBDIRS.yes+=		gnu/lib
_LC_LIBDIRS.${MK_CDDL:tl}+=	cddl/lib
_LC_LIBDIRS.${MK_CRYPT:tl}+=	secure/lib
_LC_LIBDIRS.${MK_KERBEROS:tl}+=	kerberos5/lib

_LC_INCDIRS=	\
		include \
		lib/ncurses/ncurses \
		${_LC_LIBDIRS.yes}

.if ${MK_FILE} != "no"
_libmagic=	lib/libmagic
.endif
.if ${MK_PMC} != "no"
_jevents=	lib/libpmc/pmu-events
.endif


# Shared logic
build${libcompat}: .PHONY
	@echo
	@echo "--------------------------------------------------------------"
	@echo ">>> stage 4.3: building lib${libcompat} shim libraries"
	@echo "--------------------------------------------------------------"
.if ${MK_CLEAN} == "yes"
	rm -rf ${LIBCOMPATTMP}
.else
	${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
		echo ">>> Deleting stale files in build${libcompat} tree..."; \
		cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
		    DESTDIR=${LIBCOMPATTMP} \
		    delete-old delete-old-libs >/dev/null; \
	fi
.endif	# MK_CLEAN == "yes"

	mkdir -p ${LIBCOMPATTMP}/usr/include
	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
	    -p ${LIBCOMPATTMP}/usr >/dev/null
	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
	    -p ${LIBCOMPATTMP}/usr/include >/dev/null
	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
	    -p ${LIBCOMPATTMP}/usr >/dev/null
.if ${MK_DEBUG_FILES} != "no"
	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
	    -p ${LIBCOMPATTMP}/usr/lib >/dev/null
	${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
	    -p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
.endif
	mkdir -p ${WORLDTMP}
	ln -sf ${.CURDIR}/sys ${WORLDTMP}
.for _t in ${_obj} includes
.for _dir in ${_LC_INCDIRS}
	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
	    DIRPRFX=${_dir}/ ${_t}
.endfor
.endfor
.for _dir in lib/ncurses/ncurses ${_libmagic} ${_jevents}
.for _t in ${_obj} build-tools
	${_+_}cd ${.CURDIR}/${_dir}; \
	    WORLDTMP=${WORLDTMP} \
	    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
	    ${MAKE} SSP_CFLAGS= DESTDIR= \
	    OBJTOP=${LIBCOMPAT_OBJTOP} \
	    OBJROOT='$${OBJTOP}/' \
	    MAKEOBJDIRPREFIX= \
	    DIRPRFX=${_dir}/ \
	    -DNO_LINT \
	    -DNO_CPU_CFLAGS \
	    MK_ASAN=no \
	    MK_CTF=no \
	    MK_RETPOLINE=no \
	    MK_UBSAN=no \
	    MK_WERROR=no \
	    ${_t}
.endfor
.endfor
	${_+_}cd ${.CURDIR}; \
	    ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries

distribute${libcompat} install${libcompat}: .PHONY
.for _dir in ${_LC_LIBDIRS.yes}
	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
.endfor

.endif # !targets(__<${_this:T}>__)