#
# bgpd
#

if BGPD
noinst_LIBRARIES += bgpd/libbgp.a
sbin_PROGRAMS += bgpd/bgpd
noinst_PROGRAMS += bgpd/bgp_btoa

vtysh_daemons += bgpd

if SNMP
module_LTLIBRARIES += bgpd/bgpd_snmp.la
endif
if RPKI
module_LTLIBRARIES += bgpd/bgpd_rpki.la
endif
if BGP_BMP
module_LTLIBRARIES += bgpd/bgpd_bmp.la
endif
man8 += $(MANBUILD)/frr-bgpd.8
endif

bgpd_libbgp_a_SOURCES = \
	bgpd/bgp_addpath.c \
	bgpd/bgp_advertise.c \
	bgpd/bgp_aspath.c \
	bgpd/bgp_attr.c \
	bgpd/bgp_attr_evpn.c \
	bgpd/bgp_bfd.c \
	bgpd/bgp_clist.c \
	bgpd/bgp_community.c \
	bgpd/bgp_community_alias.c \
	bgpd/bgp_conditional_adv.c \
	bgpd/bgp_damp.c \
	bgpd/bgp_debug.c \
	bgpd/bgp_dump.c \
	bgpd/bgp_ecommunity.c \
	bgpd/bgp_encap_tlv.c \
	bgpd/bgp_errors.c \
	bgpd/bgp_evpn.c \
	bgpd/bgp_evpn_mh.c \
	bgpd/bgp_evpn_vty.c \
	bgpd/bgp_filter.c \
	bgpd/bgp_flowspec.c \
	bgpd/bgp_flowspec_util.c \
	bgpd/bgp_flowspec_vty.c \
	bgpd/bgp_fsm.c \
	bgpd/bgp_io.c \
	bgpd/bgp_keepalives.c \
	bgpd/bgp_label.c \
	bgpd/bgp_labelpool.c \
	bgpd/bgp_lcommunity.c \
	bgpd/bgp_mac.c \
	bgpd/bgp_memory.c \
	bgpd/bgp_mpath.c \
	bgpd/bgp_mplsvpn.c \
	bgpd/bgp_network.c \
	bgpd/bgp_nexthop.c \
	bgpd/bgp_nht.c \
	bgpd/bgp_open.c \
	bgpd/bgp_packet.c \
	bgpd/bgp_pbr.c \
	bgpd/bgp_rd.c \
	bgpd/bgp_regex.c \
	bgpd/bgp_route.c \
	bgpd/bgp_routemap.c \
	bgpd/bgp_routemap_nb.c \
	bgpd/bgp_routemap_nb_config.c \
	bgpd/bgp_script.c \
	bgpd/bgp_table.c \
	bgpd/bgp_updgrp.c \
	bgpd/bgp_updgrp_adv.c \
	bgpd/bgp_updgrp_packet.c \
	bgpd/bgp_vpn.c \
	bgpd/bgp_vty.c \
	bgpd/bgp_zebra.c \
	bgpd/bgpd.c \
	bgpd/bgp_trace.c \
	bgpd/bgp_nhg.c \
	# end

if ENABLE_BGP_VNC
bgpd_libbgp_a_SOURCES += \
	bgpd/rfapi/bgp_rfapi_cfg.c \
	bgpd/rfapi/rfapi_import.c \
	bgpd/rfapi/rfapi.c \
	bgpd/rfapi/rfapi_ap.c \
	bgpd/rfapi/rfapi_descriptor_rfp_utils.c \
	bgpd/rfapi/rfapi_encap_tlv.c \
	bgpd/rfapi/rfapi_nve_addr.c \
	bgpd/rfapi/rfapi_monitor.c \
	bgpd/rfapi/rfapi_rib.c \
	bgpd/rfapi/rfapi_vty.c \
	bgpd/rfapi/vnc_debug.c \
	bgpd/rfapi/vnc_export_bgp.c \
	bgpd/rfapi/vnc_export_table.c \
	bgpd/rfapi/vnc_import_bgp.c \
	bgpd/rfapi/vnc_zebra.c \
	# end
endif

noinst_HEADERS += \
	bgpd/bgp_addpath.h \
	bgpd/bgp_addpath_types.h \
	bgpd/bgp_advertise.h \
	bgpd/bgp_aspath.h \
	bgpd/bgp_attr.h \
	bgpd/bgp_attr_evpn.h \
	bgpd/bgp_bfd.h \
	bgpd/bgp_clist.h \
	bgpd/bgp_community.h \
	bgpd/bgp_community_alias.h \
	bgpd/bgp_conditional_adv.h \
	bgpd/bgp_damp.h \
	bgpd/bgp_debug.h \
	bgpd/bgp_dump.h \
	bgpd/bgp_bmp.h \
	bgpd/bgp_ecommunity.h \
	bgpd/bgp_encap_tlv.h \
	bgpd/bgp_encap_types.h \
	bgpd/bgp_errors.h \
	bgpd/bgp_evpn.h \
	bgpd/bgp_evpn_mh.h \
	bgpd/bgp_evpn_private.h \
	bgpd/bgp_evpn_vty.h \
	bgpd/bgp_filter.h \
	bgpd/bgp_flowspec.h \
	bgpd/bgp_flowspec_private.h \
	bgpd/bgp_flowspec_util.h \
	bgpd/bgp_fsm.h \
	bgpd/bgp_io.h \
	bgpd/bgp_keepalives.h \
	bgpd/bgp_label.h \
	bgpd/bgp_labelpool.h \
	bgpd/bgp_lcommunity.h \
	bgpd/bgp_mac.h \
	bgpd/bgp_memory.h \
	bgpd/bgp_mpath.h \
	bgpd/bgp_mplsvpn.h \
	bgpd/bgp_mplsvpn_snmp.h \
	bgpd/bgp_network.h \
	bgpd/bgp_nexthop.h \
	bgpd/bgp_nht.h \
	bgpd/bgp_open.h \
	bgpd/bgp_packet.h \
	bgpd/bgp_pbr.h \
	bgpd/bgp_rd.h \
	bgpd/bgp_regex.h \
	bgpd/bgp_rpki.h \
	bgpd/bgp_route.h \
	bgpd/bgp_routemap_nb.h \
	bgpd/bgp_script.h \
	bgpd/bgp_snmp.h \
	bgpd/bgp_snmp_bgp4.h \
	bgpd/bgp_snmp_bgp4v2.h \
	bgpd/bgp_table.h \
	bgpd/bgp_updgrp.h \
	bgpd/bgp_vpn.h \
	bgpd/bgp_vty.h \
	bgpd/bgp_zebra.h \
	bgpd/bgpd.h \
	bgpd/bgp_trace.h \
	bgpd/bgp_nhg.h \
	\
	bgpd/rfapi/bgp_rfapi_cfg.h \
	bgpd/rfapi/rfapi_import.h \
	bgpd/rfapi/rfapi.h \
	bgpd/rfapi/rfapi_ap.h \
	bgpd/rfapi/rfapi_backend.h \
	bgpd/rfapi/rfapi_descriptor_rfp_utils.h \
	bgpd/rfapi/rfapi_encap_tlv.h \
	bgpd/rfapi/rfapi_nve_addr.h \
	bgpd/rfapi/rfapi_monitor.h \
	bgpd/rfapi/rfapi_private.h \
	bgpd/rfapi/rfapi_rib.h \
	bgpd/rfapi/rfapi_vty.h \
	bgpd/rfapi/vnc_debug.h \
	bgpd/rfapi/vnc_export_bgp.h \
	bgpd/rfapi/vnc_export_table.h \
	bgpd/rfapi/vnc_import_bgp.h \
	bgpd/rfapi/vnc_zebra.h \
	bgpd/rfapi/vnc_export_bgp_p.h \
	bgpd/rfapi/vnc_import_bgp_p.h \
	bgpd/bgp_vnc_types.h \
	# end

bgpd_bgpd_SOURCES = bgpd/bgp_main.c
bgpd_bgp_btoa_SOURCES = bgpd/bgp_btoa.c

# RFPLDADD is set in bgpd/rfp-example/librfp/subdir.am
bgpd_bgpd_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBYANG_LIBS) $(LIBCAP) $(LIBM) $(UST_LIBS)
bgpd_bgp_btoa_LDADD = bgpd/libbgp.a $(RFPLDADD) lib/libfrr.la $(LIBYANG_LIBS) $(LIBCAP) $(LIBM) $(UST_LIBS)

bgpd_bgpd_snmp_la_SOURCES = bgpd/bgp_snmp_bgp4.c bgpd/bgp_snmp_bgp4v2.c bgpd/bgp_snmp.c bgpd/bgp_mplsvpn_snmp.c
bgpd_bgpd_snmp_la_CFLAGS = $(AM_CFLAGS) $(SNMP_CFLAGS) -std=gnu11
bgpd_bgpd_snmp_la_LDFLAGS = $(MODULE_LDFLAGS)
bgpd_bgpd_snmp_la_LIBADD = lib/libfrrsnmp.la

bgpd_bgpd_rpki_la_SOURCES = bgpd/bgp_rpki.c
bgpd_bgpd_rpki_la_CFLAGS = $(AM_CFLAGS) $(RTRLIB_CFLAGS)
bgpd_bgpd_rpki_la_LDFLAGS = $(MODULE_LDFLAGS)
bgpd_bgpd_rpki_la_LIBADD = $(RTRLIB_LIBS)

bgpd_bgpd_bmp_la_SOURCES = bgpd/bgp_bmp.c
bgpd_bgpd_bmp_la_LIBADD = lib/libfrrcares.la
bgpd_bgpd_bmp_la_LDFLAGS = $(MODULE_LDFLAGS)

clippy_scan += \
	bgpd/bgp_bmp.c \
	bgpd/bgp_debug.c \
	bgpd/bgp_evpn_vty.c \
	bgpd/bgp_labelpool.c \
	bgpd/bgp_route.c \
	bgpd/bgp_routemap.c \
	bgpd/bgp_rpki.c \
	bgpd/bgp_vty.c \
        bgpd/bgp_nexthop.c \
	bgpd/bgp_snmp.c \
	# end

nodist_bgpd_bgpd_SOURCES = \
	yang/frr-bgp-types.yang.c \
	yang/frr-bgp.yang.c \
	yang/frr-bgp-common-structure.yang.c \
	yang/frr-bgp-common.yang.c \
	yang/frr-bgp-common-multiprotocol.yang.c \
	yang/frr-bgp-neighbor.yang.c \
	yang/frr-bgp-peer-group.yang.c \
	yang/frr-bgp-bmp.yang.c \
	yang/frr-bgp-rpki.yang.c \
	yang/frr-deviations-bgp-datacenter.yang.c \
	yang/frr-bgp-filter.yang.c \
	yang/frr-bgp-route-map.yang.c \
	# end
