Skip to content

Commit c3e550a

Browse files
committed
Add check-license Make target
1 parent 1209d86 commit c3e550a

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

Makefile

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ ${TOOLCHAIN_DIR}/softhier:
460460
rm ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/include/flex_alloc.h && \
461461
rm ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/include/flex_runtime.h && \
462462
mv ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/flex_memory_deeploy.ld ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/flex_memory.ld && \
463-
cp ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/deeploy_include/* ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/include
463+
cp ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/deeploy_include/* ${TOOLCHAIN_DIR}/softhier/soft_hier/flex_cluster_sdk/runtime/include
464464

465465
${SOFTHIER_INSTALL_DIR}: ${TOOLCHAIN_DIR}/softhier
466466
cp -r ${TOOLCHAIN_DIR}/softhier ${SOFTHIER_INSTALL_DIR} && \
@@ -566,10 +566,44 @@ chimera-sdk: ${CHIMERA_SDK_INSTALL_DIR}
566566
.PHONY: docs clean-docs format
567567

568568
format:
569-
python scripts/run_clang_format.py -e "*/third_party/*" -e "*/install/*" -e "*/toolchain/*" --clang-format-executable=${LLVM_INSTALL_DIR}/bin/clang-format -ir ./ scripts
570-
autoflake -i -r --remove-all-unused-imports --ignore-init-module-imports --exclude "*/third_party/**" ./
571-
yapf -ipr -e "third_party/" -e "install/" -e "toolchain/" .
572-
isort --sg "**/third_party/*" --sg "install/*" --sg "toolchain/*" ./
569+
@echo "Formatting all relevant files..."
570+
@echo " - Format C/C++ Files"
571+
@python scripts/run_clang_format.py -e "*/third_party/*" -e "*/install/*" -e "*/toolchain/*" --clang-format-executable=${LLVM_INSTALL_DIR}/bin/clang-format -ir ./ scripts
572+
@echo " - Format Python Imports"
573+
@autoflake -i -r --remove-all-unused-imports --ignore-init-module-imports --exclude "*/third_party/**" --exclude "*/install/**" --exclude "*/toolchain/**" ./
574+
@echo " - Format Python Files"
575+
@yapf -ipr -e "third_party/" -e "install/" -e "toolchain/" .
576+
@echo " - Sort Python Imports"
577+
@isort --sg "**/third_party/*" --sg "install/*" --sg "toolchain/*" ./
578+
579+
580+
check-licenses:
581+
@echo "Checking SPDX license headers in all relevant files..."
582+
@echo " - Check Python Files"
583+
@grep -Lr "SPDX-License-Identifier: Apache-2.0" --include="*.py" \
584+
--exclude-dir="toolchain" --exclude-dir="install" --exclude-dir=".git" \
585+
--exclude-dir="third_party" --exclude-dir="TEST_*" --exclude-dir="TestFiles" \
586+
--exclude "run_clang_format.py" .
587+
@echo " - Check C Files"
588+
@grep -Lr "SPDX-License-Identifier: Apache-2.0" --include="*.c" \
589+
--exclude-dir="toolchain" --exclude-dir="install" --exclude-dir=".git" \
590+
--exclude-dir="third_party" --exclude-dir="TEST_*" --exclude-dir="TestFiles" \
591+
--exclude-dir="runtime" .
592+
@echo " - Check C Header Files"
593+
@grep -Lr "SPDX-License-Identifier: Apache-2.0" --include="*.h" \
594+
--exclude-dir="toolchain" --exclude-dir="install" --exclude-dir=".git" \
595+
--exclude-dir="third_party" --exclude-dir="TEST_*" --exclude-dir="TestFiles" \
596+
--exclude-dir="runtime" .
597+
@echo " - Check YAML Files"
598+
@grep -Lr "SPDX-License-Identifier: Apache-2.0" --include="*.yaml" --include="*.yml" \
599+
--exclude-dir="toolchain" --exclude-dir="install" --exclude-dir=".git" \
600+
--exclude-dir="third_party" --exclude-dir="TEST_*" --exclude-dir="TestFiles" \
601+
--exclude-dir="runtime" .
602+
@echo " - Check CMake Files"
603+
@grep -Lr "SPDX-License-Identifier: Apache-2.0" --include="*.cmake" --include="CMakeLists.txt" \
604+
--exclude-dir="toolchain" --exclude-dir="install" --exclude-dir=".git" \
605+
--exclude-dir="third_party" --exclude-dir="TEST_*" --exclude-dir="TestFiles" \
606+
--exclude-dir="runtime" .
573607

574608
docs:
575609
make -C docs html

0 commit comments

Comments
 (0)