summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <benjaminfranzke@googlemail.com>2010-07-08 23:21:50 +0200
committerben <benjaminfranzke@googlemail.com>2010-07-08 23:21:50 +0200
commit70103f0b4c7b750487b959eb00f2345665ba5d28 (patch)
tree33928a30cc27c3c2f4ade0c34ea1d3180ed8ad74
parent7a66e48912923921f8e5c46c08d3445d80f2e321 (diff)
downloadpa-sink-ctl-70103f0b4c7b750487b959eb00f2345665ba5d28.tar.gz
pa-sink-ctl-70103f0b4c7b750487b959eb00f2345665ba5d28.tar.bz2
pa-sink-ctl-70103f0b4c7b750487b959eb00f2345665ba5d28.zip
makefile: add dynamic dependencies for make-rules
-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)