4949 # ###############################
5050
5151# Our input: build_*_?cc/ directories
52- BUILDS_ROOT ?= ../
52+ BUILDS_ROOT ?= ${CURDIR}/ ../installer-builds
5353BUILD_TOOLS ?= ${BUILDS_ROOT}/build_tools
5454
5555STAGING_SOF ?= staging/sof
6767
6868COMMUNITY := ${STAGING_SOF_VERSION}/community
6969INTEL_SIGNED := ${STAGING_SOF_VERSION}/intel-signed
70- ${COMMUNITY} ${INTEL_SIGNED} :
70+ ${COMMUNITY} ${INTEL_SIGNED} ${BUILDS_ROOT} :
7171 mkdir -p $@
7272
7373
@@ -85,13 +85,14 @@ rsync:
8585ifneq (${USER_DESTDIR},)
8686 # TODO: add more user space binaries: sof-ctl, probes,...
8787 # absorbe scripts/sof-target-install.sh
88- # Requires ./scripts/build-tools.sh -l ...
8988 rsync -a ${BUILD_TOOLS}/logger/sof-logger ${USER_DESTDIR}
9089endif
9190
9291clean :
9392 ${RM} -r staging/sof*
9493
94+ cleanall : clean
95+ ${RM} -r " ${BUILD_TOOLS} /" " ${BUILDS_ROOT} " /build_* _? cc/
9596
9697 # #########################################################
9798 # ## Stage sof-*.ri firmware files and symbolic links ####
@@ -124,6 +125,22 @@ ${UNSIGNED_FWS}: ${STAGING_SOF_VERSION}/sof-%.ri: \
124125 install ${INSTALL_OPTS} $< $@
125126
126127
128+ BUILD_SOF_RIS := \
129+ ${UNSIGNED_list:%=${BUILDS_ROOT}/build_%_${TOOLCHAIN}/sof.ri} \
130+ ${SIGNED_list:%=${BUILDS_ROOT}/build_%_${TOOLCHAIN}/sof.ri}
131+
132+ # The build is not deterministic; use this to reduce noise when testing
133+ # this Makefile
134+ ifneq (true,${BUILD_ONLY_ONCE})
135+ .PHONY : ${BUILD_SOF_RIS}
136+ endif
137+
138+ ${BUILD_SOF_RIS} : ${BUILDS_ROOT}/build_% _${TOOLCHAIN}/sof.ri: | ${BUILDS_ROOT}
139+ cd ${BUILDS_ROOT} && bdir=" $$ (dirname $@ )" && \
140+ if test -d $${bdir}; then cmake --build $${bdir} -- sof; else \
141+ $(CURDIR)/../scripts/xtensa-build-all.sh $*; fi
142+
143+
127144 # #######################################
128145 # ## Stage *.ldc logger dictionaries ###
129146 # #######################################
@@ -134,8 +151,8 @@ LDICTS := ${UNSIGNED_list:%=${STAGING_SOF_VERSION}/sof-%.ldc} \
134151# $(info LDICTS = ${LDICTS})
135152ldicts : ${LDICTS}
136153${LDICTS} : ${STAGING_SOF_VERSION}/sof-% .ldc: \
137- ${BUILDS_ROOT}/build_%_${TOOLCHAIN}/sof.ldc
138- install ${INSTALL_OPTS} $< $@
154+ ${BUILDS_ROOT}/build_%_${TOOLCHAIN}/sof.ri
155+ install ${INSTALL_OPTS} ${BUILDS_ROOT}/build_$*_${TOOLCHAIN}/sof.ldc $@
139156
140157
141158 # ######################################
@@ -164,8 +181,13 @@ ${SIGNED_ALIASES}: ${STAGING_SOF_VERSION}/sof-%.ri:
164181 # ## Stage sof-tplg/ topologies ###
165182 # #################################
166183
167- topologies :
168- # This requires ./scripts/build-tools.sh -T ...
184+ # The build is not deterministic; use this to reduce noise when testing
185+ # this Makefile
186+ ifneq (true,${BUILD_ONLY_ONCE})
187+ .PHONY : ${BUILD_TOOLS}
188+ endif
189+
190+ topologies : ${BUILD_TOOLS}
169191 install ${INSTALL_OPTS} -t ${STAGING_SOF_TPLG}${VERSION_SUFFIX} / \
170192 ${BUILD_TOOLS}/topology/sof-*.tplg
171193ifneq (,${VERSION_SUFFIX})
@@ -176,6 +198,15 @@ endif
176198 @tree ${TREE_OPTS} ${STAGING_SOF_TPLG}${VERSION_SUFFIX} | \
177199 head -n 10; printf '├── ...\n..\n'
178200
201+ # We should use more targets rather than set -e and a multi-lines script
202+ # but that would be verbose.
203+ ${BUILD_TOOLS} :
204+ set -e; if test -d ${BUILD_TOOLS} ; then \
205+ for i in topologies sof-logger; do \
206+ cmake --build ${BUILD_TOOLS} -- $$i; done; else \
207+ BUILD_TOOLS_DIR =${BUILD_TOOLS} ../scripts/build-tools.sh -T -l ; \
208+ fi
209+
179210
180211 # ###################
181212 # ## Self-Testing ###
0 commit comments