mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-11-16 21:23:42 +02:00
49 lines
1.4 KiB
Makefile
49 lines
1.4 KiB
Makefile
load = 0x80000000
|
|
|
|
CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -nostdinc -DNUM_THREADS=0
|
|
CPPFLAGS = -O5 -Wa,-mips32
|
|
CROSS = mipsel-linux-gnu-
|
|
CC = $(CROSS)gcc
|
|
LD = $(CROSS)ld
|
|
OBJCOPY = $(CROSS)objcopy
|
|
OBJDUMP = $(CROSS)objdump
|
|
|
|
kernel_sources = interrupts.cc panic.cc data.cc test.cc alloc.cc memory.cc arch.cc invoke.cc schedule.cc
|
|
boot_sources = init.cc
|
|
BUILT_SOURCES = $(kernel_sources) $(boot_sources)
|
|
|
|
PYPP = /usr/bin/pypp
|
|
%.cc: %.ccp kernel.hh
|
|
$(PYPP) --name $< < $< > $@
|
|
%.hh: %.hhp
|
|
$(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.%: mips.%
|
|
ln -s $< $@ || true
|
|
|
|
%.o:%.cc Makefile kernel.hh arch.hh
|
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
|
|
|
%.o:%.S Makefile
|
|
$(CC) $(CPPFLAGS) -DKERNEL_STACK_SIZE=0x2000 -c $< -o $@
|
|
|
|
# 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 all.raw.gz arch.hh
|
|
|
|
.PHONY: clean
|