starting to add clang support

This commit is contained in:
David Welch
2012-05-28 22:25:54 -04:00
parent 36fd5ec1f2
commit 487aecf4b4
4 changed files with 53 additions and 6 deletions

View File

@@ -1,9 +1,14 @@
ARMGNU ?= arm-none-eabi
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding
AOPS = --warn --fatal-warnings
COPS = -Wall -Werror -O2 -nostdlib -nostartfiles -ffreestanding
all : blinker01.hex blinker01.bin
gcc : blinker01.hex blinker01.bin
all : gcc clang
clean :
rm -f *.o
@@ -12,15 +17,17 @@ clean :
rm -f *.elf
rm -f *.list
rm -f *.img
rm -f *.bc
rm -f *.clang.opt.s
novectors.o : novectors.s
$(ARMGNU)-as novectors.s -o novectors.o
vectors.o : vectors.s
$(ARMGNU)-as vectors.s -o vectors.o
blinker01.o : blinker01.c
$(ARMGNU)-gcc $(COPS) -c blinker01.c -o blinker01.o
blinker01.elf : memmap novectors.o blinker01.o
$(ARMGNU)-ld novectors.o blinker01.o -T memmap -o blinker01.elf
blinker01.elf : memmap vectors.o blinker01.o
$(ARMGNU)-ld vectors.o blinker01.o -T memmap -o blinker01.elf
$(ARMGNU)-objdump -D blinker01.elf > blinker01.list
blinker01.bin : blinker01.elf
@@ -34,3 +41,30 @@ blinker01.hex : blinker01.elf
LOPS = -Wall -m32 -emit-llvm
LLCOPS = -march=arm -mcpu=arm1176jzf-s
LLCOPS0 = -march=arm
LLCOPS1 = -march=arm -mcpu=arm1176jzf-s
COPS = -Wall -O2 -nostdlib -nostartfiles -ffreestanding
OOPS = -std-compile-opts
clang : blinker01.clang.hex blinker01.clang.bin
blinker01.clang.bc : blinker01.c
clang $(LOPS) -c blinker01.c -o blinker01.clang.bc
blinker01.clang.opt.elf : memmap vectors.o blinker01.clang.bc
opt $(OOPS) blinker01.clang.bc -o blinker01.clang.opt.bc
llc $(LLCOPS) blinker01.clang.opt.bc -o blinker01.clang.opt.s
$(ARMGNU)-as blinker01.clang.opt.s -o blinker01.clang.opt.o
$(ARMGNU)-ld -o blinker01.clang.opt.elf -T memmap vectors.o blinker01.clang.opt.o
$(ARMGNU)-objdump -D blinker01.clang.opt.elf > blinker01.clang.opt.list
blinker01.clang.hex : blinker01.clang.opt.elf
$(ARMGNU)-objcopy blinker01.clang.opt.elf blinker01.clang.hex -O ihex
blinker01.clang.bin : blinker01.clang.opt.elf
$(ARMGNU)-objcopy blinker01.clang.opt.elf blinker01.clang.bin -O binary

View File

@@ -11,3 +11,7 @@ sudo ./build_gcc
then put whatever you had in your prefix/bin in the path. The default
gnuarm would mean /gnuarm/bin goes in the PATH.
clang script I wrote, builds llvm+clang from sources.

9
buildgcc/build_clang Executable file
View File

@@ -0,0 +1,9 @@
svn co http://llvm.org/svn/llvm-project/llvm/branches/release_30/ llvm30
cd llvm30
cd tools
svn co http://llvm.org/svn/llvm-project/cfe/branches/release_30/ clang
cd ..
./configure --enable-optimized --disable-doxygen --prefix=/llvm30
make -j 4
make install