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
|
2024-11-06 13:03:42 +00:00
|
|
|
modules-$(CONFIG_MUSL) += musl-cross-make
|
2020-01-08 16:08:15 +00:00
|
|
|
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_version := fd6be58297ee21fcba89216ccd0d4aca1e3f1c5c
|
|
|
|
musl-cross-make_dir := musl-cross-make-$(musl-cross-make_version)
|
|
|
|
musl-cross-make_url := https://github.com/richfelker/musl-cross-make/archive/$(musl-cross-make_version).tar.gz
|
|
|
|
musl-cross-make_tar := musl-cross-make-$(musl-cross-make_version).tar.gz
|
|
|
|
musl-cross-make_hash := 15b8e0a287d738a46e069e90d67a8d96213b357b79aaf3e8cf0cd40e4b230d9e
|
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
|
|
|
|
|
2024-11-06 13:03:42 +00:00
|
|
|
# The cross compiler has already been built, so the musl-cross-make 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.
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_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
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_libraries := \
|
2020-01-08 16:08:15 +00:00
|
|
|
$(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
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_configure := \
|
2023-01-11 02:36:11 +00:00
|
|
|
echo -e >> Makefile 'musl-target:' ; \
|
|
|
|
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
|
|
|
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_target := \
|
2020-01-08 16:08:15 +00:00
|
|
|
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-
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_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
|
|
|
|
2024-11-06 13:03:42 +00:00
|
|
|
musl-cross-make_output := $(CROSS)gcc
|
2020-01-08 16:08:15 +00:00
|
|
|
|
|
|
|
## Fake a target so that musl will force a header install by the
|
|
|
|
## Linux kernel sources.
|
2024-11-06 13:03:42 +00:00
|
|
|
$(build)/$(musl-cross-make_dir)/.build: $(INSTALL)/include/linux/limits.h
|
2020-01-08 16:08:15 +00:00
|
|
|
|
2017-01-31 17:45:42 +00:00
|
|
|
|
2018-03-16 16:59:24 +00:00
|
|
|
endif
|