mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-01-04 11:20:15 +02:00
44 lines
1.1 KiB
Makefile
44 lines
1.1 KiB
Makefile
|
load = 0xa0000000
|
||
|
|
||
|
CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -nostdinc
|
||
|
CPPFLAGS = -O5 -Wa,-mips32
|
||
|
CROSS = mipsel-linux-gnu-
|
||
|
CC = $(CROSS)gcc
|
||
|
LD = $(CROSS)ld
|
||
|
OBJCOPY = $(CROSS)objcopy
|
||
|
OBJDUMP = $(CROSS)objdump
|
||
|
|
||
|
BUILT_SOURCES = interrupts.cc panic.cc data.cc test.cc
|
||
|
|
||
|
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.gz Makefile
|
||
|
mkimage -A MIPS -O Linux -C gzip -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'
|
||
|
|
||
|
%.o:%.cc Makefile kernel.hh
|
||
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
||
|
|
||
|
%.o:%.S Makefile
|
||
|
$(CC) $(CPPFLAGS) -DKERNEL_STACK_SIZE=0x2000 -c $< -o $@
|
||
|
|
||
|
# entry.o must be the first file. For the rest, the order doesn't matter.
|
||
|
all: entry.o $(subst .cc,.o,$(BUILT_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
|
||
|
|
||
|
.PHONY: clean
|