userspace/libc_test: add native build target and default toolchain configuration

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-01-28 11:37:45 +02:00
parent 9c9f5549d7
commit cbe651d2da
No known key found for this signature in database
GPG Key ID: 2EE20AF089811A5A

View File

@ -16,7 +16,18 @@ build: $(FILENAME).elf
# Use static linking
LDFLAGS += -static -fno-pic -fno-pie -Wl,-static
$(FILENAME).elf: $(OBJ)
# Use default toolchain if not specified
CC ?= gcc
CXX ?= g++
AS ?= as
build_native: $(FILENAME)_n.elf
run_native:
$(MAKE) --quiet -j $(shell nproc) build_native
./$(FILENAME)_n.elf
$(FILENAME)_n.elf $(FILENAME).elf: $(OBJ)
$(info Linking $@)
$(CC) $(LDFLAGS) $(SYSROOT) $(OBJ) -o $@
@ -33,4 +44,4 @@ $(FILENAME).elf: $(OBJ)
$(AS) -o $@ $<
clean:
rm -f $(OBJ) $(FILENAME).elf
rm -f $(OBJ) $(FILENAME).elf $(FILENAME)_n.elf