fix some bugs with new build script

This commit is contained in:
Allen Webster
2021-08-24 21:42:38 -07:00
parent 78bfd000d4
commit 52f975fb8b
4 changed files with 38 additions and 24 deletions
+29 -21
View File
@@ -198,16 +198,6 @@ function bld_compile {
local file_base_no_ext=${file_base%.*}
local out_file="$file_base_no_ext$dot_ext_obj"
###### diagnostic output ##################################################
if [ "$diagnostics" == "1" ]; then
echo "cmp $final_in_file -- ${all_opts[@]}"
fi
###### print source file (if the compiler doesn't do it automatically) ####
if [ "$manually_print_target" == "1" ]; then
echo "$file_base"
fi
###### get real flags #####################################################
local flags_file=$bin_path/compiler_flags.txt
local flags=$(bld_flags_from_opts $flags_file ${all_opts[@]})
@@ -220,8 +210,21 @@ function bld_compile {
rm -f "$out_file_base.o"
rm -f "$out_file_base.obj"
###### compile ############################################################
###### get flags ##########################################################
local all_flags="-c -I$src_path ${flags}"
###### diagnostic output ##################################################
if [ "$diagnostics" == "1" ]; then
echo "cmp $final_in_file -- ${all_opts[@]}"
echo $compiler "$final_in_file" $all_flags
fi
###### print source file (if the compiler doesn't do it automatically) ####
if [ "$manually_print_target" == "1" ]; then
echo "$file_base"
fi
###### compile ############################################################
$compiler "$final_in_file" $all_flags
}
@@ -326,23 +329,28 @@ function bld_link {
fi
out_file="$out_name$dot_ext_out"
###### move to output folder ##############################################
mkdir -p "$build_path"
cd $build_path
###### diagnostic output ##################################################
local final_in_files="${interm_obj[@]} ${in_obj[@]} ${in_lib[@]}"
if [ "$diagnostics" == "1" ]; then
echo "lnk $final_in_files -- ${all_opts[@]}"
fi
###### print output file ##################################################
echo "$out_file"
###### move to output folder ##############################################
mkdir -p "$build_path"
cd $build_path
###### link ###############################################################
if [ "$linker_kind" == "link" ]; then
if [ "$diagnostics" == "1" ]; then
echo $linker -OUT:"$out_file" $flags $final_in_files
fi
echo "$out_file"
$linker -OUT:"$out_file" $flags $final_in_files
elif [ "$linker_kind" == "clang" ]; then
if [ "$diagnostics" == "1" ]; then
echo $linker -o "$out_file" $flags $final_in_files
fi
echo "$out_file"
$linker -o "$out_file" $flags $final_in_files
else
echo "ERROR: invokation not defined for this linker"
@@ -570,9 +578,9 @@ implicit_opts=($out_name $compiler $linker $compile_mode $os $arch $ctx)
###### Object File Extension ##################################################
dot_ext_obj=".obj"
if [[ "$linker" == "clang" || "$linker" == "gcc" ]]; then
dot_ext_obj=".o"
dot_ext_obj=".o"
if [[ "$compiler" == "cl" ]]; then
dot_ext_obj=".obj"
fi
+1 -1
View File
@@ -9,7 +9,7 @@ cd ..
echo "~~~ Build All Tests ~~~"
bin/bld_core.sh show_ctx
bin/bld_core.sh unit sanity_test tests/sanity_tests.c
bin/bld_core.sh unit sanity_tests tests/sanity_tests.c
bin/bld_core.sh unit unicode_test tests/unicode_test.c
bin/bld_core.sh unit cpp_build_test tests/cpp_build_test.cpp
+7 -1
View File
@@ -1 +1,7 @@
###### TODO ###################################################################
###### link ###################################################################
lld-link>-nologo
lld-link>-DEFAULTLIB:libcmt
lld-link>-OPT:REF
lld-link>-INCREMENTAL:NO
lld-link>debug>-DEBUG
lld-link>dll>-DLL
+1 -1
View File
@@ -301,7 +301,7 @@ MD_StaticAssert(sizeof(MD_ArenaDefault) <= MD_IMPL_ArenaHeaderSize, arena_def_si
static MD_Arena*
MD_ArenaDefaultAlloc(MD_u64 cap){
void *mem = MD_IMPL_Reserve(cap);
MD_u64 cmt = MD_ClampBot(MD_ArenaDefault_CommitSize, cap);
MD_u64 cmt = MD_ClampTop(cap, MD_ArenaDefault_CommitSize);
MD_IMPL_Commit(mem, cmt);
MD_ArenaDefault *arena = (MD_ArenaDefault*)mem;