
The help in "make -C tools" enumerates nolibc as a valid target so we must at least make it do something. Let's make it do the equivalent of "make headers" in that it will prepare a sysroot with the arch's headers, but will not install the kernel's headers. This is the minimum some tools will need when built with a full-blown toolchain anyway. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
59 lines
1.8 KiB
Makefile
59 lines
1.8 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# Makefile for nolibc installation and tests
|
|
include ../../scripts/Makefile.include
|
|
|
|
# we're in ".../tools/include/nolibc"
|
|
ifeq ($(srctree),)
|
|
srctree := $(patsubst %/tools/include/,%,$(dir $(CURDIR)))
|
|
endif
|
|
|
|
# when run as make -C tools/ nolibc_<foo> the arch is not set
|
|
ifeq ($(ARCH),)
|
|
include $(srctree)/scripts/subarch.include
|
|
ARCH = $(SUBARCH)
|
|
endif
|
|
|
|
# OUTPUT is only set when run from the main makefile, otherwise
|
|
# it defaults to this nolibc directory.
|
|
OUTPUT ?= $(CURDIR)/
|
|
|
|
ifeq ($(V),1)
|
|
Q=
|
|
else
|
|
Q=@
|
|
endif
|
|
|
|
nolibc_arch := $(patsubst arm64,aarch64,$(ARCH))
|
|
arch_file := arch-$(nolibc_arch).h
|
|
all_files := ctype.h errno.h nolibc.h signal.h std.h stdio.h stdlib.h string.h \
|
|
sys.h time.h types.h unistd.h
|
|
|
|
# install all headers needed to support a bare-metal compiler
|
|
all: headers
|
|
|
|
# Note: when ARCH is "x86" we concatenate both x86_64 and i386
|
|
headers:
|
|
$(Q)mkdir -p $(OUTPUT)sysroot
|
|
$(Q)mkdir -p $(OUTPUT)sysroot/include
|
|
$(Q)cp $(all_files) $(OUTPUT)sysroot/include/
|
|
$(Q)if [ "$(ARCH)" = "x86" ]; then \
|
|
sed -e \
|
|
's,^#ifndef _NOLIBC_ARCH_X86_64_H,#if !defined(_NOLIBC_ARCH_X86_64_H) \&\& defined(__x86_64__),' \
|
|
arch-x86_64.h; \
|
|
sed -e \
|
|
's,^#ifndef _NOLIBC_ARCH_I386_H,#if !defined(_NOLIBC_ARCH_I386_H) \&\& !defined(__x86_64__),' \
|
|
arch-i386.h; \
|
|
elif [ -e "$(arch_file)" ]; then \
|
|
cat $(arch_file); \
|
|
else \
|
|
echo "Fatal: architecture $(ARCH) not yet supported by nolibc." >&2; \
|
|
exit 1; \
|
|
fi > $(OUTPUT)sysroot/include/arch.h
|
|
|
|
headers_standalone: headers
|
|
$(Q)$(MAKE) -C $(srctree) headers
|
|
$(Q)$(MAKE) -C $(srctree) headers_install INSTALL_HDR_PATH=$(OUTPUT)sysroot
|
|
|
|
clean:
|
|
$(call QUIET_CLEAN, nolibc) rm -rf "$(OUTPUT)sysroot"
|