From df9cfc3be55bf6195d24f06c0f057dc16b4d375d Mon Sep 17 00:00:00 2001 From: Christiano Haesbaert Date: Fri, 18 Jul 2025 15:16:22 +0200 Subject: [PATCH] Autodetect musl Instead of passing EXTRA_LDFLAGS=-lfts, just detect it and adjust it. Makes me happier when developing on my other machine. --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aaf4d900..82de6969 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,16 @@ else $(error unsupported architecture $(ARCH)) endif +# Check if we are in a musl system +ifeq ($(shell ldd --version 2>&1|head -n1|grep -q ^musl && echo yes), yes) + MUSL?=1 +endif + +# Musl doesn't have fts, but distributions provide a libfts +ifdef MUSL +EXTRA_LDFLAGS+= -lfts +endif + ifeq ($(V),1) Q = msg = @@ -287,7 +297,7 @@ alpine: alpine-image clean-all $(call msg,ALPINE-DOCKER-RUN,Dockerfile) $(Q)$(DOCKER) run \ $(ALPINE_RUN_ARGS) $(SHELL) \ - -c "make -C $(PWD) all initramfs.gz EXTRA_LDFLAGS=-lfts" + -c "make -C $(PWD) all initramfs.gz" alpine-image: clean-all $(call msg,ALPINE-IMAGE,Dockerfile.alpine)