summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile22
1 files changed, 17 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 750b1d9..eae0a77 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,30 @@
BIN=pa-sink-ctl
-OBJS=pa-sink-ctl.o interface.o sink.o sink_input.o
+SRCS=interface.c sink.c sink_input.c pa-sink-ctl.c
+
+OBJS=$(SRCS:%.c=%.o)
+HEADS=$(SRCS:%.c=%.h)
CC=gcc
CFLAGS=-std=c99 -Wall -Werror -pedantic
LDFLAGS=-lncurses -lpulse -lform
-all: $(BIN)
-.PHONY: all
+DEPENDFILE=.depend
+
+all: $(DEPENDFILE) $(BIN)
+.PHONY: all clean
$(BIN): $(OBJS)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS)
-%.o: %.c %.h
+%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
+$(DEPENDFILE): $(SRCS) $(HEADS)
+ $(CC) -MM $(SRCS) > $(DEPENDFILE)
+
+-include $(DEPENDFILE)
+
clean:
- rm -f $(BIN) $(OBJS)
+ rm -f $(OBJS) $(DEPENDFILE)
+distclean: clean
+ rm -f $(BIN)