2020-01-08 16:08:15 +00:00
|
|
|
CONFIG_MUSL ?= y
|
|
|
|
|
2018-03-16 16:59:24 +00:00
|
|
|
ifeq "$(MUSL_CROSS_ONCE)" ""
|
|
|
|
MUSL_CROSS_ONCE := 1
|
2020-01-08 16:08:15 +00:00
|
|
|
modules-$(CONFIG_MUSL) += musl-cross
|
|
|
|
|
2020-01-16 17:30:48 +00:00
|
|
|
musl-cross_version := 38e52db8358c043ae82b346a2e6e66bc86a53bc1
|
2020-01-08 16:08:15 +00:00
|
|
|
musl-cross_dir := musl-cross-$(musl-cross_version)
|
|
|
|
musl-cross_url := https://github.com/richfelker/musl-cross-make/archive/$(musl-cross_version).tar.gz
|
|
|
|
musl-cross_tar := musl-cross-$(musl-cross_version).tar.gz
|
|
|
|
musl-cross_hash := b4b85d6d3ddab0f2b8650a53e775673f8c346fa2fb07d652a9880bd206ade100
|
2018-03-16 16:59:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
ifneq "$(CROSS)" ""
|
|
|
|
|
|
|
|
# check that $(CROSS)gcc exists or else things just won't work
|
|
|
|
ifneq "y" "$(shell [ -x '$(CROSS)gcc' ] && echo y)"
|
2018-03-16 17:37:24 +00:00
|
|
|
$(error $(CROSS)gcc does not exist - can not build)
|
2020-01-08 16:08:15 +00:00
|
|
|
else
|
|
|
|
$(info Using $(CROSS)gcc)
|
2018-03-16 16:59:24 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# The cross compiler has already been built, so the musl-cross target
|
2020-01-08 16:08:15 +00:00
|
|
|
# is a NOP. We really don't need to check out this code tree, but it is easier
|
|
|
|
# if we have a target for it.
|
|
|
|
musl-cross_target := --version
|
2017-01-31 17:45:42 +00:00
|
|
|
|
2020-01-08 16:08:15 +00:00
|
|
|
# Ask the compiler where to find its own libc.so
|
|
|
|
musl-cross_libraries := \
|
|
|
|
$(shell $(CROSS)gcc --print-file-name=libc.so) \
|
2018-05-02 18:30:58 +00:00
|
|
|
|
2018-03-16 16:59:24 +00:00
|
|
|
else
|
|
|
|
|
2021-07-18 17:34:20 +00:00
|
|
|
# Force a full build of the cross compiler for target platform
|
|
|
|
# No need to build i386 for x86 since coreboot uses its own compiler
|
2020-01-08 16:08:15 +00:00
|
|
|
musl-cross_configure := \
|
2021-07-18 17:34:20 +00:00
|
|
|
/bin/echo -e >> Makefile 'musl-target:' ; \
|
|
|
|
/bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET="$(MUSL_ARCH)-linux-musl" install' ;
|
2017-01-31 17:45:42 +00:00
|
|
|
|
2021-07-22 22:25:55 +00:00
|
|
|
CROSS_PATH ?= $(pwd)/crossgcc/$(CONFIG_TARGET_ARCH)
|
2018-03-16 19:18:13 +00:00
|
|
|
|
2020-01-08 16:08:15 +00:00
|
|
|
musl-cross_target := \
|
|
|
|
OUTPUT="$(CROSS_PATH)" \
|
|
|
|
MAKE="$(MAKE)" \
|
2021-07-18 17:38:35 +00:00
|
|
|
$(MAKE_JOBS) \
|
2021-07-18 17:34:20 +00:00
|
|
|
"musl-target"
|
2017-01-31 17:45:42 +00:00
|
|
|
|
2021-07-18 17:34:20 +00:00
|
|
|
CROSS := $(CROSS_PATH)/bin/$(subst -,_,$(MUSL_ARCH))-linux-musl-
|
|
|
|
musl-cross_libraries := $(CROSS_PATH)/$(subst -,_,$(MUSL_ARCH))-linux-musl/lib/libc.so
|
2018-03-16 16:59:24 +00:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
2020-01-08 16:08:15 +00:00
|
|
|
|
|
|
|
musl-cross_output := $(CROSS)gcc
|
|
|
|
|
|
|
|
## Fake a target so that musl will force a header install by the
|
|
|
|
## Linux kernel sources.
|
|
|
|
$(build)/$(musl-cross_dir)/.build: $(INSTALL)/include/linux/limits.h
|
|
|
|
|
2017-01-31 17:45:42 +00:00
|
|
|
|
2018-03-16 16:59:24 +00:00
|
|
|
endif
|