Fixed UNAME_S undefined in Makefile; refactoring audio library linking.
h3rald h3rald@h3rald.com
Fri, 31 Jul 2026 15:13:02 +0200
1 files changed,
5 insertions(+),
7 deletions(-)
jump to
M
Makefile
→
Makefile
@@ -5,6 +5,9 @@
SOURCES = xyw.c xywasm.c xywrun.c devices/system.c devices/terminal.c devices/clock.c devices/file.c devices/beeper.c OBJS = xyw.o xywasm.o xywrun.o devices/system.o devices/terminal.o devices/clock.o devices/file.o devices/beeper.o +UNAME_S := $(shell uname -s) +HAVE_ALSA := $(shell echo '\#include <alsa/asoundlib.h>' | $(CC) -E - >/dev/null 2>&1 && echo 1) + # beeper.c picks its audio backend at compile time via #ifdef, so the only # thing the Makefile needs to do is link the matching system library. ifeq ($(OS),Windows_NT)@@ -12,14 +15,9 @@ BIN := xyw.exe
LDFLAGS += -lwinmm else ifeq ($(UNAME_S),Darwin) LDFLAGS += -framework AudioToolbox -framework CoreFoundation -else ifeq ($(UNAME_S),Linux) +else ifeq ($(HAVE_ALSA),1) # Only link -lasound if the ALSA headers are actually installed - # (libasound2-dev). Mirrors the __has_include check in beeper.c, which - # falls back to the OSS backend when they're missing. - HAVE_ALSA := $(shell echo '\#include <alsa/asoundlib.h>' | $(CC) -E - >/dev/null 2>&1 && echo 1) - ifeq ($(HAVE_ALSA),1) - LDFLAGS += -lasound - endif + LDFLAGS += -lasound # Fallback to libossaudio else ifeq ($(HAVE_OSSAUDIO),1) LDLIBS += -lossaudio