On Having Built Linux for a Small System


Explanation: Config/uClibc-rt/v0.9.20.mak

${EXTTEMP}/uClibc-${VERSION}/.configured:
	${MAKE} extract LIST="$(strip ${SOURCES})"
	[ ! -d ${EXTTEMP}/uClibc-rt-${VERSION} ] || rm -rf ${EXTTEMP}/uClibc-rt-${VERSION}
	( cd ${EXTTEMP}/uClibc-${VERSION} || exit 1 ;\
		[ -r Rules.mak.OLD ] || mv Rules.mak Rules.mak.OLD || exit 1 ;\
		cat Rules.mak.OLD \
			| sed	' /^CROSS/	s%=.*%= '${XTC_ROOT}'/usr/bin/'$(shell echo ${TARGET_SPEC} | sed 's/-[^-]*-/-xnc_k-/')'-% ; /(CROSS)/	s%$$(CROSS)%$$(shell if [ -n "$${CROSS}" ] ; then echo $${CROSS} ; else echo "'`echo ${HTC_GCC} | sed 's/gcc$$//'`'" ; fi)% ; /USE_CACHE/ s/#//' > Rules.mak || exit 1 ;\
		for MF in libc/sysdeps/linux/*/Makefile ; do \
			[ -r $${MF}.OLD ] || mv $${MF} $${MF}.OLD || exit 1 ;\
			cat $${MF}.OLD \
				| sed 's/-g,,/-g , ,/' \
				> $${MF} || exit 1 ;\
		done \
	) || exit 1
	touch ${EXTTEMP}/uClibc-${VERSION}/.configured

${EXTTEMP}/uClibc-rt-${VERSION}-xdc/.built: ${EXTTEMP}/uClibc-${VERSION}/.configured
	(	[ ! -d ${EXTTEMP}/uClibc-rt-${VERSION}-xdc ] || rm -rf ${EXTTEMP}/uClibc-rt-${VERSION}-xdc || exit 1 ;\
		mv ${EXTTEMP}/uClibc-${VERSION} ${EXTTEMP}/uClibc-rt-${VERSION}-xdc || exit 1 ;\
		cd ${EXTTEMP}/uClibc-rt-${VERSION}-xdc || exit 1 ;\
		cp ${XTC_ROOT}/etc/uClibc-${VERSION}-config .config || exit 1 ;\
		yes '' | ${MAKE} HOSTCC=${HTC_GCC} oldconfig \
			  || exit 1 ;\
		${MAKE} || exit 1 ;\
		${MAKE} CROSS=${XTC_ROOT}/usr/bin/${TARGET_SPEC}- \
			HOSTCC=${XTC_ROOT}/usr/bin/${TARGET_SPEC}-gcc \
			-C ldso/util ldconfig || exit 1 \
	) || exit 1

.PHONY: install-xdc
install-xdc: ${EXTTEMP}/uClibc-rt-${VERSION}-xdc/.built
	(	cd ${EXTTEMP}/uClibc-rt-${VERSION}-xdc || exit 1 ;\
		${MAKE} PREFIX=${XDC_ROOT} install_target || exit 1 ;\
		mkdir -p ${XDC_ROOT}/sbin || exit 1 ;\
		cp ldso/util/ldconfig ${XDC_ROOT}/sbin || exit 1 \
	) || exit 1