-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (41 loc) · 1.26 KB
/
Makefile
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
CFLAGS = -Isrc $(shell pkg-config --cflags playerctl) -O2 -pedantic -Wall -Wextra -Wno-sign-compare -std=gnu99
LIBS = -lm $(shell pkg-config --libs playerctl)
OBJS := bin/main.o bin/node.o bin/swaybar.o \
bin/date.o bin/network.o bin/ram.o bin/sysfs.o \
bin/player.o
TESTS_OBJS := bin/tests/main.o bin/tests/player.o bin/tests/llist.o \
bin/debug/node.o bin/debug/player.o
all: bin/nowhere-status bin/tests/check
tests: bin/tests/check
bin/tests/check
.PHONY:
clean:
rm -r bin
# Compile binary rules
.DELETE_ON_ERROR:
bin/nowhere-status: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(LIBS) -o $@
.DELETE_ON_ERROR:
bin/tests/check: $(TESTS_OBJS)
$(CC) $(CFLAGS) $(TESTS_OBJS) $(LIBS) -lcheck -o $@
# Compile object rules
.DELETE_ON_ERROR:
bin/%.o: src/%.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
.DELETE_ON_ERROR:
bin/%.o: src/modules/%.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
.DELETE_ON_ERROR:
bin/debug/%.o: src/%.c
mkdir -p $(dir $@)
$(CC) -Isrc -std=gnu99 -Wall -DDEBUG -c $< -o $@
.DELETE_ON_ERROR:
bin/debug/%.o: src/modules/%.c
mkdir -p $(dir $@)
$(CC) -Isrc -std=gnu99 -Wall -DDEBUG $(shell pkg-config --cflags playerctl) -c $< -o $@
.DELETE_ON_ERROR:
bin/tests/%.o: tests/%.c
mkdir -p $(dir $@)
$(CC) -Isrc -std=gnu99 -Wall -DDEBUG -c $< -o $@