1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-06-26 01:42:01 +03:00
iris/Makefile.am
2013-05-14 18:30:50 -04:00

222 lines
8.1 KiB
Makefile

# Iris: micro-kernel for a capability-based operating system.
# Makefile.am: build rules
# Copyright 2009-2012 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/>.
AUTOMAKE_OPTIONS = subdir-objects foreign
# Define some variables.
OBJDUMP = $(host_alias)-objdump
OBJCOPY = $(host_alias)-objcopy
SERIAL = /dev/ttyUSB0
junk = mdebug.abi32 reginfo comment pdr note.gnu.build-id
objcopyflags = -S $(addprefix --remove-section=.,$(junk))
start_load = 0x80003000
load = 0x80000000
noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/board/sdram-setup.raw
noinst_PROGRAMS = iris.elf mips/start.elf mips/board/sdram-setup.elf
%.raw: %.elf
$(OBJCOPY) $(objcopyflags) -Obinary $< $@
# Define boot_threads depending on selected mode.
if UDC
boot_threads = hardware/udc
else
if UNBRICK
boot_threads = hardware/sdmmc glue/usbmassstorage
else
boot_threads = hardware/sdmmc glue/partition glue/fat
noinst_DATA += iris.tar.gz
endif
endif
# Threadlist must be the last file on the line below.
iris_sources = kernel/panic.cc kernel/data.cc kernel/alloc.cc kernel/memory.cc kernel/invoke.cc kernel/schedule.cc mips/interrupts.cc mips/arch.cc source/boot/threadlist.S
boot_sources = mips/init.cc mips/board/board.cc
headers = include/kernel.hh include/iris.hh include/devices.hh include/ui.hh include/keys.hh mips/arch.hh mips/board/jz4740.hh mips/board/board.hh mips/nand.hh
iris_elf_CPPFLAGS = -O5 -fno-inline -Iinclude -Imips -Imips/board -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
iris_elf_CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3
iris_elf_LDFLAGS = -Wl,--omagic -Wl,-Ttext -Wl,$(load) -nostdlib
iris_elf_SOURCES = mips/entry.S ${iris_sources} mips/boot.S ${boot_sources} ${headers}
mips_start_elf_CPPFLAGS = -O5 -fno-inline -Wa,-mips32 -DSTART="0x$(shell /bin/sh -c '$(OBJDUMP) -t iris.elf | grep __start$$ | cut -b1-8')"
mips_start_elf_LDFLAGS = -Wl,--omagic -Wl,-Ttext -Wl,$(start_load) -nostdlib
mips_start_elf_SOURCES = mips/start-hack.S iris.raw
mips/start-hack.S: mips/start.S iris.raw
cp $< $@
mips_board_sdram_setup_elf_DEPENDENCIES = mips/board/sdram-setup.ld
mips_board_sdram_setup_elf_CPPFLAGS = -O5 -fno-inline -Iinclude -Imips -Imips/board -Wa,-mips32
mips_board_sdram_setup_elf_CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3
mips_board_sdram_setup_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/board/sdram-setup.ld -nostdlib
mips_board_sdram_setup_elf_SOURCES = mips/board/sdram-setup.cc
program_targets = \
source/bootinit.elf \
source/init.elf \
source/boot.elf \
source/gpio.elf \
source/lcd.elf \
source/nand.elf \
source/rtc.elf \
source/sdmmc.elf \
source/udc.elf \
source/elfrun.elf \
source/fat.elf \
source/font.elf \
source/gui.elf \
source/partition.elf \
source/usbmassstorage.elf \
source/alarm.elf \
source/ball.elf \
source/booter.elf \
source/bsquare.elf \
source/buzzer.elf \
source/metronome.elf \
source/test.elf
fs_targets = \
fs/alarm.elf \
fs/ball.elf \
fs/boot.elf \
fs/booter.elf \
fs/bootinit.elf \
fs/bsquare.elf \
fs/buzzer.elf \
fs/elfrun.elf \
fs/fat.elf \
fs/font.elf \
fs/gpio.elf \
fs/gui.elf \
fs/init.elf \
fs/lcd.elf \
fs/metronome.elf \
fs/nand.elf \
fs/partition.elf \
fs/rtc.elf \
fs/sdmmc.elf \
fs/test.elf \
fs/udc.elf \
fs/usbmassstorage.elf
noinst_PROGRAMS += $(program_targets)
noinst_DATA += $(fs_targets)
AM_CPPFLAGS = -O5 -fno-inline -Iinclude -Imips -Imips/board -Wa,-mips32 -DNANONOTE
AM_CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3
AM_LDFLAGS = -nostdlib
BUILT_SOURCES = $(headers) source/data/charset.data server
source/boot/threadlist.S: source/boot/mkthreadlist Makefile $(addprefix fs/,$(addsuffix .elf,bootinit $(notdir $(boot_threads))))
$< bootinit $(boot_threads) > $@
PYPP = /usr/bin/pypp
%.cc: %.ccp
$(PYPP) --name $< < $< > $@
%.hh: %.hhp
$(PYPP) --name $< < $< > $@
source/data/charset.data: source/data/charset
$< > $@
fs/font.dat: source/data/courier-10+8+32.png source/data/makefont
source/data/makefont $< > $@
fs/init.config: source/data/init.config
ln -s ../$< $@
fs/%.elf: source/%.elf
mkdir -p fs
$(OBJCOPY) -S $< $@
source_bootinit_elf_SOURCES = source/boot/crt0.cc source/boot/bootinit.cc ${headers}
source_init_elf_SOURCES = source/boot/crt0.cc source/boot/init.cc ${headers}
source_boot_elf_SOURCES = source/boot/crt0.cc source/hardware/boot.cc ${headers}
source_buzzer_elf_SOURCES = source/boot/crt0.cc source/hardware/buzzer.cc ${headers}
source_gpio_elf_SOURCES = source/boot/crt0.cc source/hardware/gpio.cc ${headers}
source_lcd_elf_SOURCES = source/boot/crt0.cc source/hardware/lcd.cc ${headers}
source_nand_elf_SOURCES = source/boot/crt0.cc source/hardware/nand.cc ${headers}
source_rtc_elf_SOURCES = source/boot/crt0.cc source/hardware/rtc.cc ${headers}
source_sdmmc_elf_SOURCES = source/boot/crt0.cc source/hardware/sdmmc.cc ${headers}
source_udc_elf_SOURCES = source/boot/crt0.cc source/hardware/udc.cc ${headers}
#source_buffer_elf_SOURCES = source/boot/crt0.cc source/glue/buffer.cc ${headers}
source_elfrun_elf_SOURCES = source/boot/crt0.cc source/glue/elfrun.cc ${headers}
source_fat_elf_SOURCES = source/boot/crt0.cc source/glue/fat.cc ${headers}
source_font_elf_SOURCES = source/boot/crt0.cc source/glue/font.cc ${headers}
source_gui_elf_SOURCES = source/boot/crt0.cc source/glue/gui.cc ${headers}
source_partition_elf_SOURCES = source/boot/crt0.cc source/glue/partition.cc ${headers}
source_usbmassstorage_elf_SOURCES = source/boot/crt0.cc source/glue/usbmassstorage.cc ${headers}
source_metronome_elf_SOURCES = source/boot/crt0.cc source/application/metronome.cc ${headers}
source_test_elf_SOURCES = source/boot/crt0.cc source/application/test.cc ${headers}
source_alarm_elf_SOURCES = source/boot/crt0.cc source/application/alarm.cc ${headers}
source_ball_elf_SOURCES = source/boot/crt0.cc source/application/ball.cc ${headers}
source_booter_elf_SOURCES = source/boot/crt0.cc source/application/booter.cc ${headers}
source_bsquare_elf_SOURCES = source/boot/crt0.cc source/application/bsquare.cc ${headers}
server:
test -e native/Makefile || native/autogen.sh
$(MAKE) -C native
# This target is meaningless for SD boot mode.
test: mips/start.raw mips/start.elf server mips/board/sdram-setup.raw fs/init.config fs/font.dat
echo shutdown | nc localhost 5050 || true
native/usb-server
echo 'reboot $(start_load) 0x$(shell /bin/sh -c '$(OBJDUMP) -t mips/start.elf | grep __start$$ | cut -b1-8') mips/start.raw' | nc localhost 5050
# SD boot stuff
iris.tar.gz: mips/start.raw.gz mips/start.elf $(fs_targets) fs/init.config fs/font.dat
test -d fs/boot || mkdir fs/boot
mkimage -A mips -T kernel -a $(start_load) -e $(shell /bin/sh -c '$(OBJDUMP) -t mips/start.elf | grep __start$$ | cut -b1-8') -n Iris -d mips/start.raw.gz fs/boot/uImage | sed -e 's/:/;/g'
cd fs && tar czvf ../$@ --dereference *
%.gz: %
gzip < $< > $@
sources = \
source/alarm.cc \
source/ball.cc \
source/boot.cc \
source/booter.cc \
source/bootinit.cc \
source/bsquare.cc \
source/buzzer.cc \
source/elfrun.cc \
source/fat.cc \
source/font.cc \
source/gpio.cc \
source/gui.cc \
source/init.cc \
source/lcd.cc \
source/metronome.cc \
source/nand.cc \
source/partition.cc \
source/rtc.cc \
source/sdmmc.cc \
source/test.cc \
source/udc.cc \
source/usbmassstorage.cc
debug:
stty -F $(SERIAL) 57600 raw
cat $(SERIAL)
autoclean: maintainer-clean
$(MAKE) -C native autoclean
rm -rf aclocal.m4 configure depcomp fs install-sh iris.raw iris-sd.tar Makefile.in missing $(iris_sources) $(boot_sources) $(sources) $(headers) mips/start-hack.S mips/start.raw mips/start.raw.gz source/data/charset.data iris.tar.gz