From 59b458a2f7fd9c65150fb5d8042dcc142e92b3f1 Mon Sep 17 00:00:00 2001 From: Olaf Rempel Date: Sun, 2 Nov 2008 13:15:57 +0100 Subject: [PATCH] update Makefile --- Makefile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index de5e6aa..6189b23 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,22 @@ -CFLAGS := -O2 -pipe -Wall +TARGET = torrent-stats -OBJS := configfile.o connection.o event.o httpd.o linebuffer.o logging.o sockaddr.o tcpsocket.o +CFLAGS = -Wall -O2 -MD -MP -MF $(*F).d -all: torrent-stats +# ------ -torrent-stats: $(OBJS) torrent-stats.o - $(CC) $(CFLAGS) $^ -o $@ +SRC := $(wildcard *.c) + +all: $(TARGET) + +$(TARGET): $(SRC:.c=.o) + @echo " Linking file: $@" + @$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) > /dev/null %.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ - -%.d: %.c - $(CC) $(CFLAGS) -MM -c $< -o $@ + @echo " Building file: $<" + @$(CC) -c $(CFLAGS) $< -o $@ clean: - rm -f torrent-stats *.d *.o *.log + rm -rf $(TARGET) *.o *.d -DEPS := $(wildcard *.c) --include $(DEPS:.c=.d) +-include $(shell find -name *.d 2> /dev/null)