mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Splitting out BIRD static library for linking to other tools
This commit is contained in:
parent
971d651268
commit
cda025a1fa
27
Makefile.in
27
Makefile.in
@ -12,7 +12,8 @@ LDFLAGS=@LDFLAGS@
|
|||||||
M4FLAGS=@M4FLAGS@
|
M4FLAGS=@M4FLAGS@
|
||||||
BISONFLAGS=@BISONFLAGS@
|
BISONFLAGS=@BISONFLAGS@
|
||||||
LIBS=@LIBS@
|
LIBS=@LIBS@
|
||||||
DAEMON_LIBS=@DAEMON_LIBS@
|
COMMON_LIBS=@COMMON_LIBS@
|
||||||
|
DAEMON_LIBS=@DAEMON_LIBS@ $(COMMON_LIBS)
|
||||||
CLIENT_LIBS=@CLIENT_LIBS@
|
CLIENT_LIBS=@CLIENT_LIBS@
|
||||||
CC=@CC@
|
CC=@CC@
|
||||||
M4=@M4@
|
M4=@M4@
|
||||||
@ -25,6 +26,7 @@ INSTALL_DATA=@INSTALL_DATA@
|
|||||||
|
|
||||||
client=$(addprefix $(exedir)/,@CLIENT@)
|
client=$(addprefix $(exedir)/,@CLIENT@)
|
||||||
daemon=$(exedir)/bird
|
daemon=$(exedir)/bird
|
||||||
|
common-lib=$(objdir)/libbird.o.txt
|
||||||
protocols=@protocols@
|
protocols=@protocols@
|
||||||
PROTO_BUILD := $(protocols) dev kif krt
|
PROTO_BUILD := $(protocols) dev kif krt
|
||||||
|
|
||||||
@ -88,6 +90,7 @@ tests-target-files = $(patsubst %.c,$(o)%,$(tests_src))
|
|||||||
|
|
||||||
all-daemon = $(daemon): $(obj)
|
all-daemon = $(daemon): $(obj)
|
||||||
all-client = $(client): $(obj)
|
all-client = $(client): $(obj)
|
||||||
|
all-lib = $(common-lib): $(obj)
|
||||||
|
|
||||||
s = $(dir $(lastword $(MAKEFILE_LIST)))
|
s = $(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
ifeq ($(srcdir),.)
|
ifeq ($(srcdir),.)
|
||||||
@ -156,9 +159,24 @@ $(objdir)/.dir-stamp: Makefile
|
|||||||
$(Q)mkdir -p $(addprefix $(objdir)/,$(dirs) doc)
|
$(Q)mkdir -p $(addprefix $(objdir)/,$(dirs) doc)
|
||||||
$(Q)touch $@
|
$(Q)touch $@
|
||||||
|
|
||||||
|
# Composing static library; older GCC's and linkers somehow fail
|
||||||
|
# both with partial linking with LTO and also with static library creation,
|
||||||
|
# thus we just collect all the deps and add them to the final build
|
||||||
|
$(common-lib):
|
||||||
|
$(E)echo TXT $^ > $@
|
||||||
|
$(Q)echo $^ > $@
|
||||||
|
# Some time in future, somebody may want to try the following recipe again
|
||||||
|
# $(E)echo LD $(LDFLAGS) -r -o $@ $^
|
||||||
|
# +$(Q)$(CC) $(LDFLAGS) -r -o $@ $^
|
||||||
|
|
||||||
|
# The lib must be linked last
|
||||||
|
$(daemon): $(common-lib)
|
||||||
|
|
||||||
|
#$(warning $(patsubst $(common-lib),$(shell cat $(common-lib)),whatever obj/libbird.o.txt))
|
||||||
|
|
||||||
$(client) $(daemon):
|
$(client) $(daemon):
|
||||||
$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
+$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
+$(Q)$(CC) $(LDFLAGS) -o $@ $(patsubst $(common-lib),$(shell cat $(common-lib)),$^) $(LIBS)
|
||||||
|
|
||||||
$(objdir)/sysdep/paths.h: Makefile
|
$(objdir)/sysdep/paths.h: Makefile
|
||||||
$(E)echo GEN $@
|
$(E)echo GEN $@
|
||||||
@ -171,9 +189,9 @@ $(objdir)/sysdep/paths.h: Makefile
|
|||||||
|
|
||||||
tests_targets_ok = $(addsuffix .ok,$(tests_targets))
|
tests_targets_ok = $(addsuffix .ok,$(tests_targets))
|
||||||
|
|
||||||
$(tests_targets): %: %.o $(tests_objs) | prepare
|
$(tests_targets): %: %.o $(tests_objs) $(common-lib) | prepare
|
||||||
$(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
|
$(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
|
||||||
+$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
|
+$(Q)$(CC) $(LDFLAGS) -o $@ $(patsubst $(common-lib),$(shell cat $(common-lib)),$^) $(LIBS)
|
||||||
|
|
||||||
# Hack to avoid problems with tests linking everything
|
# Hack to avoid problems with tests linking everything
|
||||||
$(tests_targets): LIBS += $(DAEMON_LIBS)
|
$(tests_targets): LIBS += $(DAEMON_LIBS)
|
||||||
@ -222,6 +240,7 @@ install-docs:
|
|||||||
clean::
|
clean::
|
||||||
rm -f $(objdir)/sysdep/paths.h $(objdir)/nest/proto-build.c
|
rm -f $(objdir)/sysdep/paths.h $(objdir)/nest/proto-build.c
|
||||||
rm -f $(addprefix $(exedir)/,bird birdc birdcl)
|
rm -f $(addprefix $(exedir)/,bird birdc birdcl)
|
||||||
|
rm -f $(common-lib)
|
||||||
find $(objdir) -name "*.[od]" -exec rm -f '{}' '+'
|
find $(objdir) -name "*.[od]" -exec rm -f '{}' '+'
|
||||||
|
|
||||||
testsclean:
|
testsclean:
|
||||||
|
13
configure.ac
13
configure.ac
@ -137,7 +137,7 @@ BIRD_CHECK_PTHREADS
|
|||||||
|
|
||||||
if test "$bird_cv_lib_pthreads" = yes ; then
|
if test "$bird_cv_lib_pthreads" = yes ; then
|
||||||
CFLAGS="$CFLAGS -pthread"
|
CFLAGS="$CFLAGS -pthread"
|
||||||
LDFLAGS="$LDFLAGS -pthread"
|
COMMON_LIBS="$COMMON_LIBS -pthread"
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([POSIX threads not available.])
|
AC_MSG_ERROR([POSIX threads not available.])
|
||||||
fi
|
fi
|
||||||
@ -180,9 +180,13 @@ AC_MSG_RESULT([$CFLAGS])
|
|||||||
AC_MSG_CHECKING([LDFLAGS])
|
AC_MSG_CHECKING([LDFLAGS])
|
||||||
AC_MSG_RESULT([$LDFLAGS])
|
AC_MSG_RESULT([$LDFLAGS])
|
||||||
|
|
||||||
|
DAEMON_LIBS="${DAEMON_LIBS} ${LIBS}"
|
||||||
|
AC_SUBST(DAEMON_LIBS)
|
||||||
|
AC_SUBST(COMMON_LIBS)
|
||||||
|
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_RANLIB
|
|
||||||
AC_CHECK_PROG([FLEX], [flex], [flex])
|
AC_CHECK_PROG([FLEX], [flex], [flex])
|
||||||
AC_CHECK_PROG([BISON], [bison], [bison])
|
AC_CHECK_PROG([BISON], [bison], [bison])
|
||||||
AC_CHECK_PROGS([M4], [gm4 m4])
|
AC_CHECK_PROGS([M4], [gm4 m4])
|
||||||
@ -276,16 +280,13 @@ fi
|
|||||||
|
|
||||||
AC_SUBST([iproutedir])
|
AC_SUBST([iproutedir])
|
||||||
|
|
||||||
DAEMON_LIBS=
|
|
||||||
AC_SUBST(DAEMON_LIBS)
|
|
||||||
|
|
||||||
if test "$enable_libssh" != no ; then
|
if test "$enable_libssh" != no ; then
|
||||||
AC_CHECK_HEADER([libssh/libssh.h], [true], [fail=yes], [ ])
|
AC_CHECK_HEADER([libssh/libssh.h], [true], [fail=yes], [ ])
|
||||||
AC_CHECK_LIB([ssh], [ssh_connect], [true], [fail=yes])
|
AC_CHECK_LIB([ssh], [ssh_connect], [true], [fail=yes])
|
||||||
|
|
||||||
if test "$fail" != yes ; then
|
if test "$fail" != yes ; then
|
||||||
AC_DEFINE([HAVE_LIBSSH], [1], [Define to 1 if you have the `ssh' library (-lssh).])
|
AC_DEFINE([HAVE_LIBSSH], [1], [Define to 1 if you have the `ssh' library (-lssh).])
|
||||||
DAEMON_LIBS="-lssh $DAEMON_LIBS"
|
COMMON_LIBS="-lssh $COMMON_LIBS"
|
||||||
enable_libssh=yes
|
enable_libssh=yes
|
||||||
else
|
else
|
||||||
if test "$enable_libssh" = yes ; then
|
if test "$enable_libssh" = yes ; then
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
src := a-path.c a-set.c bitmap.c bitops.c blake2s.c blake2b.c checksum.c defer.c event.c flowspec.c idm.c ip.c lists.c lockfree.c mac.c md5.c mempool.c net.c netindex.c patmatch.c printf.c rcu.c resource.c runtime.c sha1.c sha256.c sha512.c slab.c slists.c strtoul.c tbf.c timer.c xmalloc.c
|
src := bitmap.c bitops.c blake2s.c blake2b.c checksum.c defer.c event.c flowspec.c idm.c ip.c lists.c lockfree.c mac.c md5.c mempool.c net.c netindex.c patmatch.c printf.c rcu.c resource.c runtime.c sha1.c sha256.c sha512.c slab.c slists.c strtoul.c tbf.c timer.c xmalloc.c
|
||||||
|
obj := $(src-o-files)
|
||||||
|
$(all-lib)
|
||||||
|
|
||||||
|
src := a-path.c a-set.c
|
||||||
obj := $(src-o-files)
|
obj := $(src-o-files)
|
||||||
$(all-daemon)
|
$(all-daemon)
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
src := cli.c cmds.c iface.c iface-cli.c locks.c mpls.c neighbor.c password.c proto.c proto-build.c rt-attr.c rt-dev.c rt-export.c rt-fib.c rt-show.c rt-table.c
|
src := iface.c neighbor.c
|
||||||
|
obj := $(src-o-files)
|
||||||
|
$(all-lib)
|
||||||
|
|
||||||
|
src := cli.c cmds.c iface-cli.c locks.c mpls.c password.c proto.c proto-build.c rt-attr.c rt-dev.c rt-export.c rt-fib.c rt-show.c rt-table.c
|
||||||
obj := $(src-o-files)
|
obj := $(src-o-files)
|
||||||
$(all-daemon)
|
$(all-daemon)
|
||||||
$(cf-local)
|
$(cf-local)
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
src := alloc.c io.c io-cli.c io-loop.c krt.c log.c main.c random.c domain.c socket.c file.c time.c
|
src := alloc.c domain.c file.c io-loop.c log.c socket.c random.c time.c
|
||||||
|
obj := $(src-o-files)
|
||||||
|
$(all-lib)
|
||||||
|
|
||||||
|
src := io.c io-cli.c krt.c main.c
|
||||||
obj := $(src-o-files)
|
obj := $(src-o-files)
|
||||||
$(all-daemon)
|
$(all-daemon)
|
||||||
$(cf-local)
|
$(cf-local)
|
||||||
|
Loading…
Reference in New Issue
Block a user