#! /bin/sh
## clang test script


# direct compilation
echo clang direct:
clang -o arrTest-clang arrTest.c
./arrTest-clang
echo gcc direct:
gcc -o arrTest-gcc arrTest.c
./arrTest-gcc

LINKOPTS="--eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 -m elf_i386_fbsd   /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o"

# via assembly
echo clang asm with old as:
clang -o arrTest-clang.asm -S arrTest.c
/usr/bin/as -o arrTest-clang-oldas.o arrTest-clang.asm
/usr/bin/ld -o arrTest-clang-oldas arrTest-clang-oldas.o ${LINKOPTS}
./arrTest-clang-oldas

echo clang asm with new as:
clang -o arrTest-clang.asm -S arrTest.c
/usr/local/bin/as -o arrTest-clang-newas.o arrTest-clang.asm
/usr/local/bin/ld -o arrTest-clang-newas arrTest-clang-newas.o ${LINKOPTS}
./arrTest-clang-newas

echo gcc asm with old as:
gcc -o arrTest-gcc.asm -S arrTest.c
/usr/bin/as -o arrTest-gcc-oldas.o arrTest-gcc.asm
/usr/bin/ld \-o arrTest-gcc-oldas arrTest-gcc-oldas.o ${LINKOPTS}
./arrTest-gcc-oldas

echo gcc asm  with new as:
gcc -o arrTest-gcc.asm -S arrTest.c
/usr/bin/as -o arrTest-gcc-newas.o arrTest-gcc.asm
/usr/bin/ld -o arrTest-gcc-newas arrTest-gcc-newas.o ${LINKOPTS}
./arrTest-gcc-newas

# via assembly
echo clang asm with old as --32:
clang -o arrTest-clang.asm -S arrTest.c
/usr/bin/as --32 -o arrTest-clang-oldas--32.o arrTest-clang.asm
/usr/bin/ld -o arrTest-clang-oldas--32 arrTest-clang-oldas--32.o ${LINKOPTS}
./arrTest-clang-oldas--32

echo clang asm with new as --32:
/usr/local/bin/as --32 -o arrTest-clang-newas--32.o arrTest-clang.asm
/usr/local/bin/ld -o arrTest-clang-newas--32 arrTest-clang-newas--32.o ${LINKOPTS}
./arrTest-clang-newas--32
