2011-12-22 15:19:25 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
|
|
|
#
|
|
|
|
# \brief Prepare Genode build directory
|
|
|
|
# \author Christian Helmuth, Norman Feske
|
|
|
|
# \date 2008-08-14
|
|
|
|
#
|
|
|
|
|
|
|
|
MAKEOVERRIDES =
|
|
|
|
|
|
|
|
PLATFORM = $(MAKECMDGOALS)
|
|
|
|
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
PLATFORMS = arm_v6 arm_v7a riscv x86_32 x86_64 linux
|
|
|
|
|
|
|
|
PLATFORMS_DEPR = arndale imx53_qsb imx53_qsb_tz imx6q_sabrelite imx7d_sabre \
|
|
|
|
nit6_solox odroid_x2 odroid_xu panda pbxa9 riscv_spike rpi \
|
|
|
|
usb_armory wand_quad zynq_qemu muen
|
|
|
|
|
|
|
|
PLATFORM_ALT(arndale) = arm_v7a
|
|
|
|
PLATFORM_ALT(imx53_qsb) = arm_v7a
|
|
|
|
PLATFORM_ALT(imx53_qsb_tz) = arm_v7a
|
|
|
|
PLATFORM_ALT(imx6q_sabrelite) = arm_v7a
|
|
|
|
PLATFORM_ALT(imx7d_sabre) = arm_v7a
|
|
|
|
PLATFORM_ALT(muen) = x86_64
|
|
|
|
PLATFORM_ALT(nit6_solox) = arm_v7a
|
|
|
|
PLATFORM_ALT(odroid_x2) = arm_v7a
|
|
|
|
PLATFORM_ALT(odroid_xu) = arm_v7a
|
|
|
|
PLATFORM_ALT(panda) = arm_v7a
|
|
|
|
PLATFORM_ALT(pbxa9) = arm_v7a
|
|
|
|
PLATFORM_ALT(riscv_spike) = riscv
|
|
|
|
PLATFORM_ALT(rpi) = arm_v6
|
|
|
|
PLATFORM_ALT(usb_armory) = arm_v7a
|
|
|
|
PLATFORM_ALT(wand_quad) = arm_v7a
|
|
|
|
PLATFORM_ALT(zynq_qemu) = arm_v7a
|
2017-02-01 13:19:59 +00:00
|
|
|
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
usage:
|
|
|
|
@echo
|
|
|
|
@echo "Tool for preparing Genode build directories"
|
|
|
|
@echo
|
|
|
|
@echo "usage:"
|
|
|
|
@echo
|
2014-05-07 09:48:19 +00:00
|
|
|
@echo " create_builddir <platform> [BUILD_DIR=<build-dir>]"
|
2011-12-22 15:19:25 +00:00
|
|
|
@echo
|
2012-05-22 14:36:56 +00:00
|
|
|
@echo " <platform> can be:"
|
2017-02-01 13:19:59 +00:00
|
|
|
@$(foreach PLAT,$(PLATFORMS), \
|
|
|
|
echo " '$(PLAT)'";)
|
2016-12-21 07:16:12 +00:00
|
|
|
@echo
|
|
|
|
@echo " the following <platform> arguments are deprecated:"
|
2017-02-01 13:19:59 +00:00
|
|
|
@$(foreach PLAT,$(PLATFORMS_DEPR), \
|
|
|
|
printf " %-20s(use '$(PLATFORM_ALT($(PLAT)))')\n" "'$(PLAT)'";)
|
2011-12-23 13:04:29 +00:00
|
|
|
@echo
|
2014-05-07 09:48:19 +00:00
|
|
|
@echo " The definition of BUILD_DIR is optional. If specified,"
|
|
|
|
@echo " <build-dir> is the location of the build directory to create."
|
|
|
|
@echo " If not specified, the build directory will be created at"
|
|
|
|
@echo " <genode-dir>/build/<platform>."
|
2011-12-22 15:19:25 +00:00
|
|
|
@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))/..)
|
|
|
|
|
2014-05-07 09:48:19 +00:00
|
|
|
#
|
|
|
|
# Define default location of the build directory if not explicitly specified
|
|
|
|
#
|
|
|
|
BUILD_DIR ?= $(GENODE_DIR)/build/$(PLATFORM)
|
|
|
|
|
2017-02-01 13:19:59 +00:00
|
|
|
#
|
|
|
|
# Sanity checks
|
|
|
|
#
|
|
|
|
ifneq ($(PLATFORM),)
|
|
|
|
#
|
|
|
|
# Check if platform is deprecated or unknown
|
|
|
|
#
|
|
|
|
ifneq ($(filter $(PLATFORM),$(PLATFORMS_DEPR)),)
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
$(info Platform '$(PLATFORM)' is deprecated, use '$(PLATFORM_ALT($(PLATFORM)))' instead)
|
2017-02-01 13:19:59 +00:00
|
|
|
else ifeq ($(filter $(PLATFORM),$(PLATFORMS)),)
|
|
|
|
$(error Bad platform argument '$(PLATFORM)')
|
|
|
|
endif
|
2014-05-08 14:42:38 +00:00
|
|
|
|
2017-02-01 13:19:59 +00:00
|
|
|
#
|
|
|
|
# Check if build directory exists already
|
|
|
|
#
|
|
|
|
ifneq ($(wildcard $(BUILD_DIR)),)
|
|
|
|
$(error Build directory '$(BUILD_DIR)' already exists)
|
|
|
|
endif
|
2011-12-22 15:19:25 +00:00
|
|
|
endif
|
|
|
|
|
2017-02-01 13:19:59 +00:00
|
|
|
SHELL := bash
|
|
|
|
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# 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)))
|
|
|
|
|
2014-05-08 14:42:38 +00:00
|
|
|
#
|
|
|
|
# Define absolute path to the contrib directory as written to the
|
|
|
|
# 'etc/build.conf' file. We use 'abs_path' instead of 'realpath' because the
|
|
|
|
# contrib directory may not exist when the build directory is created. In this
|
|
|
|
# case, 'realpath' would return an empty string.
|
|
|
|
#
|
|
|
|
ifeq ($(CONTRIB_DIR),)
|
|
|
|
CONTRIB_ABS_DIR := $$(GENODE_DIR)/contrib
|
|
|
|
else
|
|
|
|
CONTRIB_ABS_DIR := $(abspath $(shell echo $(CONTRIB_DIR)))
|
|
|
|
endif
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
$(BUILD_DIR)/etc:
|
|
|
|
@mkdir -p $@
|
|
|
|
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
BUILD_CONF_X86 := run_x86 run_boot_dir repos repos_x86
|
|
|
|
BUILD_CONF_ARM_V6 := run_arm_v6 run_boot_dir repos
|
|
|
|
BUILD_CONF_ARM_V7 := run_arm_v7 run_boot_dir repos
|
|
|
|
BUILD_CONF(arm_v6) := $(BUILD_CONF_ARM_V6)
|
|
|
|
BUILD_CONF(arm_v7a) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(riscv) := run_riscv run_boot_dir repos
|
|
|
|
BUILD_CONF(x86_32) := run_x86_32 $(BUILD_CONF_X86)
|
|
|
|
BUILD_CONF(x86_64) := run_x86_64 $(BUILD_CONF_X86)
|
|
|
|
BUILD_CONF(linux) := run_kernel_linux repos
|
2016-12-21 07:16:12 +00:00
|
|
|
|
|
|
|
# deprecated platforms, to be removed
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
BUILD_CONF(arndale) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(imx53_qsb) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(imx53_qsb_tz) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(imx6q_sabrelite) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(imx7d_sabre) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(nit6_solox) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(odroid_x2) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(odroid_xu) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(panda) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(pbxa9) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(rpi) := $(BUILD_CONF_ARM_V6)
|
|
|
|
BUILD_CONF(usb_armory) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(wand_quad) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(zynq_qemu) := $(BUILD_CONF_ARM_V7)
|
|
|
|
BUILD_CONF(muen) := run_x86_64 $(BUILD_CONF_X86)
|
|
|
|
BUILD_CONF(riscv_spike) := ${BUILD_CONF(riscv)}
|
2016-12-21 07:16:12 +00:00
|
|
|
|
|
|
|
message: $(BUILD_DIR)/etc/build.conf
|
|
|
|
$(BUILD_DIR)/etc/build.conf:
|
|
|
|
@echo "GENODE_DIR := $(GENODE_ABS_DIR)" > $@
|
|
|
|
@echo 'BASE_DIR := $$(GENODE_DIR)/repos/base' >> $@
|
|
|
|
@echo 'CONTRIB_DIR := $(CONTRIB_ABS_DIR)' >> $@
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
ifeq ($(PLATFORM),riscv_spike)
|
|
|
|
@echo "BOARD := spike" >> $@
|
|
|
|
else ifeq ($(PLATFORM),muen)
|
|
|
|
@echo "BOARD := muen" >> $@
|
|
|
|
@echo "KERNEL := hw" >> $@
|
|
|
|
else ifneq ($(filter $(PLATFORM),$(PLATFORMS_DEPR)),)
|
|
|
|
@echo "BOARD := $(PLATFORM)" >> $@
|
|
|
|
endif
|
2011-12-22 15:19:25 +00:00
|
|
|
@echo >> $@
|
2016-12-21 07:16:12 +00:00
|
|
|
@for i in make_j run; do \
|
|
|
|
cat $(GENODE_DIR)/tool/builddir/build.conf/$$i; done >> $@
|
|
|
|
@for i in ${BUILD_CONF(${PLATFORM})}; do \
|
|
|
|
cat $(GENODE_DIR)/tool/builddir/build.conf/$$i; done >> $@
|
2011-12-23 13:04:29 +00:00
|
|
|
|
2016-12-21 07:16:12 +00:00
|
|
|
message: $(BUILD_DIR)/Makefile
|
2011-12-22 15:19:25 +00:00
|
|
|
$(BUILD_DIR)/Makefile:
|
|
|
|
@ln -sf $(GENODE_ABS_DIR)/tool/builddir/build.mk $@
|
|
|
|
|
2016-12-21 07:16:12 +00:00
|
|
|
$(BUILD_DIR)/etc/build.conf: $(BUILD_DIR)/etc
|
|
|
|
$(BUILD_DIR)/etc/specs.conf: $(BUILD_DIR)/etc
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
2016-12-21 07:16:12 +00:00
|
|
|
# Detect host CPU architecture (needed for creating Linux build directory that
|
|
|
|
# matches the host system)
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
2016-12-21 07:16:12 +00:00
|
|
|
UNAME_MACHINE := $(shell uname -m)
|
2013-01-22 18:20:30 +00:00
|
|
|
|
2016-12-21 07:16:12 +00:00
|
|
|
SPEC_ARCH(i686) := x86_32
|
|
|
|
SPEC_ARCH(x86_64) := x86_64
|
|
|
|
SPEC_ARCH(armv6l) := armv_v6
|
|
|
|
SPEC_ARCH(armv7l) := armv_v7
|
2015-06-21 14:53:54 +00:00
|
|
|
|
2016-12-21 07:16:12 +00:00
|
|
|
HOST_SPEC_ARCH := ${SPEC_ARCH(${UNAME_MACHINE})}
|
2015-04-28 12:04:37 +00:00
|
|
|
|
2015-02-10 14:19:04 +00:00
|
|
|
#
|
2016-12-21 07:16:12 +00:00
|
|
|
# SPECS definitions
|
2015-02-10 14:19:04 +00:00
|
|
|
#
|
2012-05-29 09:26:37 +00:00
|
|
|
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
SPECS(arm_v6) := arm_v6
|
|
|
|
SPECS(arm_v7a) := arm_v7a
|
|
|
|
SPECS(riscv) := riscv
|
2019-01-14 14:39:46 +00:00
|
|
|
SPECS(x86_32) := x86_32
|
|
|
|
SPECS(x86_64) := x86_64
|
|
|
|
SPECS(linux) := $(HOST_SPEC_ARCH)
|
2016-12-21 07:16:12 +00:00
|
|
|
|
|
|
|
# deprecated platforms
|
tool: deprecate board-specific build directories
* Introduces BOARD variable to determine actual board
* Removes formerly deprecated kernel-specific build directories
The following boards are available:
arm_v6: rpi
arm_v7a: arndale, imx53_qsb, imx53_qsb_tz, imx6q_sabrelite, imx7d_sabre,
nit6_solox, odroid_x2, odroid_xu, panda, pbxa9, usb_armory,
wand_quad, zynq_qemu
x86_64: pc, linux, muen
x86_32: pc, linux
riscv: spike
Ref #3316
2019-04-11 14:24:33 +00:00
|
|
|
SPECS(rpi) := arm_v6
|
|
|
|
SPECS(arndale) := arm_v7a
|
|
|
|
SPECS(imx53_qsb) := arm_v7a
|
|
|
|
SPECS(imx53_qsb_tz) := arm_v7a
|
|
|
|
SPECS(imx6q_sabrelite) := arm_v7a
|
|
|
|
SPECS(imx7d_sabre) := arm_v7a
|
|
|
|
SPECS(nit6_solox) := arm_v7a
|
|
|
|
SPECS(odroid_x2) := arm_v7a
|
|
|
|
SPECS(odroid_xu) := arm_v7a
|
|
|
|
SPECS(panda) := arm_v7a
|
|
|
|
SPECS(pbxa9) := arm_v7a
|
|
|
|
SPECS(usb_armory) := arm_v7a
|
|
|
|
SPECS(wand_quad) := arm_v7a
|
|
|
|
SPECS(zynq_qemu) := arm_v7a
|
|
|
|
SPECS(riscv_spike) := riscv
|
|
|
|
SPECS(muen) := x86_64
|
2016-12-21 07:16:12 +00:00
|
|
|
|
|
|
|
ifneq (${SPECS(${PLATFORM})},)
|
|
|
|
message: $(BUILD_DIR)/etc/specs.conf
|
|
|
|
$(BUILD_DIR)/etc/specs.conf:
|
|
|
|
@echo "SPECS += ${SPECS(${PLATFORM})}" > $@
|
|
|
|
endif
|
2016-02-11 10:37:17 +00:00
|
|
|
|
2016-12-21 07:16:12 +00:00
|
|
|
$(PLATFORM): message
|
|
|
|
message:
|
2014-05-07 09:48:19 +00:00
|
|
|
@echo "Successfully created build directory at $(BUILD_DIR)."
|
|
|
|
@echo "Please adjust $(BUILD_DIR)/etc/build.conf according to your needs."
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
.PHONY: $(PLATFORM)
|