redox/mk/config.mk

117 lines
3.1 KiB
Makefile
Raw Normal View History

-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
## 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
## Filesystem size in MB (default comes from filesystem_size in the FILESYSTEM_CONFIG)
FILESYSTEM_SIZE?=$(shell grep filesystem_size $(FILESYSTEM_CONFIG) | cut -d' ' -f3)
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
PODMAN_BUILD?=0
## 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
HOST_CARGO=env -u RUSTUP_TOOLCHAIN cargo
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
export REDOX_MAKE=make
2017-02-01 22:15:48 +01:00
VB_AUDIO=coreaudio
VBM=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage
HOST_TARGET ?= $(HOST_ARCH)-apple-darwin
2023-04-02 12:09:43 +02:00
ALLOC_FILE=truncate -s "$(FILESYSTEM_SIZE)m"
2020-05-03 02:45:15 +02:00
else ifeq ($(UNAME),FreeBSD)
2020-05-03 02:13:21 +02:00
FUMOUNT=sudo umount
export NPROC=sysctl -n hw.ncpu
export REDOX_MAKE=gmake
2020-05-03 02:13:21 +02:00
VB_AUDIO=pulse # To check, will probaly be OSS on most setups
VBM=VBoxManage
HOST_TARGET ?= $(HOST_ARCH)-unknown-freebsd
2023-04-02 12:09:43 +02:00
ALLOC_FILE=fallocate --posix --length "$(FILESYSTEM_SIZE)MiB"
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
2017-02-01 22:15:48 +01:00
export NPROC=nproc
export REDOX_MAKE=make
VB_AUDIO=pulse
2017-02-01 22:15:48 +01:00
VBM=VBoxManage
HOST_TARGET ?= $(HOST_ARCH)-unknown-linux-gnu
2023-04-02 12:09:43 +02:00
ALLOC_FILE=fallocate --posix --length "$(FILESYSTEM_SIZE)MiB"
2017-02-01 22:15:48 +01:00
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
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
ifeq ($(REPO_BINARY),0)
INSTALLER+=--cookbook=cookbook
REPO_TAG=$(BUILD)/repo.tag
else
INSTALLER+=--cookbook=cookbook --repo-binary
REPO_TAG=$(BUILD)/repo.tag
2022-09-12 15:51:13 +02:00
endif
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
2018-12-23 00:45:16 +01:00
AR=$(TARGET)-gcc-ar
2018-11-28 03:45:52 +01:00
AS=$(TARGET)-as
CC=$(TARGET)-gcc
CXX=$(TARGET)-g++
LD=$(TARGET)-ld
2018-12-23 00:45:16 +01:00
NM=$(TARGET)-gcc-nm
2018-11-28 03:45:52 +01:00
OBJCOPY=$(TARGET)-objcopy
OBJDUMP=$(TARGET)-objdump
2018-12-23 00:45:16 +01:00
RANLIB=$(TARGET)-gcc-ranlib
2018-11-28 03:45:52 +01:00
READELF=$(TARGET)-readelf
STRIP=$(TARGET)-strip
## Rust cross compile variables
2018-11-28 03:45:52 +01:00
export AR_$(subst -,_,$(TARGET))=$(TARGET)-ar
export CC_$(subst -,_,$(TARGET))=$(TARGET)-gcc
export CXX_$(subst -,_,$(TARGET))=$(TARGET)-g++
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