Makefile handles libpipewire

This commit is contained in:
Emile Clark-Boman 2025-09-03 14:57:16 +10:00
parent 426b2765f6
commit 19403f79ab
2 changed files with 30 additions and 8 deletions

View file

@ -6,7 +6,8 @@ include config.mk
BIN := bin
BUILD := build
LIB := lib
PATHS := $(BUILD) $(BIN) $(LIB)
LDLIBS := -lm -lc -lpipewire-0.3
# Macro definitions
define mkbin
@ -19,19 +20,21 @@ define mklib
$(addprefix $(LIB)/,$1)
endef
all: $(PATHS) $(BIN)/pw-test
all: $(BUILD) $(BIN) $(BIN)/pw-test
$(BIN)/pw-test: $(call mklib, main.c)
$(CC) $(CFLAGS) -o $(BUILD)/pw-test.o -c $^
$(LD) -o $@ $(BUILD)/pw-test.o
$(LD) $(LDFLAGS) $(LDLIBS) -o $@ $(BUILD)/pw-test.o
$(PATHS):
$(BUILD) $(BIN):
mkdir -p $@
.PHONY: run
run:
command $(BIN)/pw-test
.PHONY: test
test: clean all run
.PHONY: clean
clean:
rm -rf $(BUILD) $(BIN) compile_commands.json