Rework build.sh script.

Mostly minor changes, but ¯\_(ツ)_/¯
This commit is contained in:
Curle 2019-07-21 01:26:29 +01:00
parent ee0b7af396
commit 4b3d84a787

View File

@ -1,11 +1,11 @@
set +v
CurrentDir = $PWD
GCC-NAME = x86_64-w64-mingw
EFI-FOLDER = gnu-efi
CurrentDir=$PWD
GCC_NAME=x86_64-w64-mingw32
EFI_FOLDER=gnu-efi
Linker="$EFI-FOLDER/gnuefi/elf_x86_64_efi.lds"
Linker="$EFI_FOLDER/gnuefi/elf_x86_64_efi.lds"
cd ./x64
@ -20,12 +20,20 @@ HeaderFiles=-I$CurrentDir/inc/ \
set -v
for f in $CurrentDir/src/*.c; do
echo "$GCC-NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
"$GCC-NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
echo "$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
"$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-redzone -DGNU_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFiles -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
done
set +v
set -v
while read f; do
echo "$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-red-zone -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFILES -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
"$GCC_NAME-gcc" -ffreestanding -fpic -fshort-wchar -fno-stack-protector -fno-stack-check -fno-strict-aliasing -fno-merge-all-constants -m64 -mno-red-zone -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 $HeaderFILES -Og -g3 -Wall -Wextra -Wdouble-promotion -fmessage-length=0 -c -MMD -MP -Wa,-adhln="${f%.*}.out" -MF"${f%.*}.d" -MT"${f%.*}.o" -o "${f%.*}.o" "$f"
done < $CurrentDir/c_files.txt
set +v
while read f; do
echo "${f%.*}.o" | tee -a objects.list
done < $CurrentDir/c_files.txt
@ -35,7 +43,7 @@ for f in $CurrentDir/src/*.o; do
done
set -v
"$GCC-NAME-ld" -T$Linker -nostdlib --warn-common --no-undefined -znocombreloc -s -shared -Bsymbolic -Map=output.map -o "program.so" @"objects.list"
"$GCC_NAME-ld" -T$Linker -nostdlib --warn-common --no-undefined -znocombreloc -s -shared -Bsymbolic -Map=output.map -o "program.so" @"objects.list"
set +v
rm image/efi/boot/BOOTx64.efi