mirror of
https://github.com/limine-bootloader/limine-c-template
synced 2025-09-30 23:03:22 +02:00
Add TOOLCHAIN{,_PREFIX} make options
This commit is contained in:
parent
0ea88ff820
commit
f377341e3f
2 changed files with 34 additions and 2 deletions
13
README.md
13
README.md
|
|
@ -12,6 +12,19 @@ It is recommended to build this project using a standard UNIX-like system, using
|
|||
|
||||
Additionally, building an ISO with `make all` requires `xorriso`, and building a HDD/USB image with `make all-hdd` requires `sgdisk` (usually from `gdisk` or `gptfdisk` packages) and `mtools`.
|
||||
|
||||
### Toolchain selection
|
||||
|
||||
The `TOOLCHAIN` and `TOOLCHAIN_PREFIX` `make` variables can be used to set the toolchain. `TOOLCHAIN` can be set to `llvm` to use Clang/LLVM.
|
||||
|
||||
For example:
|
||||
```
|
||||
make TOOLCHAIN=llvm
|
||||
```
|
||||
or:
|
||||
```
|
||||
make TOOLCHAIN_PREFIX=x86_64-elf-
|
||||
```
|
||||
|
||||
### Architectural targets
|
||||
|
||||
The `ARCH` make variable determines the target architecture to build the kernel and image for.
|
||||
|
|
|
|||
|
|
@ -17,11 +17,30 @@ ifeq ($(filter $(ARCH),aarch64 loongarch64 riscv64 x86_64),)
|
|||
$(error Architecture $(ARCH) not supported)
|
||||
endif
|
||||
|
||||
# User controllable toolchain and toolchain prefix.
|
||||
TOOLCHAIN :=
|
||||
TOOLCHAIN_PREFIX :=
|
||||
ifneq ($(TOOLCHAIN),)
|
||||
ifeq ($(TOOLCHAIN_PREFIX),)
|
||||
TOOLCHAIN_PREFIX := $(TOOLCHAIN)-
|
||||
endif
|
||||
endif
|
||||
|
||||
# User controllable C compiler command.
|
||||
CC := cc
|
||||
ifneq ($(TOOLCHAIN_PREFIX),)
|
||||
CC := $(TOOLCHAIN_PREFIX)gcc
|
||||
else
|
||||
CC := cc
|
||||
endif
|
||||
|
||||
# User controllable linker command.
|
||||
LD := ld
|
||||
LD := $(TOOLCHAIN_PREFIX)ld
|
||||
|
||||
# Defaults overrides for variables if using "llvm" as toolchain.
|
||||
ifeq ($(TOOLCHAIN),llvm)
|
||||
CC := clang
|
||||
LD := ld.lld
|
||||
endif
|
||||
|
||||
# User controllable C flags.
|
||||
CFLAGS := -g -O2 -pipe
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue