diff --git a/tools/Makefile b/tools/Makefile index c76db7b..870bf77 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -3,7 +3,7 @@ objects ?= $(sources:.c=.o) ivc_demo_object ?= ivc_demo.o rpmsg_demo_object ?= rpmsg_demo.o hvisor_objects ?= $(filter-out $(ivc_demo_object) $(rpmsg_demo_object), $(objects)) -ROOT ?= / +ROOT ?= # gnu or musl LIBC ?= gnu @@ -31,7 +31,13 @@ else toolchain := $(CCARCH)-linux-$(LIBC) endif -CFLAGS := -Wall -Wextra -DLOG_USE_COLOR -DHLOG=$(LOG) --sysroot=$(ROOT) +CFLAGS := -Wall -Wextra -DLOG_USE_COLOR -DHLOG=$(LOG) -pthread + +# Conditionally add sysroot if ROOT is set +# Otherwise use default flags from cross-compiler +ifneq ($(ROOT),) +CFLAGS += --sysroot=$(ROOT) +endif include_dirs := -I../include -I./include -I../cJSON @@ -39,7 +45,7 @@ ifeq ($(LIBC), musl) include_dirs += -I./compat/ endif -LDFLAGS := -lpthread +LDFLAGS := -lpthread -static # LIBS := -L$(ROOT)/usr/lib/$(toolchain) -L$(ROOT)/lib # LIBS := -L/opt/aarch64-linux-musl-cross/aarch64-linux-musl -L/opt/aarch64-linux-musl-cross/lib