1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-16 21:23:42 +02:00
iris/Makefile
Bas Wijnen ef1b9bfe10 more
2009-06-01 01:12:54 +02:00

58 lines
1.6 KiB
Makefile

load = 0x80000000
CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -nostdinc -DNUM_THREADS=2 -I/usr/include
CPPFLAGS = -O5 -Wa,-mips32
CROSS = mipsel-linux-gnu-
CC = $(CROSS)gcc
LD = $(CROSS)ld
OBJCOPY = $(CROSS)objcopy
OBJDUMP = $(CROSS)objdump
STRIP = $(CROSS)strip
kernel_sources = interrupts.cc panic.cc data.cc test.cc alloc.cc arch.cc invoke.cc schedule.cc
boot_sources = init.cc
BUILT_SOURCES = $(kernel_sources) $(boot_sources)
PYPP = /usr/bin/pypp
%.cc: %.ccp
$(PYPP) --name $< < $< > $@
%.hh: %.hhp boot-programs/sos.h
$(PYPP) --name $< < $< > $@
# Transform ':' into ';' so vim doesn't think there are errors.
uimage: all.raw Makefile
mkimage -A MIPS -O Linux -C none -a $(load) -e 0x$(shell /bin/sh -c '$(OBJDUMP) -t all | grep __start$$ | cut -b-8') -n "Shevek's kernel" -d $< $@ | sed -e 's/:/;/g'
arch.hh: mips.hh
ln -s $< $@ || true
arch.cc: mips.cc
ln -s $< $@ || true
%.o:%.cc Makefile kernel.hh arch.hh boot-programs/sos.h
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
entry.o: thread0 thread1
%.o:%.S Makefile arch.hh
$(CC) $(CPPFLAGS) -DKERNEL_STACK_SIZE=0x2000 -c $< -o $@
%: boot-helper.o boot-programs/%.o
$(LD) $^ -o $@
$(STRIP) $@
# entry.o must be the first file. boot.o must be the first of the init objects (which can be dumped after loading).
all: entry.o $(subst .cc,.o,$(kernel_sources)) boot.o $(subst .cc,.o,$(boot_sources))
$(LD) --omagic -Ttext $(load) $^ -o $@
junk = mdebug.abi32 reginfo comment pdr
%.raw: %
$(OBJCOPY) -S $(addprefix --remove-section=.,$(junk)) -Obinary $< $@
%.gz: %
gzip < $< > $@
clean:
rm -f all uimage *.o boot-programs/*.o all.raw.gz arch.hh arch.cc
.PHONY: clean