summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 38dfa13b3fd0ee889067909951e93c0df61f9ff8 (plain) (blame)
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
CC = clang
CFLAGS = -I src -g
LDLIBS = -lcurses -lreadline -lmpdclient
WARNFLAGS = -Wno-pragma-once-outside-header

SRCS = $(wildcard src/*.c)
OBJS = $(SRCS:src/%.c=build/%.o)
DEPS = $(OBJS:%.o=%.d)

.PHONY: all tmus clean install uninstall

all: tmus

clean:
	rm tmus

build:
	mkdir build

build/%.o: src/%.c build/%.d
	@echo DEPS: $^
	$(CC) -c -o $@ $< $(CFLAGS)

build/main.d: src/main.c | build
	$(CC) -c -MT build/main.o -MMD -MP -MF $@ $<

build/%.d: src/%.c src/%.h | build
	$(CC) -c -MT build/$*.o -MMD -MP -MF $@ $^ $(WARNFLAGS)

-include $(DEPS)

tmus: $(OBJS)
	$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)

install:
	install -m 755 tmus /usr/bin

uninstall:
	rm /usr/bin/tmus