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)
|
|
|
|
|
2022-01-06 11:08:13 +00:00
|
|
|
PLATFORMS = arm_v6 arm_v7a arm_v8a riscv x86_32 x86_64
|
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
|
|
|
|
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
|
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),)
|
|
|
|
#
|
2021-01-20 10:58:14 +00:00
|
|
|
# Check if platform is unknown
|
2017-02-01 13:19:59 +00:00
|
|
|
#
|
2021-01-20 10:58:14 +00:00
|
|
|
ifeq ($(filter $(PLATFORM),$(PLATFORMS)),)
|
2017-02-01 13:19:59 +00:00
|
|
|
$(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 $@
|
|
|
|
|
2024-10-30 13:58:46 +00:00
|
|
|
BUILD_CONF_X86 := run_x86 run_boot_dir repos_x86 repos
|
|
|
|
BUILD_CONF_ARM_V6 := run_arm_v6 run_boot_dir repos_arm_v6 repos
|
|
|
|
BUILD_CONF_ARM_V7 := run_arm_v7 run_boot_dir repos_arm_v7 repos
|
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(arm_v6) := $(BUILD_CONF_ARM_V6)
|
|
|
|
BUILD_CONF(arm_v7a) := $(BUILD_CONF_ARM_V7)
|
2024-10-30 13:58:46 +00:00
|
|
|
BUILD_CONF(arm_v8a) := run_arm_v8 run_boot_dir repos_arm_v8 repos
|
|
|
|
BUILD_CONF(riscv) := run_riscv run_boot_dir repos_riscv repos
|
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_32) := run_x86_32 $(BUILD_CONF_X86)
|
|
|
|
BUILD_CONF(x86_64) := run_x86_64 $(BUILD_CONF_X86)
|
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)' >> $@
|
2011-12-22 15:19:25 +00:00
|
|
|
@echo >> $@
|
2021-01-29 15:11:12 +00:00
|
|
|
@for i in make_j ccache run; do \
|
2016-12-21 07:16:12 +00:00
|
|
|
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
|
|
|
|
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
|
|
|
|
2022-01-06 11:08:13 +00:00
|
|
|
SPECS(arm_v6) := arm_v6
|
|
|
|
SPECS(arm_v7a) := arm_v7a
|
|
|
|
SPECS(arm_v8a) := arm_v8a
|
|
|
|
SPECS(riscv) := riscv
|
|
|
|
SPECS(x86_32) := x86_32
|
|
|
|
SPECS(x86_64) := 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)
|