[Babel-users] [PATCH 1/6] Improve Makefile
Dave Taht
dave.taht at gmail.com
Thu Mar 9 15:54:58 UTC 2017
From: Dave Taht <dave at taht.net>
- Add INCLUDES variable for headers
- Add support for tags and TAGS
- create "reallyclean" to get rid of tags, TAGS, gmon.out, cscope.out
- remove TAGs and gmon.out from "clean"
- Add full and correct dependencies on internal headers
---
Makefile | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 9b98eb8..9454b1a 100644
--- a/Makefile
+++ b/Makefile
@@ -17,14 +17,53 @@ OBJS = babeld.o net.o kernel.o util.o interface.o source.o neighbour.o \
route.o xroute.o message.o resend.o configuration.o local.o \
disambiguation.o rule.o
+INCLUDES = babeld.h net.h kernel.c util.h interface.h source.h neighbour.h \
+ route.h xroute.h message.h resend.h configuration.h local.h \
+ disambiguation.h rule.h version.h
+
+KFILES = kernel_netlink.c kernel_socket.c
+
babeld: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o babeld $(OBJS) $(LDLIBS)
-babeld.o: babeld.c version.h
+babeld.o: babeld.c $(INCLUDES)
+
+local.o: local.c local.h version.h babeld.h interface.h source.h neighbour.h \
+ kernel.h xroute.h route.h util.h configuration.h
+
+kernel.o: kernel_netlink.c kernel_socket.c kernel.h babeld.h
+
+configuration.o: configuration.c babeld.h util.h route.h kernel.h \
+ configuration.h rule.h
+
+disambiguation.o: disambiguation.c babeld.h util.h route.h kernel.h \
+ disambiguation.h interface.h rule.h
+
+interface.o: interface.c babeld.h util.h route.h kernel.h local.h \
+ interface.h neighbour.h message.h configuration.h xroute.h
+
+message.o: message.c babeld.h util.h net.h interface.h source.h neighbour.h \
+ route.h kernel.h xroute.h resend.h configuration.h
+
+neighbour.o: neighbour.c babeld.h util.h interface.h source.h route.h \
+ neighbour.h message.h resend.h local.h
-local.o: local.c version.h
+net.o: net.c net.h babeld.h util.h
-kernel.o: kernel_netlink.c kernel_socket.c
+resend.o: resend.c babeld.h util.h neighbour.h message.h interface.h \
+ resend.h configuration.h
+
+route.o: route.c babeld.h util.h kernel.h interface.h source.h neighbour.h \
+ route.h xroute.h message.h configuration.h local.h disambiguation.h
+
+rule.o: rule.c babeld.h util.h kernel.h configuration.h rule.h
+
+source.o: source.c babeld.h util.h interface.h route.h source.h
+
+util.o: util.c babeld.h util.h
+
+xroute.o: xroute.c babeld.h kernel.h neighbour.h message.h route.h util.h \
+ xroute.h configuration.h interface.h local.h
version.h:
./generate-version.sh > version.h
@@ -36,10 +75,16 @@ version.h:
babeld.html: babeld.man
-.PHONY: all install install.minimal uninstall clean
+.PHONY: all install install.minimal uninstall clean reallyclean
all: babeld babeld.man
+TAGS: $(SRCS) $(INCLUDES) $(KFILES)
+ etags $(SRCS) $(INCLUDES) $(KFILES)
+
+tags: $(SRCS) $(INCLUDES) $(KFILES)
+ ctags $(SRCS) $(INCLUDES) $(KFILES)
+
install.minimal: babeld
-rm -f $(TARGET)$(PREFIX)/bin/babeld
mkdir -p $(TARGET)$(PREFIX)/bin
@@ -54,4 +99,7 @@ uninstall:
-rm -f $(TARGET)$(MANDIR)/man8/babeld.8
clean:
- -rm -f babeld babeld.html version.h *.o *~ core TAGS gmon.out
+ -rm -f babeld babeld.html version.h *.o *~ core
+
+reallyclean: clean
+ -rm -f TAGS tags gmon.out cscope.out
--
2.7.4
More information about the Babel-users
mailing list