]> git.ipfire.org Git - thirdparty/bird.git/blob - Makefile.in
RPKI protocol with one cache server per protocol
[thirdparty/bird.git] / Makefile.in
1 # Makefile for the BIRD Internet Routing Daemon
2 # (c) 1999--2000 Martin Mares <mj@ucw.cz>
3 # (c) 2016 Jan Moskyto Matejka <mq@ucw.cz>
4
5 # Disable build-in rules
6 MAKEFLAGS += -r
7
8 # Variable definitions
9 CPPFLAGS=-I$(objdir) -I$(srcdir) @CPPFLAGS@
10 CFLAGS=$(CPPFLAGS) @CFLAGS@
11 LDFLAGS=@LDFLAGS@
12 LIBS=@LIBS@
13 DAEMON_LIBS=@DAEMON_LIBS@
14 CLIENT_LIBS=@CLIENT_LIBS@
15 CC=@CC@
16 M4=@M4@
17 BISON=@BISON@
18 FLEX=@FLEX@
19 RANLIB=@RANLIB@
20 INSTALL=@INSTALL@
21 INSTALL_PROGRAM=@INSTALL_PROGRAM@
22 INSTALL_DATA=@INSTALL_DATA@
23
24 client=$(addprefix $(exedir)/,@CLIENT@)
25 daemon=$(exedir)/bird
26 protocols = @protocols@
27
28 prefix=@prefix@
29 exec_prefix=@exec_prefix@
30 bindir=@bindir@
31 sbindir=@sbindir@
32 sysconfdir=@sysconfdir@
33 localstatedir=@localstatedir@
34 docdir=@prefix@/doc
35
36 srcdir := @srcdir@
37 objdir := @objdir@
38 exedir := @exedir@
39
40 ifeq ($(objdir),.)
41 objdir := $(realpath .)
42 endif
43
44 ifeq ($(VERBOSE),)
45 E:=@
46 Q:=@
47 else
48 E:=@\#
49 Q:=
50 endif
51
52 # Meta rules
53 cleangoals := clean distclean
54 docgoals := docs userdocs progdocs
55 .PHONY: all daemon cli $(cleangoals) $(docgoals) tags
56 all: daemon cli
57
58 daemon: $(daemon)
59 cli: $(client)
60
61 $(daemon): LIBS += $(DAEMON_LIBS)
62
63 # Include directories
64 dirs := client conf doc filter lib nest $(addprefix proto/,$(protocols)) @sysdep_dirs@
65
66 conf-y-targets := $(addprefix $(objdir)/conf/,cf-parse.y keywords.h commands.h)
67 cf-local = $(conf-y-targets): $(s)config.Y
68
69 src-o-files = $(patsubst %.c,$(o)%.o,$(src))
70
71 all-daemon = $(exedir)/bird: $(obj)
72 all-client = $(exedir)/birdc $(exedir)/birdcl: $(obj)
73
74 s = $(dir $(lastword $(MAKEFILE_LIST)))
75 ifeq ($(srcdir),.)
76 o = $(objdir)/$(s)
77 else
78 o = $(patsubst $(srcdir)%,$(objdir)%,$(s))
79 endif
80
81 define clean_in =
82 clean::
83 rm -f $(addprefix $(o),$(1))
84 endef
85
86 clean = $(eval $(call clean_in,$(1)))
87
88 include $(addsuffix /Makefile,$(addprefix $(srcdir)/,$(dirs)))
89
90 # Generic rules
91
92 $(objdir)/%.o: $(srcdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
93 $(E)echo CC -o $@ -c $<
94 $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
95
96 $(objdir)/%.o: $(objdir)/%.c $(objdir)/.dir-stamp $(objdir)/sysdep/paths.h
97 $(E)echo CC -o $@ -c $<
98 $(Q)$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
99
100 $(objdir)/.dir-stamp:
101 $(E)echo MKDIR -p $(addprefix $(objdir)/,$(dirs) doc)
102 $(Q)mkdir -p $(addprefix $(objdir)/,$(dirs) doc)
103 $(Q)touch $@
104
105 $(client) $(daemon):
106 $(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
107 $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
108
109 $(objdir)/sysdep/paths.h: Makefile
110 echo >$@ "/* Generated by Makefile, don't edit manually! */"
111 echo >>$@ "#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
112 echo >>$@ "#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
113 if test -n "@iproutedir@" ; then echo >>$@ "#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
114
115 # Finally include the computed dependencies
116
117 ifneq ($(filter-out $(cleangoals),$(MAKECMDGOALS)),)
118 -include $(shell find $(objdir) -name "*.d")
119 endif
120
121 ifeq ($(MAKECMDGOALS),)
122 -include $(shell find $(objdir) -name "*.d")
123 endif
124
125 tags:
126 cd $(srcdir) ; etags -lc `find $(dirs) -name *.[chY]`
127
128 # Install
129
130 install: all
131 $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
132 $(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird
133 $(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl
134 if test -n "@CLIENT@" ; then \
135 $(INSTALL_PROGRAM) $(exedir)/birdc $(DESTDIR)/$(sbindir)/birdc ; \
136 fi
137 if ! test -f $(DESTDIR)/@CONFIG_FILE@ ; then \
138 $(INSTALL_DATA) $(srcdir)/doc/bird.conf.example $(DESTDIR)/@CONFIG_FILE@ ; \
139 else \
140 echo "Not overwriting old bird.conf" ; \
141 fi
142
143 install-docs:
144 $(INSTALL) -d $(DESTDIR)/$(docdir)
145 $(INSTALL_DATA) $(objdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/
146
147 # Cleanup
148 clean::
149 rm -f $(objdir)/sysdep/paths.h
150 rm -f $(addprefix $(exedir)/,bird birdc birdcl)
151 find $(objdir) -name "*.[od]" -exec rm -f '{}' '+'
152
153 ifeq ($(objdir),obj)
154 distclean: clean
155 rm -rf $(objdir)
156 rm -f config.log config.status configure Makefile
157 else
158 distclean: clean
159 rm -rf * .dir-stamp
160 rm -f config.log config.status configure Makefile
161 endif