summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: b0fee6217a6dcc4ef3d624ba0b414d12ed4a9386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Makefile for the BIRD Internet Routing Daemon
# (c) 1998 Martin Mares <mj@ucw.cz>

TOPDIR=$(shell pwd)
OBJDIR=obj

CPPFLAGS=-I$(TOPDIR)/$(OBJDIR) -I$(TOPDIR)
OPT=-O2
DEBUG=-g#gdb
CFLAGS=$(OPT) $(DEBUG) -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses

PROTOCOLS=rip static
LIBDIRS=sysdep/linux sysdep/unix lib
BASEDIRS=nest $(addprefix proto/,$(PROTOCOLS))
STDDIRS=$(BASEDIRS) $(OBJDIR)/conf
DIRS=$(STDDIRS) $(OBJDIR)/lib
PARTOBJS=$(join $(addsuffix /,$(STDDIRS)),$(subst /,_,$(addsuffix .o,$(STDDIRS))))
LIBS=$(OBJDIR)/lib/birdlib.a

export

all: .dep all-dirs bird

all-dirs:
	set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a this ; done

bird: $(PARTOBJS) $(LIBS)
	$(CC) $(LDFLAGS) -o $@ $^

.dep:
	$(MAKE) dep

dep:
	mkdir -p $(OBJDIR)
	tools/mergedirs $(OBJDIR) $(LIBDIRS)
#	for a in $(STDDIRS) ; do mkdir -p $(OBJDIR)/$$a ; done
	set -e ; for a in $(DIRS) ; do $(MAKE) -C $$a dep ; done
	touch .dep

clean:
	rm -rf obj
	rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core -or -name .depend -or -name .#*`
	rm -f bird .dep