Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (47 loc) · 1.61 KB
/
Copy pathMakefile
File metadata and controls
61 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Hextrix — terminal fluid color toy
#
# make build ./hextrix
# make install copy the binary to $(PREFIX)/bin (default ~/.local/bin)
# make clean remove build artifacts
#
# Audio support is compiled in automatically when the PipeWire
# development files are available (pkg-config: libpipewire-0.3).
CC ?= cc
CSTD := -std=c11
WARN := -Wall -Wextra -Wshadow -Wpedantic
OPT ?= -O2
CFLAGS ?= $(OPT) $(CSTD) $(WARN)
CFLAGS += -D_DEFAULT_SOURCE
LDFLAGS ?=
NCURSES_CFLAGS := $(shell pkg-config --cflags ncursesw 2>/dev/null)
NCURSES_LIBS := $(shell pkg-config --libs ncursesw 2>/dev/null)
LDLIBS := $(NCURSES_LIBS) -lm
HAVE_PIPEWIRE := $(shell pkg-config --exists libpipewire-0.3 && echo 1)
ifeq ($(HAVE_PIPEWIRE),1)
# -isystem keeps the PipeWire/SPA headers (which use GNU extensions) from
# tripping -Wpedantic on our own translation units.
PIPEWIRE_CFLAGS := $(shell pkg-config --cflags libpipewire-0.3 | sed 's/-I/-isystem /g')
CFLAGS += -DHEXTRIX_HAVE_PIPEWIRE=1 $(PIPEWIRE_CFLAGS)
LDLIBS += $(shell pkg-config --libs libpipewire-0.3) -lpthread
endif
SRC := src/main.c src/grid.c src/fluid.c src/renderer.c src/input.c \
src/audio.c src/sweep.c
OBJ := $(SRC:src/%.c=build/%.o)
DEP := $(OBJ:.o=.d)
all: hextrix
hextrix: $(OBJ)
$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
build/%.o: src/%.c | build
$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
build:
mkdir -p build
clean:
rm -rf build hextrix
PREFIX ?= $(HOME)/.local
BINDIR := $(DESTDIR)$(PREFIX)/bin
install: hextrix
install -Dm755 hextrix $(BINDIR)/hextrix
uninstall:
rm -f $(BINDIR)/hextrix
-include $(DEP)
.PHONY: all clean install uninstall