redox/mk/config.mk

126 lines
3.5 KiB
Makefile
Raw Permalink Normal View History

# Configuration file of the build system environment variables
-include .config
2023-06-06 16:20:02 +02:00
HOST_ARCH?=$(shell uname -m)
2017-01-05 22:07:20 +01:00
# Configuration
2023-06-06 16:20:02 +02:00
## Architecture to build Redox for (aarch64, i686, or x86_64). Defaults to a host one
ARCH?=$(HOST_ARCH)
2023-12-17 03:16:42 +01:00
## Sub-device type for aarch64 if needed
BOARD?=
2022-09-12 15:51:13 +02:00
## Enable to use binary prefix (much faster)
2019-06-19 04:10:30 +02:00
PREFIX_BINARY?=1
2022-09-12 15:51:13 +02:00
## Enable to use binary packages (much faster)
REPO_BINARY?=0
## Name of the configuration to include in the image name e.g. desktop or server
CONFIG_NAME?=desktop
## Ignore errors when building the repo, attempt to build every package
## REPO_NONSTOP?=--nonstop
REPO_NONSTOP?=
## Select filesystem config
2023-12-17 03:16:42 +01:00
ifeq ($(BOARD),)
FILESYSTEM_CONFIG?=config/$(ARCH)/$(CONFIG_NAME).toml
2023-12-17 03:16:42 +01:00
else
FILESYSTEM_CONFIG?=config/$(ARCH)/$(BOARD)/$(CONFIG_NAME).toml
endif
HOST_CARGO=env -u RUSTUP_TOOLCHAIN -u CC -u TARGET cargo
## Filesystem size in MB (default comes from filesystem_size in the FILESYSTEM_CONFIG)
## FILESYSTEM_SIZE?=$(shell $(HOST_CARGO) run --release --manifest-path installer/Cargo.toml -- --filesystem-size -c $(FILESYSTEM_CONFIG))
2022-03-09 18:33:12 +01:00
## Flags to pass to redoxfs-mkfs. Add --encrypt to set up disk encryption
REDOXFS_MKFS_FLAGS?=
2022-11-12 00:23:08 +01:00
## Set to 1 to enable Podman build, any other value will disable it
2024-09-20 23:00:16 +02:00
PODMAN_BUILD?=1
2022-11-12 00:23:08 +01:00
## The containerfile to use for the Podman base image
CONTAINERFILE?=podman/redox-base-containerfile
2017-01-05 22:07:20 +01:00
2017-02-01 22:15:48 +01:00
# Per host variables
export NPROC=nproc
export REDOX_MAKE=make
HOST_TARGET := $(shell env -u RUSTUP_TOOLCHAIN rustc -vV | grep host | cut -d: -f2 | tr -d " ")
ifneq ($(HOST_TARGET),x86_64-unknown-linux-gnu)
# The binary prefix is only built for x86_64 Linux hosts
PREFIX_BINARY=0
endif
2017-02-01 22:15:48 +01:00
UNAME := $(shell uname)
ifeq ($(UNAME),Darwin)
FUMOUNT=umount
2017-02-01 22:15:48 +01:00
export NPROC=sysctl -n hw.ncpu
VB_AUDIO=coreaudio
VBM=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
2020-05-03 02:45:15 +02:00
else ifeq ($(UNAME),FreeBSD)
2020-05-03 02:13:21 +02:00
FUMOUNT=sudo umount
export REDOX_MAKE=gmake
VB_AUDIO=pulse # To check, will probably be OSS on most setups
2020-05-03 02:13:21 +02:00
VBM=VBoxManage
2017-02-01 22:15:48 +01:00
else
# Detect which version of the fusermount binary is available.
ifneq (, $(shell which fusermount3))
FUMOUNT=fusermount3 -u
else
FUMOUNT=fusermount -u
endif
VB_AUDIO=pulse
2017-02-01 22:15:48 +01:00
VBM=VBoxManage
endif
2023-06-06 16:20:02 +02:00
ifneq ($(UNAME),Linux)
PREFIX_BINARY=0
endif
ifneq ($(HOST_ARCH),x86_64)
PREFIX_BINARY=0
endif
2017-01-05 22:07:20 +01:00
# Automatic variables
ROOT=$(CURDIR)
export RUST_COMPILER_RT_ROOT=$(ROOT)/rust/src/llvm-project/compiler-rt
2017-01-05 22:07:20 +01:00
## Userspace variables
export TARGET=$(ARCH)-unknown-redox
ifeq ($(ARCH),riscv64gc)
export GNU_TARGET=riscv64-unknown-redox
else
export GNU_TARGET=$(TARGET)
endif
2022-11-12 09:18:14 +01:00
BUILD=build/$(ARCH)/$(CONFIG_NAME)
2022-09-12 15:51:13 +02:00
INSTALLER=installer/target/release/redox_installer
INSTALLER_OPTS=
LIST_PACKAGES=installer/target/release/list_packages
LIST_PACKAGES_OPTS=
2022-09-12 15:51:13 +02:00
ifeq ($(REPO_BINARY),0)
INSTALLER_OPTS+=--cookbook=cookbook
else
INSTALLER_OPTS+=--cookbook=cookbook --repo-binary
LIST_PACKAGES_OPTS+=--repo-binary
2022-09-12 15:51:13 +02:00
endif
REPO_TAG=$(BUILD)/repo.tag
2023-03-06 21:41:45 +01:00
FSTOOLS_TAG=build/fstools.tag
export BOARD
2023-03-06 21:41:45 +01:00
## Cross compiler variables
AR=$(GNU_TARGET)-gcc-ar
AS=$(GNU_TARGET)-as
CC=$(GNU_TARGET)-gcc
CXX=$(GNU_TARGET)-g++
LD=$(GNU_TARGET)-ld
NM=$(GNU_TARGET)-gcc-nm
OBJCOPY=$(GNU_TARGET)-objcopy
OBJDUMP=$(GNU_TARGET)-objdump
RANLIB=$(GNU_TARGET)-gcc-ranlib
READELF=$(GNU_TARGET)-readelf
STRIP=$(GNU_TARGET)-strip
2018-11-28 03:45:52 +01:00
## Rust cross compile variables
export AR_$(subst -,_,$(TARGET)):=$(AR)
export CC_$(subst -,_,$(TARGET)):=$(CC)
export CXX_$(subst -,_,$(TARGET)):=$(CXX)
2022-11-12 00:23:08 +01:00
## If Podman is being used, a container is required
ifeq ($(PODMAN_BUILD),1)
CONTAINER_TAG=build/container.tag
else
CONTAINER_TAG=
endif