From 20d90dd9dd4bbff5fc0ef779a434aebbaeec24a1 Mon Sep 17 00:00:00 2001
From: Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
Date: Thu, 5 Jun 2014 09:35:27 +0000
Subject: [PATCH] updated Makefile for new Doxygen setup simplified dependency
 autogeneration

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@51 8ec27952-4edc-4aab-86aa-e87bb2611832
---
 Makefile | 50 ++++++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index 916c622f8..76d9d4c2a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,38 +1,44 @@
 TARGETS = server send receive random test
+SRCS = server.c send.c receive.c random.c node.c path.c utils.c msg.c cfg.c if.c
 
-SRCS = server.c send.c receive.c random.c node.c path.c utils.c msg.c cfg.c caps.c
-VPATH = src
-
-CC = gcc
-RM = rm -f
-
-GIT_TAG = $(shell git describe --tags  --abbrev=0)
-GIT_REV = $(shell git rev-parse --short HEAD)
-
-V ?= 4
-
-LDFLAGS = -pthread -lrt -lm -lconfig -lnl-3 -lnl-route-3
-CFLAGS = -g -std=c99 -Iinclude/ -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DV=$(V)
-CFLAGS += -D__GIT_REV__='"$(GIT_REV)"' -D__GIT_TAG__='"$(GIT_TAG)"'
-
-.PHONY: all clean doc
-
+# Default target: build everything
 all: $(TARGETS)
 
-server: node.o msg.o utils.o path.o cfg.o caps.o
+# Dependencies for individual binaries
+server: node.o msg.o utils.o path.o cfg.o
 send: node.o msg.o utils.o
 receive: node.o msg.o utils.o
 random: node.o msg.o utils.o
 test: node.o msg.o utils.o
 
-%.d: %.c
-	$(CC) -MM $(CFLAGS) $< -o $@
+VPATH = src
+
+CC = gcc
+RM = rm -f
+DOXY = doxygen
+
+# Debug level (if not set via 'make V=?')
+V ?= 6
+
+# Some details about the compiled version
+GIT_TAG = $(shell git describe --tags --abbrev=0)
+GIT_REV = $(shell git rev-parse --short HEAD)
+
+# Compiler and Linker flags
+LDFLAGS = -pthread -lrt -lm -lconfig -lcap
+CFLAGS = -g -std=c99 -Iinclude/ -MMD
+CFLAGS += -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -DV=$(V)
+CFLAGS += -D__GIT_REV__='"$(GIT_REV)"' -D__GIT_TAG__='"$(GIT_TAG)"'
+
+.PHONY: all clean doc
 
 clean:
 	$(RM) *~ *.o *.d
 	$(RM) $(TARGETS)
 
 doc:
-	$(MAKE) -C $@
+	$(DOXY)
+	$(MAKE) -C doc/latex
 
--include $(SRCS:.c=.d)
+# Include auto-generated dependencies
+-include $(wildcard *.d)