mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-04-21 12:27:27 +03:00
add license; reorganize arch
This commit is contained in:
71
Makefile
71
Makefile
@@ -1,57 +1,54 @@
|
||||
load = 0x80000000
|
||||
# Iris: micro-kernel for a capability-based operating system.
|
||||
# Makefile: build rules
|
||||
# Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -nostdinc -DNUM_THREADS=2 -I/usr/include
|
||||
CPPFLAGS = -O5 -Wa,-mips32
|
||||
CROSS = mipsel-linux-gnu-
|
||||
# Define some variables.
|
||||
CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -nostdinc $(ARCH_CXXFLAGS)
|
||||
CPPFLAGS = -O5 $(ARCH_CPPFLAGS)
|
||||
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
|
||||
headers = kernel.hh iris.h $(arch_headers)
|
||||
kernel_sources = panic.cc data.cc alloc.cc invoke.cc schedule.cc $(arch_kernel_sources)
|
||||
BUILT_SOURCES = $(kernel_sources) $(boot_sources)
|
||||
|
||||
# Include arch-specific rules.
|
||||
include Makefile.arch
|
||||
|
||||
# Disable implicit rules.
|
||||
%.o: %.S
|
||||
%.o: %.cc
|
||||
|
||||
PYPP = /usr/bin/pypp
|
||||
%.cc: %.ccp
|
||||
$(PYPP) --name $< < $< > $@
|
||||
%.hh: %.hhp boot-programs/sos.h
|
||||
%.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'
|
||||
%.o:%.cc Makefile Makefile.arch $(headers)
|
||||
$(CC) $(CPPFLAGS) $(TARGET_FLAGS) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
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
|
||||
%: boot-programs/init.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 < $< > $@
|
||||
$(OBJCOPY) -S $(OBJCOPYFLAGS) $@
|
||||
|
||||
clean:
|
||||
rm -f all uimage *.o boot-programs/*.o all.raw.gz arch.hh arch.cc
|
||||
rm -f *.o boot-programs/*.o kernel kernel.raw kernel.raw.gz $(BUILT_SOURCES) $(ARCH_CLEAN_FILES)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
Reference in New Issue
Block a user