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>
5 # Disable build-in rules
9 CPPFLAGS
=-I
$(objdir
) -I
$(srcdir) @CPPFLAGS@
10 CFLAGS
=$(CPPFLAGS
) @CFLAGS@
13 DAEMON_LIBS
=@DAEMON_LIBS@
14 CLIENT_LIBS
=@CLIENT_LIBS@
21 INSTALL_PROGRAM
=@INSTALL_PROGRAM@
22 INSTALL_DATA
=@INSTALL_DATA@
24 client
=$(addprefix $(exedir
)/,@CLIENT@
)
29 exec_prefix=@
exec_prefix@
32 sysconfdir
=@sysconfdir@
33 localstatedir
=@localstatedir@
41 objdir
:= $(realpath .
)
53 docgoals
:= docs userdocs progdocs
54 testgoals
:= check test tests tests_run
55 cleangoals
:= clean distclean testsclean
56 .PHONY
: all daemon cli
$(docgoals
) $(testgoals
) $(cleangoals
) tags
62 $(daemon
): LIBS
+= $(DAEMON_LIBS
)
65 dirs
:= client conf doc
filter lib nest
test $(addprefix proto
/,$(protocols
)) @sysdep_dirs@
67 conf-y-targets
:= $(addprefix $(objdir
)/conf
/,cf-parse.y keywords.h commands.h
)
68 cf-local
= $(conf-y-targets
): $(s
)config.Y
70 src-o-files
= $(patsubst %.c
,$(o
)%.o
,$(src
))
71 tests-target-files
= $(patsubst %.c
,$(o
)%,$(tests_src
))
73 all-daemon
= $(daemon
): $(obj
)
74 all-client
= $(client
): $(obj
)
76 s
= $(dir $(lastword
$(MAKEFILE_LIST
)))
80 o
= $(patsubst $(srcdir)%,$(objdir
)%,$(s
))
85 rm -f
$(addprefix $(o
),$(1))
88 clean = $(eval
$(call clean_in
,$(1)))
90 include $(addsuffix /Makefile
,$(addprefix $(srcdir)/,$(dirs
)))
94 $(objdir
)/%.o
: $(srcdir)/%.c
$(objdir
)/.dir-stamp
$(objdir
)/sysdep
/paths.h
95 $(E
)echo CC
-o
$@
-c
$<
96 $(Q
)$(CC
) $(CFLAGS
) -MMD
-MP
-o
$@
-c
$<
98 $(objdir
)/%.o
: $(objdir
)/%.c
$(objdir
)/.dir-stamp
$(objdir
)/sysdep
/paths.h
99 $(E
)echo CC
-o
$@
-c
$<
100 $(Q
)$(CC
) $(CFLAGS
) -MMD
-MP
-o
$@
-c
$<
102 $(objdir
)/.dir-stamp
:
103 $(E
)echo MKDIR
-p
$(addprefix $(objdir
)/,$(dirs
) doc
)
104 $(Q
)mkdir
-p
$(addprefix $(objdir
)/,$(dirs
) doc
)
108 $(E
)echo LD
$(LDFLAGS
) -o
$@
$^
$(LIBS
)
109 $(Q
)$(CC
) $(LDFLAGS
) -o
$@
$^
$(LIBS
)
111 $(objdir
)/sysdep
/paths.h
: Makefile
112 echo
>$@
"/* Generated by Makefile, don't edit manually! */"
113 echo
>>$@
"#define PATH_CONFIG_FILE \"@CONFIG_FILE@\""
114 echo
>>$@
"#define PATH_CONTROL_SOCKET \"@CONTROL_SOCKET@\""
115 if
test -n
"@iproutedir@" ; then echo
>>$@
"#define PATH_IPROUTE_DIR \"@iproutedir@\"" ; fi
119 tests_targets_ok
= $(addsuffix .ok
,$(tests_targets
))
121 $(tests_targets
): %: %.o
$(tests_objs
)
122 $(E
)echo LD
$(LDFLAGS
) -o
$@
$^
$(LIBS
)
123 $(Q
)$(CC
) $(LDFLAGS
) -o
$@
$^
$(LIBS
)
125 $(tests_targets_ok
): %.ok
: %
126 $(Q
)$* 2>/dev
/null
&& touch
$*.ok
128 test: testsclean
check
129 check: tests tests_run
130 tests
: $(tests_targets
)
131 tests_run
: $(tests_targets_ok
)
133 # Finally include the computed dependencies
135 ifneq ($(filter-out $(cleangoals
),$(MAKECMDGOALS
)),)
136 -include $(shell find
$(objdir
) -name
"*.d")
139 ifeq ($(MAKECMDGOALS
),)
140 -include $(shell find
$(objdir
) -name
"*.d")
144 cd
$(srcdir) ; etags
-lc
`find $(dirs) -name *.[chY]`
149 $(INSTALL
) -d
$(DESTDIR
)/$(sbindir
) $(DESTDIR
)/$(sysconfdir
) $(DESTDIR
)/@runtimedir@
150 $(INSTALL_PROGRAM
) $(exedir
)/bird
$(DESTDIR
)/$(sbindir
)/bird
151 $(INSTALL_PROGRAM
) $(exedir
)/birdcl
$(DESTDIR
)/$(sbindir
)/birdcl
152 if
test -n
"@CLIENT@" ; then \
153 $(INSTALL_PROGRAM
) $(exedir
)/birdc
$(DESTDIR
)/$(sbindir
)/birdc
; \
155 if
! test -f
$(DESTDIR
)/@CONFIG_FILE@
; then \
156 $(INSTALL_DATA
) $(srcdir)/doc
/bird.conf.example
$(DESTDIR
)/@CONFIG_FILE@
; \
158 echo
"Not overwriting old bird.conf" ; \
162 $(INSTALL
) -d
$(DESTDIR
)/$(docdir
)
163 $(INSTALL_DATA
) $(objdir
)/doc
/{bird
,prog
}{,-*}.html
$(DESTDIR
)/$(docdir
)/
167 rm -f
$(objdir
)/sysdep
/paths.h
168 rm -f
$(addprefix $(exedir
)/,bird birdc birdcl
)
169 find
$(objdir
) -name
"*.[od]" -exec
rm -f
'{}' '+'
172 rm -f
$(tests_targets_ok
)
177 rm -f config.log config.status configure Makefile
181 rm -f config.log config.status configure Makefile