1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-06-26 01:42:01 +03:00
iris/Makefile.am
2012-09-26 22:20:38 +02:00

176 lines
6.4 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 = 0x80400000
load = 0x80000000
noinst_DATA = iris.raw mips/start.raw mips/start-hack.S mips/nanonote/sdram-setup.raw
noinst_PROGRAMS = iris.elf mips/start.elf mips/nanonote/sdram-setup.elf
%.raw: %.elf
$(OBJCOPY) $(objcopyflags) -Obinary $< $@
# Define boot_threads depending on selected mode.
if UDC
boot_threads = udc
else
if UNBRICK
boot_threads = nand sdmmc usbmassstorage
else
boot_threads = sdmmc partition fat
endif
endif
# Threadlist must be the last file on the line below.
iris_sources = panic.cc data.cc alloc.cc memory.cc invoke.cc schedule.cc mips/interrupts.cc mips/arch.cc threadlist.S
boot_sources = mips/init.cc mips/nanonote/board.cc
headers = kernel.hh iris.hh devices.hh ui.hh keys.hh mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh mips/nand.hh
iris_elf_CPPFLAGS = -O5 -fno-inline -I. -Imips -Imips/nanonote -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_nanonote_sdram_setup_elf_DEPENDENCIES = mips/nanonote/sdram-setup.ld
mips_nanonote_sdram_setup_elf_CPPFLAGS = -O5 -fno-inline -I. -Imips -Imips/nanonote -Wa,-mips32
mips_nanonote_sdram_setup_elf_CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3
mips_nanonote_sdram_setup_elf_LDFLAGS = -Wl,--omagic -Wl,-T -Wl,mips/nanonote/sdram-setup.ld -nostdlib
mips_nanonote_sdram_setup_elf_SOURCES = mips/nanonote/sdram-setup.cc
program_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)
AM_CPPFLAGS = -O5 -fno-inline -I. -I./mips -I./mips/nanonote -Wa,-mips32 -DNANONOTE
AM_CXXFLAGS = -Wno-unused-parameter -fno-strict-aliasing -fno-builtin -ggdb3
AM_LDFLAGS = -nostdlib
BUILT_SOURCES = $(headers) source/charset.data server
threadlist.S: mkthreadlist Makefile $(addprefix fs/,$(addsuffix .elf,bootinit $(boot_threads)))
$(top_srcdir)/$< bootinit $(boot_threads) > $@
PYPP = /usr/bin/pypp
%.cc: %.ccp
$(PYPP) --name $< < $< > $@
%.hh: %.hhp
$(PYPP) --name $< < $< > $@
source/charset.data: source/charset
$< > $@
fs/font.dat: courier-10+8+32.png makefont
./makefont $< > $@
fs/%: %
ln -s ../$< $@
fs_alarm_elf_SOURCES = source/crt0.cc source/alarm.cc ${headers}
fs_ball_elf_SOURCES = source/crt0.cc source/ball.cc ${headers}
fs_boot_elf_SOURCES = source/crt0.cc source/boot.cc ${headers}
fs_booter_elf_SOURCES = source/crt0.cc source/booter.cc ${headers}
fs_bootinit_elf_SOURCES = source/crt0.cc source/bootinit.cc ${headers}
fs_bsquare_elf_SOURCES = source/crt0.cc source/bsquare.cc ${headers}
fs_buzzer_elf_SOURCES = source/crt0.cc source/buzzer.cc ${headers}
fs_elfrun_elf_SOURCES = source/crt0.cc source/elfrun.cc ${headers}
fs_fat_elf_SOURCES = source/crt0.cc source/fat.cc ${headers}
fs_font_elf_SOURCES = source/crt0.cc source/font.cc ${headers}
fs_gpio_elf_SOURCES = source/crt0.cc source/gpio.cc ${headers}
fs_gui_elf_SOURCES = source/crt0.cc source/gui.cc ${headers}
fs_init_elf_SOURCES = source/crt0.cc source/init.cc ${headers}
fs_lcd_elf_SOURCES = source/crt0.cc source/lcd.cc ${headers}
fs_metronome_elf_SOURCES = source/crt0.cc source/metronome.cc ${headers}
fs_nand_elf_SOURCES = source/crt0.cc source/nand.cc ${headers}
fs_partition_elf_SOURCES = source/crt0.cc source/partition.cc ${headers}
fs_rtc_elf_SOURCES = source/crt0.cc source/rtc.cc ${headers}
fs_sdmmc_elf_SOURCES = source/crt0.cc source/sdmmc.cc ${headers}
fs_test_elf_SOURCES = source/crt0.cc source/test.cc ${headers}
fs_udc_elf_SOURCES = source/crt0.cc source/udc.cc ${headers}
fs_usbmassstorage_elf_SOURCES = source/crt0.cc source/usbmassstorage.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/nanonote/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
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
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