Commit 55852ebc authored by Naman Dixit's avatar Naman Dixit

Added LLVM IR compiler and interpreter

parents
#!/usr/bin/env bash
function buildDepend () {
$@
echo "Entering directory \`$(pwd)'"
}
function cleanTarget () {
if [ -f "${NTarget}" ] ; then rm "${1}" ; fi
}
function emitOutput () {
printf "\033[36;1m${1}\033[0m\n"
}
if [ -z ${BuildPlatform+x} ]; then
BuildPlatform=linux
fi
if [ -z ${BuildArchitecture+x} ]; then
BuildArchitecture=x64
fi
ProjectRoot="$( cd "$(dirname "$0")" ; pwd -P)" # Directory in which the script is located
pushd ${ProjectRoot}
echo "Entering directory \`$(pwd)'"
BuildDirectory="bin/${BuildPlatform}/${BuildArchitecture}"
mkdir -p ${BuildDirectory}
VersionNumberOld=$(< ./version.${BuildPlatform})
VersionNumber=$((${VersionNumberOld} + 1))
echo ${VersionNumber} > ./version.${BuildPlatform}
#######################################################################
# BUILD
#######################################################################
Source="src/main.cpp"
Target="bin/${BuildPlatform}/${BuildArchitecture}/gazelle-native"
CompilerFlags="-iquote ${ProjectRoot}/src $(llvm-config-13 --cxxflags) \
-g3 -O0 -fno-strict-aliasing -fwrapv -msse2 \
"
LanguageFlags="--std=c++17 -DBUILD_INTERNAL -DBUILD_SLOW -DBUILD_DEBUG -D_GNU_SOURCE \
-DBUILD_NUMBER=${VersionNumber} \
-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE \
"
WarningFlags="-Weverything -Wpedantic -pedantic-errors -Werror \
-Wno-c++98-compat \
"
LinkerFlags="-static-libgcc -pthread -ldl $(llvm-config-13 --ldflags --libs) -lncurses \
-lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen \
-lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers \
-lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend \
-lclangEdit -lclangAST -lclangLex -lclangBasic \
-Wl,-rpath=\${ORIGIN} -Wl,-z,origin -Wl,--enable-new-dtags \
"
cleanTarget ${Target}
clang++-13 ${CompilerFlags} ${LanguageFlags} ${WarningFlags} \
${Source} \
-o ${Target} \
${LinkerFlags}
popd
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment