build: fix a whole bunch of *FLAGS

- some target_CFLAGS that needed to include AM_CFLAGS didn't do so
- libyang/sysrepo/sqlite3/confd CFLAGS + LIBS weren't used at all
- consistently use $(FOO_CFLAGS) instead of @FOO_CFLAGS@
- 2 dependencies were missing for clippy

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2019-01-30 18:11:54 +01:00
parent 68626e08f7
commit fdbd8086b1
23 changed files with 47 additions and 38 deletions

View file

@ -4,6 +4,8 @@ AUTOMAKE_OPTIONS = subdir-objects 1.12
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = \
$(LIBYANG_CFLAGS) \
$(SQLITE3_CFLAGS) \
$(UNWIND_CFLAGS) \
$(SAN_FLAGS) \
$(WERROR) \
@ -17,7 +19,6 @@ AM_LDFLAGS = \
$(SAN_FLAGS) \
# end
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DCONFDATE=$(CONFDATE)
LIBCAP = @LIBCAP@
AR_FLAGS = @AR_FLAGS@
ARFLAGS = @ARFLAGS@

View file

@ -51,4 +51,4 @@ noinst_HEADERS += \
# end
babeld_babeld_SOURCES = babeld/babel_main.c
babeld_babeld_LDADD = babeld/libbabel.a lib/libfrr.la @LIBCAP@
babeld_babeld_LDADD = babeld/libbabel.a lib/libfrr.la $(LIBCAP)

View file

@ -193,15 +193,15 @@ bgpd_bgp_btoa_SOURCES = bgpd/bgp_btoa.c
if ENABLE_BGP_VNC
bgpd_bgpd_SOURCES += bgpd/rfapi/rfapi_descriptor_rfp_utils.c
bgpd_bgpd_CFLAGS = -Irfapi -I@top_srcdir@/$(RFPINC)
bgpd_bgpd_CFLAGS = $(AM_CFLAGS) -Irfapi -I@top_srcdir@/$(RFPINC)
bgpd_bgp_btoa_SOURCES += bgpd/rfapi/rfapi_descriptor_rfp_utils.c
bgpd_bgp_btoa_CFLAGS = -Irfapi -I@top_srcdir@/$(RFPINC)
bgpd_bgp_btoa_CFLAGS = $(AM_CFLAGS) -Irfapi -I@top_srcdir@/$(RFPINC)
endif
# RFPLDADD is set in bgpd/rfp-example/librfp/subdir.am
bgpd_bgpd_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la @LIBCAP@ @LIBM@
bgpd_bgp_btoa_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la @LIBCAP@ @LIBM@
bgpd_bgpd_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBCAP) $(LIBM)
bgpd_bgp_btoa_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBCAP) $(LIBM)
bgpd_bgpd_snmp_la_SOURCES = bgpd/bgp_snmp.c
bgpd_bgpd_snmp_la_CFLAGS = $(WERROR) $(SNMP_CFLAGS) -std=gnu99

View file

@ -1600,18 +1600,21 @@ AC_SUBST([SNMP_CFLAGS])
dnl ---------------
dnl libyang
dnl ---------------
PKG_CHECK_MODULES([libyang], [libyang >= 0.16.7], , [
PKG_CHECK_MODULES([LIBYANG], [libyang >= 0.16.7], , [
AC_MSG_ERROR([libyang (>= 0.16.7) was not found on your system.])
])
ac_cflags_save="$CFLAGS"
CFLAGS="$CFLAGS $LIBYANG_CFLAGS"
AC_CHECK_MEMBER([struct lyd_node.priv], [], [
AC_MSG_ERROR([m4_normalize([
libyang needs to be compiled with ENABLE_LYD_PRIV=ON.
See http://docs.frrouting.org/projects/dev-guide/en/latest/building-libyang.html for details.])
])
], [[#include <libyang/libyang.h>]])
CFLAGS="$ac_cflags_save"
ac_libs_save="$LIBS"
LIBS="$LIBS $libyang_LIBS"
LIBS="$LIBS $LIBYANG_LIBS"
AC_CHECK_FUNC([ly_register_types], [
libyang_ext_builtin=true
AC_DEFINE([LIBYANG_EXT_BUILTIN], [1], [have ly_register_types()])
@ -1633,7 +1636,7 @@ dnl configuration rollbacks
dnl ---------------
SQLITE3=false
if test "$enable_config_rollbacks" = "yes"; then
PKG_CHECK_MODULES([sqlite3], [sqlite3], [
PKG_CHECK_MODULES([SQLITE3], [sqlite3], [
AC_DEFINE([HAVE_CONFIG_ROLLBACKS], [1], [Enable configuration rollbacks])
AC_DEFINE([HAVE_SQLITE3], [1], [Enable sqlite3 database])
SQLITE3=true
@ -1661,7 +1664,7 @@ dnl ---------------
dnl sysrepo
dnl ---------------
if test "$enable_sysrepo" = "yes"; then
PKG_CHECK_MODULES([sysrepo], [libsysrepo],
PKG_CHECK_MODULES([SYSREPO], [libsysrepo],
[AC_DEFINE([HAVE_SYSREPO], [1], [Enable sysrepo integration])
SYSREPO=true],
[SYSREPO=false

View file

@ -65,4 +65,4 @@ noinst_HEADERS += \
# end
eigrpd_eigrpd_SOURCES = eigrpd/eigrp_main.c
eigrpd_eigrpd_LDADD = eigrpd/libeigrp.a lib/libfrr.la @LIBCAP@
eigrpd_eigrpd_LDADD = eigrpd/libeigrp.a lib/libfrr.la $(LIBCAP)

View file

@ -98,7 +98,7 @@ ISIS_SOURCES = \
isisd/isis_pfpacket.c \
# end
ISIS_LDADD_COMMON = lib/libfrr.la @LIBCAP@
ISIS_LDADD_COMMON = lib/libfrr.la $(LIBCAP)
# Building isisd

View file

@ -55,4 +55,4 @@ noinst_HEADERS += \
# end
ldpd_ldpd_SOURCES = ldpd/ldpd.c
ldpd_ldpd_LDADD = ldpd/libldp.a lib/libfrr.la @LIBCAP@
ldpd_ldpd_LDADD = ldpd/libldp.a lib/libfrr.la $(LIBCAP)

View file

@ -3,7 +3,7 @@
#
lib_LTLIBRARIES += lib/libfrr.la
lib_libfrr_la_LDFLAGS = -version-info 0:0:0 -Xlinker -e_libfrr_version
lib_libfrr_la_LIBADD = @LIBCAP@ $(UNWIND_LIBS) -lyang
lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS)
lib_libfrr_la_SOURCES = \
lib/agg_table.c \
@ -116,7 +116,7 @@ vtysh_scan += \
vtysh_scan += $(top_srcdir)/lib/agentx.c
if SQLITE3
lib_libfrr_la_LIBADD += -lsqlite3
lib_libfrr_la_LIBADD += $(SQLITE3_LIBS)
lib_libfrr_la_SOURCES += lib/db.c
endif
@ -289,7 +289,7 @@ endif
lib_confd_la_CFLAGS = $(WERROR) $(CONFD_CFLAGS)
lib_confd_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
lib_confd_la_LIBADD = lib/libfrr.la -lconfd
lib_confd_la_LIBADD = lib/libfrr.la $(CONFD_LIBS)
lib_confd_la_SOURCES = lib/northbound_confd.c
#
@ -299,9 +299,9 @@ if SYSREPO
module_LTLIBRARIES += lib/sysrepo.la
endif
lib_sysrepo_la_CFLAGS = $(WERROR)
lib_sysrepo_la_CFLAGS = $(WERROR) $(SYSREPO_CFLAGS)
lib_sysrepo_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
lib_sysrepo_la_LIBADD = lib/libfrr.la -lsysrepo
lib_sysrepo_la_LIBADD = lib/libfrr.la $(SYSREPO_LIBS)
lib_sysrepo_la_SOURCES = lib/northbound_sysrepo.c
#
@ -387,11 +387,13 @@ lib/command_lex.h: lib/command_lex.c
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) "lib/command_lex.c"; else :; fi
lib/command_lex.lo: lib/command_parse.h
lib/command_parse.lo: lib/command_lex.h
lib/clippy-command_lex.$(OBJEXT): lib/command_parse.h
lib/clippy-command_parse.$(OBJEXT): lib/command_lex.h
lib/lib_clippy-command_lex.$(OBJEXT): lib/command_parse.h
lib/lib_clippy-command_parse.$(OBJEXT): lib/command_lex.h
lib/route_types.h: $(top_srcdir)/lib/route_types.txt $(top_srcdir)/lib/route_types.pl
@PERL@ $(top_srcdir)/lib/route_types.pl < $(top_srcdir)/lib/route_types.txt > $@
$(PERL) $(top_srcdir)/lib/route_types.pl < $(top_srcdir)/lib/route_types.txt > $@
DISTCLEANFILES += lib/route_types.h
if GIT_VERSION
@ -405,7 +407,7 @@ PHONY_GITVERSION=lib/gitversion.h.tmp
.SILENT: lib/gitversion.h lib/gitversion.h.tmp
GITH=lib/gitversion.h
lib/gitversion.h.tmp: $(top_srcdir)/.git
@PERL@ $(top_srcdir)/lib/gitversion.pl $(top_srcdir) > ${GITH}.tmp
$(PERL) $(top_srcdir)/lib/gitversion.pl $(top_srcdir) > ${GITH}.tmp
lib/gitversion.h: lib/gitversion.h.tmp
{ test -f ${GITH} && diff -s -q ${GITH}.tmp ${GITH}; } || cp ${GITH}.tmp ${GITH}

View file

@ -8,8 +8,8 @@ vtysh_scan += $(top_srcdir)/nhrpd/nhrp_vty.c
man8 += $(MANBUILD)/nhrpd.8
endif
nhrpd_nhrpd_LDADD = lib/libfrr.la @LIBCAP@ @CARES_LIBS@
nhrpd_nhrpd_CFLAGS = $(AM_CFLAGS) @CARES_CFLAGS@
nhrpd_nhrpd_LDADD = lib/libfrr.la $(LIBCAP) $(CARES_LIBS)
nhrpd_nhrpd_CFLAGS = $(AM_CFLAGS) $(CARES_CFLAGS)
nhrpd_nhrpd_SOURCES = \
nhrpd/linux.c \
nhrpd/netlink_arp.c \

View file

@ -73,7 +73,7 @@ noinst_HEADERS += \
ospf6d/ospf6d.h \
# end
ospf6d_ospf6d_LDADD = ospf6d/libospf6.a lib/libfrr.la @LIBCAP@
ospf6d_ospf6d_LDADD = ospf6d/libospf6.a lib/libfrr.la $(LIBCAP)
ospf6d_ospf6d_SOURCES = \
ospf6d/ospf6_main.c \
# end

View file

@ -23,7 +23,7 @@ endif
ospfclient_ospfclient_LDADD = \
ospfclient/libfrrospfapiclient.la \
@LIBCAP@ \
$(LIBCAP) \
# end
if STATIC_BIN

View file

@ -98,7 +98,7 @@ noinst_HEADERS += \
ospfd/ospf_zebra.h \
# end
ospfd_ospfd_LDADD = ospfd/libfrrospf.a lib/libfrr.la @LIBCAP@ @LIBM@
ospfd_ospfd_LDADD = ospfd/libfrrospf.a lib/libfrr.la $(LIBCAP) $(LIBM)
ospfd_ospfd_SOURCES = ospfd/ospf_main.c
ospfd_ospfd_snmp_la_SOURCES = ospfd/ospf_snmp.c

View file

@ -38,5 +38,5 @@ pbrd/pbr_debug_clippy.c: $(CLIPPY_DEPS)
pbrd/pbr_debug.$(OBJEXT): pbrd/pbr_debug_clippy.c
pbrd_pbrd_SOURCES = pbrd/pbr_main.c
pbrd_pbrd_LDADD = pbrd/libpbr.a lib/libfrr.la @LIBCAP@
pbrd_pbrd_LDADD = pbrd/libpbr.a lib/libfrr.la $(LIBCAP)

View file

@ -115,7 +115,7 @@ noinst_HEADERS += \
pimd/mtracebis_routeget.h \
# end
pimd_pimd_LDADD = pimd/libpim.a lib/libfrr.la @LIBCAP@
pimd_pimd_LDADD = pimd/libpim.a lib/libfrr.la $(LIBCAP)
pimd_pimd_SOURCES = pimd/pim_main.c
pimd_test_igmpv3_join_LDADD = lib/libfrr.la

View file

@ -44,7 +44,7 @@ noinst_HEADERS += \
ripd/ripd.h \
# end
ripd_ripd_LDADD = ripd/librip.a lib/libfrr.la @LIBCAP@
ripd_ripd_LDADD = ripd/librip.a lib/libfrr.la $(LIBCAP)
ripd_ripd_SOURCES = \
ripd/rip_main.c \
# end

View file

@ -40,7 +40,7 @@ noinst_HEADERS += \
ripngd/ripngd.h \
# end
ripngd_ripngd_LDADD = ripngd/libripng.a lib/libfrr.la @LIBCAP@
ripngd_ripngd_LDADD = ripngd/libripng.a lib/libfrr.la $(LIBCAP)
ripngd_ripngd_SOURCES = \
ripngd/ripng_main.c \
# end

View file

@ -24,5 +24,5 @@ sharpd/sharp_vty_clippy.c: $(CLIPPY_DEPS)
sharpd/sharp_vty.$(OBJEXT): sharpd/sharp_vty_clippy.c
sharpd_sharpd_SOURCES = sharpd/sharp_main.c
sharpd_sharpd_LDADD = sharpd/libsharp.a lib/libfrr.la @LIBCAP@
sharpd_sharpd_LDADD = sharpd/libsharp.a lib/libfrr.la $(LIBCAP)

View file

@ -32,4 +32,4 @@ staticd/static_vty_clippy.c: $(CLIPPY_DEPS)
staticd/static_vty.$(OBJEXT): staticd/static_vty_clippy.c
staticd_staticd_SOURCES = staticd/static_main.c
staticd_staticd_LDADD = staticd/libstatic.a lib/libfrr.la @LIBCAP@
staticd_staticd_LDADD = staticd/libstatic.a lib/libfrr.la $(LIBCAP)

View file

@ -112,10 +112,13 @@ TESTS_CPPFLAGS = $(AM_CPPFLAGS) \
-I$(top_srcdir)/tests/helpers/c \
-I$(top_builddir)/tests/helpers/c \
# end
TESTS_CFLAGS = $(SAN_FLAGS)
TESTS_CFLAGS = \
$(LIBYANG_CFLAGS) \
$(SAN_FLAGS) \
# end
# note no -Werror
ALL_TESTS_LDADD = lib/libfrr.la @LIBCAP@
ALL_TESTS_LDADD = lib/libfrr.la $(LIBCAP)
BGP_TEST_LDADD = bgpd/libbgp.a $(RFPLDADD) $(ALL_TESTS_LDADD) -lm
ISISD_TEST_LDADD = isisd/libisis.a $(ALL_TESTS_LDADD)
OSPF6_TEST_LDADD = ospf6d/libospf6.a $(ALL_TESTS_LDADD)

View file

@ -23,10 +23,10 @@ tools_permutations_SOURCES = tools/permutations.c
tools_permutations_LDADD = lib/libfrr.la
tools_gen_northbound_callbacks_SOURCES = tools/gen_northbound_callbacks.c
tools_gen_northbound_callbacks_LDADD = lib/libfrr.la -lyang
tools_gen_northbound_callbacks_LDADD = lib/libfrr.la $(LIBYANG_LIBS)
tools_gen_yang_deviations_SOURCES = tools/gen_yang_deviations.c
tools_gen_yang_deviations_LDADD = lib/libfrr.la -lyang
tools_gen_yang_deviations_LDADD = lib/libfrr.la $(LIBYANG_LIBS)
tools_ssd_SOURCES = tools/start-stop-daemon.c

View file

@ -24,7 +24,7 @@ noinst_HEADERS += \
vtysh/vtysh_user.h \
# end
vtysh_vtysh_LDADD = lib/libfrr.la @LIBCAP@ @LIBREADLINE@ @LIBS@ @LIBPAM@
vtysh_vtysh_LDADD = lib/libfrr.la $(LIBCAP) $(LIBREADLINE) $(LIBS) $(LIBPAM)
AM_V_EXTRACT = $(am__v_EXTRACT_$(V))
am__v_EXTRACT_ = $(am__v_EXTRACT_$(AM_DEFAULT_VERBOSITY))

View file

@ -13,7 +13,7 @@ noinst_HEADERS += \
watchfrr/watchfrr_errors.h \
# end
watchfrr_watchfrr_LDADD = lib/libfrr.la @LIBCAP@
watchfrr_watchfrr_LDADD = lib/libfrr.la $(LIBCAP)
watchfrr_watchfrr_SOURCES = \
watchfrr/watchfrr.c \
watchfrr/watchfrr_errors.c \

View file

@ -8,7 +8,7 @@ else
libyang_plugins_LTLIBRARIES += yang/libyang_plugins/frr_user_types.la
endif
yang_libyang_plugins_frr_user_types_la_CFLAGS = $(WERROR)
yang_libyang_plugins_frr_user_types_la_CFLAGS = $(WERROR) $(LIBYANG_CFLAGS)
yang_libyang_plugins_frr_user_types_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
yang_libyang_plugins_frr_user_types_la_LIBADD =
yang_libyang_plugins_frr_user_types_la_SOURCES = yang/libyang_plugins/frr_user_types.c