Used mkdir -p to create the llvm-build directory. This ensures that the directory is created only if it doesn't exist.
Added : before the ${BUILD_32_BITS:=OFF} line to prevent the script from exiting if BUILD_32_BITS is already set.
Changed make -j cxx cxxabi unwind to make -j$(nproc) cxx cxxabi unwind to utilize the number of available processors for parallel building. $(nproc) will provide the number of processors on most Unix-like systems.
Enclosed the cmake command arguments in an array cmake_args to handle arguments with spaces properly.
Modified the cmake command to use the array expansion "${cmake_args[@]}" to pass the arguments correctly to cmake. This ensures that arguments with spaces are handled correctly.
These improvements enhance the script's readability, maintainability, and performance.
Here are the improvements made to the code:
Used
mkdir -p
to create thellvm-build
directory. This ensures that the directory is created only if it doesn't exist.Added
:
before the${BUILD_32_BITS:=OFF}
line to prevent the script from exiting ifBUILD_32_BITS
is already set.Changed
make -j cxx cxxabi unwind
tomake -j$(nproc) cxx cxxabi unwind
to utilize the number of available processors for parallel building.$(nproc)
will provide the number of processors on most Unix-like systems.Enclosed the
cmake
command arguments in an arraycmake_args
to handle arguments with spaces properly.Modified the
cmake
command to use the array expansion"${cmake_args[@]}"
to pass the arguments correctly tocmake
. This ensures that arguments with spaces are handled correctly.These improvements enhance the script's readability, maintainability, and performance.