Makefile handles libpipewire
This commit is contained in:
parent
426b2765f6
commit
19403f79ab
2 changed files with 30 additions and 8 deletions
11
Makefile
11
Makefile
|
|
@ -6,7 +6,8 @@ include config.mk
|
||||||
BIN := bin
|
BIN := bin
|
||||||
BUILD := build
|
BUILD := build
|
||||||
LIB := lib
|
LIB := lib
|
||||||
PATHS := $(BUILD) $(BIN) $(LIB)
|
|
||||||
|
LDLIBS := -lm -lc -lpipewire-0.3
|
||||||
|
|
||||||
# Macro definitions
|
# Macro definitions
|
||||||
define mkbin
|
define mkbin
|
||||||
|
|
@ -19,19 +20,21 @@ define mklib
|
||||||
$(addprefix $(LIB)/,$1)
|
$(addprefix $(LIB)/,$1)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
all: $(PATHS) $(BIN)/pw-test
|
all: $(BUILD) $(BIN) $(BIN)/pw-test
|
||||||
$(BIN)/pw-test: $(call mklib, main.c)
|
$(BIN)/pw-test: $(call mklib, main.c)
|
||||||
$(CC) $(CFLAGS) -o $(BUILD)/pw-test.o -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 $@
|
mkdir -p $@
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run:
|
run:
|
||||||
command $(BIN)/pw-test
|
command $(BIN)/pw-test
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: clean all run
|
test: clean all run
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD) $(BIN) compile_commands.json
|
rm -rf $(BUILD) $(BIN) compile_commands.json
|
||||||
|
|
|
||||||
27
config.mk
27
config.mk
|
|
@ -1,4 +1,23 @@
|
||||||
# === C Compiler+Linker ===
|
# === C Compiler COnfiguration ===
|
||||||
LD = ld
|
COMPILER := gcc
|
||||||
CC = gcc
|
CFLAGS :=
|
||||||
CFLAGS =
|
LDFLAGS :=
|
||||||
|
|
||||||
|
# === Nix Mutations ===
|
||||||
|
ifdef NIX_PATH
|
||||||
|
|
||||||
|
ifdef NIX_CC
|
||||||
|
# TODO: will using the Nix gcc-wrapper break Bear?
|
||||||
|
override COMPILER := $(NIX_CC)/bin/gcc
|
||||||
|
endif # NIX_CC
|
||||||
|
|
||||||
|
# flake.nix adds NIX_CFLAGS_COMPILER/DORNE_LDFLAGS to env
|
||||||
|
CFLAGS += $(NIX_CFLAGS_COMPILE)
|
||||||
|
LDFLAGS += $(DORNE_LDFLAGS)
|
||||||
|
|
||||||
|
endif # NIX_PATH
|
||||||
|
|
||||||
|
|
||||||
|
# C Compiler+Linker Commands
|
||||||
|
CC = $$([ -x "$$(command -v bear)" ] && echo 'bear -- ') $(COMPILER)
|
||||||
|
LD = $(COMPILER)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue