dorne/Makefile

40 lines
644 B
Makefile

.DEFAULT_GOAL := all
include config.mk
# === BUILD ENVIRONMENT ===
BIN := bin
BUILD := build
LIB := lib
LDLIBS := -lm -lc -lpipewire-0.3
# Macro definitions
define mkbin
$(addprefix $(BIN)/,$1)
endef
define mkbuild
$(addprefix $(BUILD)/,$1)
endef
define mklib
$(addprefix $(LIB)/,$1)
endef
all: $(BUILD) $(BIN) $(BIN)/pw-test
$(BIN)/pw-test: $(call mklib, main.c)
$(CC) $(CFLAGS) -o $(BUILD)/pw-test.o -c $^
$(LD) $(LDFLAGS) $(LDLIBS) -o $@ $(BUILD)/pw-test.o
$(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