From cbe651d2da2db9cc89677d2225b11265c4befae4 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Tue, 28 Jan 2025 11:37:45 +0200 Subject: [PATCH] userspace/libc_test: add native build target and default toolchain configuration Signed-off-by: EnderIce2 --- Userspace/apps/test/libc_test/Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Userspace/apps/test/libc_test/Makefile b/Userspace/apps/test/libc_test/Makefile index 13dee6ab..c8546db8 100644 --- a/Userspace/apps/test/libc_test/Makefile +++ b/Userspace/apps/test/libc_test/Makefile @@ -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