@@ -37,6 +37,9 @@ clean_up() {
3737 mkdir -p " $build_dir "
3838}
3939
40+ # Ensure the target lib directory exists
41+ mkdir -p " ${INSTALL_PATH} /lib"
42+
4043# Parallel ppl-compile over all *.pl files in ../src
4144# Args: chip [extra ppl-compile flags...]
4245ppl_compile_all () {
@@ -76,17 +79,13 @@ file_changed=false
7679# headers, the CMake build description, and the build script itself.
7780mapfile -t md5_list < <( generate_md5_list \
7881 src src_dyn include CMakeLists.txt Dynkernel.cmake)
79- # RELEASE vs DEBUG produces different artifacts, so treat the build mode as
80- # an input by embedding it as a sentinel line in the md5 list.
81- md5_list=(" __BUILD_MODE__ $BUILD_MODE " " ${md5_list[@]} " )
8282if [ ! -f " $MD5FILE " ] || has_md5_changes " $MD5FILE " " ${md5_list[@]} " ; then
8383 file_changed=true
8484fi
8585# get latest nntoolchain version
8686lib_changed=false
8787NNTC_LIB_PATH=${PROJECT_ROOT} /third_party/nntoolchain/lib
8888PPL_VER_PATH=${PROJECT_ROOT} /third_party/ppl/version
89- VER_FILE=${PROJECT_ROOT} /third_party/nntoolchain/ppl/version
9089LIBS=(" libcmodel_bm1684x.a" " libbm1684x_kernel_module.a"
9190 " libcmodel_bm1688.a" " libbmtpulv60_kernel_module.a"
9291 " libcmodel_bm1690.a" " libbm1690_kernel_module.a"
@@ -101,13 +100,17 @@ mapfile -t libs_md5_list < <(
101100 done
102101)
103102# check whether the third_party/nntoolchain/lib or ppl is updated
104- if [ ! -f " $VER_FILE " ] || has_md5_changes " $VER_FILE " " ${libs_md5_list[@]} " || ! grep -Fxq -f " $PPL_VER_PATH " " $VER_FILE " ; then
103+ # use a version file under the install path for cache tracking
104+ VER_DIR=" ${INSTALL_PATH} /share/ppl"
105+ mkdir -p " $VER_DIR "
106+ VER_FILE=" ${VER_DIR} /.version"
107+ if [ ! -f " $VER_FILE " ] || [ " $( head -n1 " $VER_FILE " ) " != " $BUILD_MODE " ] || has_md5_changes " $VER_FILE " " ${libs_md5_list[@]} " || ! grep -Fxq -f " $PPL_VER_PATH " " $VER_FILE " ; then
105108 lib_changed=true
106109fi
107110if [ " $lib_changed " = false ] && [ " $file_changed " = false ]; then
108111 exit 0
109112fi
110- # build third_party/nntoolchain/ ppl lib
113+ # build ppl libs and install directly to INSTALL_PATH
111114echo " rebuilding ppl..."
112115pushd " $DIR "
113116# wipe ppl compile cache ONCE for the whole rebuild (not per-chip)
176179if [ " $file_changed " = true ]; then
177180 printf ' %s\n' " ${md5_list[@]} " > " $MD5FILE "
178181fi
179- # VER_FILE records the nntoolchain/ppl versions that the installed RELEASE
180- # artifacts were built against, so only update it on RELEASE builds.
182+ # VER_FILE records the nntoolchain lib versions that the installed artifacts
183+ # were built against, so only update it on RELEASE builds.
181184if [ " $lib_changed " = true ]; then
182185 printf ' %s\n' " $BUILD_MODE " > " $VER_FILE "
183186 cat " $PPL_VER_PATH " >> " $VER_FILE "
0 commit comments