genode/tool/create_builddir
Norman Feske 2322ab202c Remove OKLinux
Fixes #29
Fixes #30
Fixes #889
2013-10-22 08:00:16 +02:00

214 lines
5.8 KiB
Makefile
Executable File

#!/usr/bin/make -f
#
# \brief Prepare Genode build directory
# \author Christian Helmuth, Norman Feske
# \date 2008-08-14
#
MAKEOVERRIDES =
PLATFORM = $(MAKECMDGOALS)
usage:
@echo
@echo "Tool for preparing Genode build directories"
@echo
@echo "usage:"
@echo
@echo " create_builddir <platform> BUILD_DIR=<build-dir>"
@echo
@echo " <platform> can be:"
@echo " 'linux_x86'"
@echo " 'linux_arm'"
@echo " 'fiasco_x86'"
@echo " 'pistachio_x86'"
@echo " 'okl4_x86'"
@echo " 'nova_x86_32'"
@echo " 'nova_x86_64'"
@echo " 'codezero_vpb926'"
@echo " 'hw_panda'"
@echo " 'hw_vea9x4'"
@echo " 'hw_pbxa9'"
@echo " 'hw_imx31'"
@echo " 'hw_imx53'"
@echo " 'hw_arndale'"
@echo " 'hw_rpi'"
@echo " 'foc_x86_32'"
@echo " 'foc_x86_64'"
@echo " 'foc_pbxa9'"
@echo " 'foc_imx53'"
@echo " 'foc_vea9x4'"
@echo " 'foc_panda'"
@echo " 'foc_arndale'"
@echo " 'lx_hybrid_x86'"
@echo
@echo " <build-dir> is the location of the build directory to create"
@echo
#
# Determine Genode base directory based on the known location of the
# 'create_builddir' tool within the Genode source tree
#
GENODE_DIR ?= $(realpath $(dir $(MAKEFILE_LIST))/..)
ifeq ($(BUILD_DIR),)
$(PLATFORM):: usage
@echo "Error: BUILD_DIR not defined." ; false
endif
#
# Convert GENODE_DIR to an absolute directory because the user
# may have specified a '~'-relative location or a pwd-relative
# location.
#
GENODE_ABS_DIR := $(realpath $(shell echo $(GENODE_DIR)))
#
# Generic build-directory preparation rules
#
BUILD_CONF = $(GENODE_ABS_DIR)/tool/builddir/etc/build.conf
BUILD_CONF_PLATFORM = $(BUILD_CONF).$(PLATFORM)
$(BUILD_DIR)/etc:
@mkdir -p $@
$(BUILD_DIR)/etc/build.conf:: $(BUILD_CONF_PLATFORM)
@echo "GENODE_DIR = $(GENODE_ABS_DIR)" > $@
@echo 'BASE_DIR = $$(GENODE_DIR)/base' >> $@
#
# Supply -no-kvm argument to Qemu for kernels that are incompatible with KVM
#
ifeq ($(filter-out foc_x86_32 foc_x86_64 okl4_x86 nova_x86_32 nova_x86_64 pistachio_x86,$(PLATFORM)),)
$(BUILD_DIR)/etc/build.conf::
@cat $(BUILD_CONF).qemu_no_kvm >> $@
endif
#
# Add 'base-<platform>' and generic repositories
#
$(BUILD_DIR)/etc/build.conf:: $(BUILD_CONF_PLATFORM)
@echo >> $@
@echo "##" >> $@
@echo "## Kernel-specific base repository" >> $@
@echo "##" >> $@
@echo >> $@
@cat $< >> $@
@cat $(BUILD_CONF).generic >> $@
#
# Add optional repositories for all platforms except for lx_hybrid
#
# Those repositories rely on Genode's libc or contain device drivers.
# Both prerequisites are not available for hybrid Linux/Genode programs.
#
ifneq ($(PLATFORM),lx_hybrid_x86)
$(BUILD_DIR)/etc/build.conf::
@cat $(BUILD_CONF).optional >> $@
endif
$(BUILD_DIR)/Makefile:
@ln -sf $(GENODE_ABS_DIR)/tool/builddir/build.mk $@
#
# Add 'ports-foc' repository to Fiasco.OC build directory
#
ifeq ($(filter-out foc_x86_32 foc_imx53 foc_pbxa9 foc_vea9x4 foc_panda foc_arndale,$(PLATFORM)),)
$(BUILD_DIR)/etc/build.conf::
@cat $(BUILD_CONF).ports-foc >> $@
endif
#
# Add x86 drivers repositories to x86 build directories
#
ifeq ($(filter-out foc_x86_32 foc_x86_64 okl4_x86 nova_x86_32 nova_x86_64 pistachio_x86 fiasco_x86,$(PLATFORM)),)
$(BUILD_DIR)/etc/build.conf::
@cat $(BUILD_CONF).drivers_x86 >> $@
endif
#
# Add ARM drivers repositories to ARM build directories
#
ifeq ($(filter-out foc_panda foc_arndale hw_panda hw_arndale foc_imx53,$(PLATFORM)),)
$(BUILD_DIR)/etc/build.conf::
@cat $(BUILD_CONF).drivers_arm >> $@
endif
#
# Generic platform dependencies
#
$(PLATFORM):: $(BUILD_DIR)/etc
$(PLATFORM):: $(BUILD_DIR)/etc/build.conf
$(PLATFORM):: $(BUILD_DIR)/Makefile
#
# Platform-specific dependencies
#
codezero_vpb926::
@echo "SPECS += codezero_platform_vpb926" > $(BUILD_DIR)/etc/specs.conf
foc_x86_32::
@echo "SPECS = genode foc_x86_32" > $(BUILD_DIR)/etc/specs.conf
@echo "SPECS += acpi" >> $(BUILD_DIR)/etc/specs.conf
foc_x86_64::
@echo "SPECS = genode foc_x86_64" > $(BUILD_DIR)/etc/specs.conf
@echo "SPECS += acpi" >> $(BUILD_DIR)/etc/specs.conf
nova_x86_32::
@echo "SPECS = genode nova_x86_32" > $(BUILD_DIR)/etc/specs.conf
@echo "SPECS += acpi" >> $(BUILD_DIR)/etc/specs.conf
nova_x86_64::
@echo "SPECS = genode nova_x86_64" > $(BUILD_DIR)/etc/specs.conf
@echo "SPECS += acpi" >> $(BUILD_DIR)/etc/specs.conf
foc_pbxa9::
@echo "SPECS = genode foc_pbxa9" > $(BUILD_DIR)/etc/specs.conf
foc_vea9x4::
@echo "SPECS = genode foc_vea9x4" > $(BUILD_DIR)/etc/specs.conf
foc_panda::
@echo "SPECS = genode foc_panda" > $(BUILD_DIR)/etc/specs.conf
foc_imx53::
@echo "SPECS = genode foc_imx53" > $(BUILD_DIR)/etc/specs.conf
foc_arndale::
@echo "SPECS = genode foc_arndale" > $(BUILD_DIR)/etc/specs.conf
codezero_vpb926::
@echo "CODEZERO_DIR = $(GENODE_DIR)/base-codezero/contrib" > $(BUILD_DIR)/etc/codezero.conf
hw_pbxa9::
@echo "SPECS = genode hw_pbxa9" > $(BUILD_DIR)/etc/specs.conf
hw_vea9x4::
@echo "SPECS = genode hw_vea9x4" > $(BUILD_DIR)/etc/specs.conf
hw_panda::
@echo "SPECS = genode hw_panda" > $(BUILD_DIR)/etc/specs.conf
hw_imx31::
@echo "SPECS = genode hw_imx31" > $(BUILD_DIR)/etc/specs.conf
hw_imx53::
@echo "SPECS = genode hw_imx53" > $(BUILD_DIR)/etc/specs.conf
hw_arndale::
@echo "SPECS = genode hw_arndale" > $(BUILD_DIR)/etc/specs.conf
hw_rpi::
@echo "SPECS = genode hw_rpi" > $(BUILD_DIR)/etc/specs.conf
lx_hybrid_x86::
@echo "CROSS_DEV_PREFIX =" > $(BUILD_DIR)/etc/tools.conf
@echo "SPECS += always_hybrid" >> $(BUILD_DIR)/etc/specs.conf
$(PLATFORM)::
@echo "successfully created build directory at $(BUILD_DIR)"
.PHONY: $(PLATFORM)