# von folgenden Zeilen nur eine nicht auskommentieren:
VOR=arm-linux-gnueabi-# fuer den Crosscompiler
#VOR=arm-none-eabi-# fuer anderen Crosscompiler
#VOR=# fuer direkt auf dem Raspberry

A=$(VOR)as
OBJCP=$(VOR)objcopy
L=$(VOR)ld
D=$(VOR)objdump
C=$(VOR)gcc
CFLAGS= -O2 -ggdb  #Optimierung (1-3 oder s), und Gnu-Debugger

all: test1.img

# normal uebersetzen "bare metal":
test1.img: test1.s
	$A test1.s -o test1.o
	$L test1.o -t sections.ld -o test1.elf
	$D -d test1.elf >test1.list
	$(OBJCP) test1.elf -O binary test1.img

install: test1.img
	cp test1.img /media/RASPI/kernel.img

# zum unter Linux laufen lassen uebersetzen:
test1: hauptprog.o unterprog.o
	$L hauptprog.o unterprog.o -o test1
	$D -d test1 >test1-linux.list
unterprog.o: test1.s
	$C $(CFLAGS) -c -DLINUX_VERSION test1.s -o unterprog.o
hauptprog.o: hauptprog.c
	$C $(CFLAGS) -c hauptprog.c -o hauptprog.o

clean:
	rm -f *~ *.o a.out test1.elf test1.list test1-linux.list test1.img test1
