From 1feea03e7463d8eaeb00d5df6c2cd3e8e20f2bcd Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 28 Apr 1998 14:39:34 +0000 Subject: Changed #include to #include "x/y" for our local includes, so that gcc -MM can be used to separate them from the system ones. Added automatic generation of dependencies. --- Makefile | 18 +++++++++++++----- Rules | 17 +++++++++++++++++ lib/ip.h | 4 ++-- lib/ipv4.h | 2 +- lib/lists.c | 4 ++-- lib/resource.h | 2 +- lib/socket.h | 2 +- lib/timer.h | 2 +- nest/bird.h | 6 +++--- nest/iface.h | 2 +- nest/main.c | 7 +++---- nest/protocol.h | 2 +- nest/route.h | 2 +- sysdep/config.h | 2 +- 14 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 0c62fe5..77f9ee1 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,16 @@ # (c) 1998 Martin Mares TOPDIR=$(shell pwd) -CFLAGS=-O2 -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses -I$(TOPDIR) +CPPFLAGS=-I$(TOPDIR) +CFLAGS=-O2 -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses $(CPPFLAGS) PROTOCOLS= -DIRS=sysdep/linux nest $(protocols) lib +DIRS=sysdep/linux nest $(PROTOCOLS) lib ARCHS=$(join $(addsuffix /,$(DIRS)),$(subst /,_,$(addsuffix .a,$(DIRS)))) export -all: all-dirs bird +all: .dep all-dirs bird all-dirs: set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a ; done @@ -18,6 +19,13 @@ all-dirs: bird: $(ARCHS) $(CC) $(LDFLAGS) -o $@ $^ +.dep: + $(MAKE) dep + touch .dep + +dep: + set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a dep ; done + clean: - rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core` - rm -f bird + rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core -or -name .depend` + rm -f bird .dep diff --git a/Rules b/Rules index f6baacd..a0a1418 100644 --- a/Rules +++ b/Rules @@ -4,9 +4,26 @@ THISDIR=$(shell pwd) RELDIR=$(subst $(TOPDIR)/,,$(THISDIR)) ANAME=$(subst /,_,$(RELDIR)).a +SRCS=$(subst .o,.c,$(OBJS)) all: $(ANAME) $(ANAME): $(OBJS) rm -f $(ANAME) ar rcs $(ANAME) $(OBJS) + +ifdef OBJS + +dep: $(SRCS) + rm -f .depend + for a in $(SRCS) ; do gcc $(CPPFLAGS) -MM $$a >>.depend ; done + +else + +dep: + +endif + +ifneq ($(wildcard .depend),) +include .depend +endif diff --git a/lib/ip.h b/lib/ip.h index cd12ded..dc4f8b8 100644 --- a/lib/ip.h +++ b/lib/ip.h @@ -10,9 +10,9 @@ #define _BIRD_IP_H_ #ifndef IPV6 -#include +#include "ipv4.h" #else -#include +#include "ipv6.h" #endif #endif diff --git a/lib/ipv4.h b/lib/ipv4.h index e5c1e8c..4b8c44c 100644 --- a/lib/ipv4.h +++ b/lib/ipv4.h @@ -18,7 +18,7 @@ typedef struct ipv4_addr { #define _I(x) (x).addr #define _MI(x) ((struct ip_addr) { x }) -#define IPA_NONE(_MI(0)) +#define IPA_NONE (_MI(0)) #define ipa_equal(x,y) (_I(x) == _I(y)) #define ipa_and(x,y) _MI(_I(x) & _I(y)) diff --git a/lib/lists.c b/lib/lists.c index 321a5f0..55c2b0f 100644 --- a/lib/lists.c +++ b/lib/lists.c @@ -8,8 +8,8 @@ #define _BIRD_LISTS_C_ -#include -#include +#include "nest/bird.h" +#include "lib/lists.h" LIST_INLINE void add_tail(list *l, node *n) diff --git a/lib/resource.h b/lib/resource.h index a1d229e..eabc963 100644 --- a/lib/resource.h +++ b/lib/resource.h @@ -9,7 +9,7 @@ #ifndef _BIRD_RESOURCE_H_ #define _BIRD_RESOURCE_H_ -#include +#include "lib/lists.h" /* Resource */ diff --git a/lib/socket.h b/lib/socket.h index 4f68a16..f1c9a64 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -9,7 +9,7 @@ #ifndef _BIRD_SOCKET_H_ #define _BIRD_SOCKET_H_ -#include +#include "lib/resource.h" typedef struct birdsock socket; diff --git a/lib/timer.h b/lib/timer.h index 29f20c4..506e3c9 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -9,7 +9,7 @@ #ifndef _BIRD_TIMER_H_ #define _BIRD_TIMER_H_ -#include +#include "lib/resource.h" typedef struct timer { resource r; diff --git a/nest/bird.h b/nest/bird.h index 062e5fd..b9c9192 100644 --- a/nest/bird.h +++ b/nest/bird.h @@ -9,9 +9,9 @@ #ifndef _BIRD_BIRD_H_ #define _BIRD_BIRD_H_ -#include -#include -#include +#include "sysdep/config.h" +#include "lib/birdlib.h" +#include "lib/ip.h" extern u32 router_id; /* Our Router ID */ extern u16 this_as; /* Our Autonomous System Number */ diff --git a/nest/iface.h b/nest/iface.h index 7b85ece..aa8a135 100644 --- a/nest/iface.h +++ b/nest/iface.h @@ -9,7 +9,7 @@ #ifndef _BIRD_IFACE_H_ #define _BIRD_IFACE_H_ -#include +#include "lib/lists.h" struct iface { node n; diff --git a/nest/main.c b/nest/main.c index 8f60f27..8c26938 100644 --- a/nest/main.c +++ b/nest/main.c @@ -6,10 +6,9 @@ * Can be freely distributed and used under the terms of the GNU GPL. */ -#include -#include - -#include +#include "nest/bird.h" +#include "lib/lists.h" +#include "lib/resource.h" int main(void) diff --git a/nest/protocol.h b/nest/protocol.h index adca114..848feca 100644 --- a/nest/protocol.h +++ b/nest/protocol.h @@ -9,7 +9,7 @@ #ifndef _BIRD_PROTOCOL_H_ #define _BIRD_PROTOCOL_H_ -#include +#include "lib/resource.h" /* * Routing Protocol diff --git a/nest/route.h b/nest/route.h index 9e9ef7a..b3f0063 100644 --- a/nest/route.h +++ b/nest/route.h @@ -9,7 +9,7 @@ #ifndef _BIRD_ROUTE_H_ #define _BIRD_ROUTE_H_ -#include +#include "lib/resource.h" /* * Generic data structure for storing network prefixes. Also used diff --git a/sysdep/config.h b/sysdep/config.h index e83a508..a17f4d1 100644 --- a/sysdep/config.h +++ b/sysdep/config.h @@ -9,7 +9,7 @@ /* System-dependent configuration */ -#include +#include "sysdep/cf/linux-20.h" /* Include debugging code */ -- cgit v1.2.3