Changed #include <x/y> 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.
This commit is contained in:
Martin Mares 1998-04-28 14:39:34 +00:00
parent c40e05a0df
commit 1feea03e74
14 changed files with 48 additions and 24 deletions

View file

@ -2,15 +2,16 @@
# (c) 1998 Martin Mares <mj@ucw.cz> # (c) 1998 Martin Mares <mj@ucw.cz>
TOPDIR=$(shell pwd) 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= PROTOCOLS=
DIRS=sysdep/linux nest $(protocols) lib DIRS=sysdep/linux nest $(PROTOCOLS) lib
ARCHS=$(join $(addsuffix /,$(DIRS)),$(subst /,_,$(addsuffix .a,$(DIRS)))) ARCHS=$(join $(addsuffix /,$(DIRS)),$(subst /,_,$(addsuffix .a,$(DIRS))))
export export
all: all-dirs bird all: .dep all-dirs bird
all-dirs: all-dirs:
set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a ; done set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a ; done
@ -18,6 +19,13 @@ all-dirs:
bird: $(ARCHS) bird: $(ARCHS)
$(CC) $(LDFLAGS) -o $@ $^ $(CC) $(LDFLAGS) -o $@ $^
.dep:
$(MAKE) dep
touch .dep
dep:
set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a dep ; done
clean: clean:
rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core` rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core -or -name .depend`
rm -f bird rm -f bird .dep

17
Rules
View file

@ -4,9 +4,26 @@
THISDIR=$(shell pwd) THISDIR=$(shell pwd)
RELDIR=$(subst $(TOPDIR)/,,$(THISDIR)) RELDIR=$(subst $(TOPDIR)/,,$(THISDIR))
ANAME=$(subst /,_,$(RELDIR)).a ANAME=$(subst /,_,$(RELDIR)).a
SRCS=$(subst .o,.c,$(OBJS))
all: $(ANAME) all: $(ANAME)
$(ANAME): $(OBJS) $(ANAME): $(OBJS)
rm -f $(ANAME) rm -f $(ANAME)
ar rcs $(ANAME) $(OBJS) 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

View file

@ -10,9 +10,9 @@
#define _BIRD_IP_H_ #define _BIRD_IP_H_
#ifndef IPV6 #ifndef IPV6
#include <lib/ipv4.h> #include "ipv4.h"
#else #else
#include <lib/ipv6.h> #include "ipv6.h"
#endif #endif
#endif #endif

View file

@ -18,7 +18,7 @@ typedef struct ipv4_addr {
#define _I(x) (x).addr #define _I(x) (x).addr
#define _MI(x) ((struct ip_addr) { x }) #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_equal(x,y) (_I(x) == _I(y))
#define ipa_and(x,y) _MI(_I(x) & _I(y)) #define ipa_and(x,y) _MI(_I(x) & _I(y))

View file

@ -8,8 +8,8 @@
#define _BIRD_LISTS_C_ #define _BIRD_LISTS_C_
#include <nest/bird.h> #include "nest/bird.h"
#include <lib/lists.h> #include "lib/lists.h"
LIST_INLINE void LIST_INLINE void
add_tail(list *l, node *n) add_tail(list *l, node *n)

View file

@ -9,7 +9,7 @@
#ifndef _BIRD_RESOURCE_H_ #ifndef _BIRD_RESOURCE_H_
#define _BIRD_RESOURCE_H_ #define _BIRD_RESOURCE_H_
#include <lib/lists.h> #include "lib/lists.h"
/* Resource */ /* Resource */

View file

@ -9,7 +9,7 @@
#ifndef _BIRD_SOCKET_H_ #ifndef _BIRD_SOCKET_H_
#define _BIRD_SOCKET_H_ #define _BIRD_SOCKET_H_
#include <lib/resource.h> #include "lib/resource.h"
typedef struct birdsock socket; typedef struct birdsock socket;

View file

@ -9,7 +9,7 @@
#ifndef _BIRD_TIMER_H_ #ifndef _BIRD_TIMER_H_
#define _BIRD_TIMER_H_ #define _BIRD_TIMER_H_
#include <lib/resource.h> #include "lib/resource.h"
typedef struct timer { typedef struct timer {
resource r; resource r;

View file

@ -9,9 +9,9 @@
#ifndef _BIRD_BIRD_H_ #ifndef _BIRD_BIRD_H_
#define _BIRD_BIRD_H_ #define _BIRD_BIRD_H_
#include <sysdep/config.h> #include "sysdep/config.h"
#include <lib/birdlib.h> #include "lib/birdlib.h"
#include <lib/ip.h> #include "lib/ip.h"
extern u32 router_id; /* Our Router ID */ extern u32 router_id; /* Our Router ID */
extern u16 this_as; /* Our Autonomous System Number */ extern u16 this_as; /* Our Autonomous System Number */

View file

@ -9,7 +9,7 @@
#ifndef _BIRD_IFACE_H_ #ifndef _BIRD_IFACE_H_
#define _BIRD_IFACE_H_ #define _BIRD_IFACE_H_
#include <lib/lists.h> #include "lib/lists.h"
struct iface { struct iface {
node n; node n;

View file

@ -6,10 +6,9 @@
* Can be freely distributed and used under the terms of the GNU GPL. * Can be freely distributed and used under the terms of the GNU GPL.
*/ */
#include <nest/bird.h> #include "nest/bird.h"
#include <lib/lists.h> #include "lib/lists.h"
#include "lib/resource.h"
#include <nest/resource.h>
int int
main(void) main(void)

View file

@ -9,7 +9,7 @@
#ifndef _BIRD_PROTOCOL_H_ #ifndef _BIRD_PROTOCOL_H_
#define _BIRD_PROTOCOL_H_ #define _BIRD_PROTOCOL_H_
#include <lib/resource.h> #include "lib/resource.h"
/* /*
* Routing Protocol * Routing Protocol

View file

@ -9,7 +9,7 @@
#ifndef _BIRD_ROUTE_H_ #ifndef _BIRD_ROUTE_H_
#define _BIRD_ROUTE_H_ #define _BIRD_ROUTE_H_
#include <lib/resource.h> #include "lib/resource.h"
/* /*
* Generic data structure for storing network prefixes. Also used * Generic data structure for storing network prefixes. Also used

View file

@ -9,7 +9,7 @@
/* System-dependent configuration */ /* System-dependent configuration */
#include <sysdep/cf/linux-20.h> #include "sysdep/cf/linux-20.h"
/* Include debugging code */ /* Include debugging code */