summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 23 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 08cc8bc..38dfa13 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,11 @@
-CFLAGS = -I . -g
+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
@@ -8,10 +14,22 @@ all: tmus
clean:
rm tmus
-%.o: %.c %.h
- $(CC) -c -o $@ $< $(CFLAGS) $(LDLIBS)
+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 $@ $<
-tmus: main.c util.o history.o list.o player.o tag.o track.o listnav.o ref.o
+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:
@@ -19,3 +37,4 @@ install:
uninstall:
rm /usr/bin/tmus
+