summaryrefslogtreecommitdiffstats
path: root/tools/Makefile.in
blob: 556eba5fa2f863a005952940dc5b6afbbe711831 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Makefile for the BIRD Internet Routing Daemon
# (c) 1999--2000 Martin Mares <mj@ucw.cz>

include Rules

.PHONY: all daemon client subdir depend clean distclean tags docs userdocs progdocs

all: sysdep/paths.h .dep-stamp subdir daemon @CLIENT@

daemon: $(exedir)/bird

client: $(exedir)/birdc

bird-dep := $(addsuffix /all.o, $(static-dirs)) conf/all.o lib/birdlib.a

$(bird-dep): sysdep/paths.h .dep-stamp subdir

birdc-dep := client/all.o lib/birdlib.a

$(birdc-dep): sysdep/paths.h .dep-stamp subdir

depend: sysdep/paths.h .dir-stamp
	set -e ; for a in $(dynamic-dirs) ; do $(MAKE) -C $$a $@ ; done
	set -e ; for a in $(static-dirs) $(client-dirs) ; do $(MAKE) -C $$a -f $(srcdir_abs)/$$a/Makefile $@ ; done

subdir: sysdep/paths.h .dir-stamp .dep-stamp
	set -e ; for a in $(dynamic-dirs) ; do $(MAKE) -C $$a $@ ; done
	set -e ; for a in $(static-dirs) $(client-dirs) ; do $(MAKE) -C $$a -f $(srcdir_abs)/$$a/Makefile $@ ; done

$(exedir)/bird: $(bird-dep)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

$(exedir)/birdc: $(birdc-dep)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS) $(CLIENT_LIBS)

.dir-stamp: sysdep/paths.h
	mkdir -p $(static-dirs) $(client-dirs) $(doc-dirs)
	touch .dir-stamp

.dep-stamp:
	$(MAKE) depend
	touch .dep-stamp

docs: userdocs progdocs

userdocs progdocs: .dir-stamp
	$(MAKE) -C doc -f $(srcdir_abs)/doc/Makefile $@

sysdep/paths.h:
	echo >sysdep/paths.h "/* Generated by Makefile, don't edit manually! */"
	echo >>sysdep/paths.h "#define PATH_CONFIG_DIR \"$(sysconfdir)\""
	echo >>sysdep/paths.h "#define PATH_CONTROL_SOCKET_DIR \"$(localstatedir)/run\""
	if test -n "@iproutedir@" ; then echo >>sysdep/paths.h "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi

tags:
	cd $(srcdir) ; etags -lc `find $(static-dirs) $(addprefix $(objdir)/,$(dynamic-dirs)) $(client-dirs) -name *.[chY]`

install: all
	$(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/$(localstatedir)/run
	$(INSTALL_PROGRAM) -s $(exedir)/bird $(DESTDIR)/$(sbindir)/bird@SUFFIX6@
	if test -n "@CLIENT@" ; then								\
		$(INSTALL_PROGRAM) -s $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc@SUFFIX6@ ;				\
	fi
	if ! test -f $(DESTDIR)/$(sysconfdir)/bird@SUFFIX6@.conf ; then						\
		$(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/$(sysconfdir)/bird@SUFFIX6@.conf ;	\
	else											\
		echo "Not overwriting old bird@SUFFIX@.conf" ;						\
	fi

install-docs:
	$(INSTALL) -d $(DESTDIR)/$(docdir)
	$(INSTALL_DATA) $(srcdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/

clean:
	find . -name "*.[oa]" -o -name core -o -name depend -o -name "*.html" | xargs rm -f
	rm -f conf/cf-lex.c conf/cf-parse.* conf/commands.h conf/keywords.h
	rm -f $(exedir)/bird $(exedir)/birdc $(exedir)/bird.ctl $(exedir)/bird6.ctl .dep-stamp

distclean: clean
	rm -f config.* configure sysdep/autoconf.h sysdep/paths.h Makefile Rules
	rm -rf .dir-stamp $(clean-dirs)