Skip to content

Commit

Permalink
Refactor all Makefile.am
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 21, 2021
1 parent 9bb541a commit e75abb7
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 135 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ AM_PATH_PYTHON3
AX_CODE_COVERAGE
AX_ADD_AM_MACRO_STATIC([])

AM_CONDITIONAL(sonic_asic_platform_barefoot, test x$CONFIGURED_PLATFORM = xbarefoot)
AM_CONDITIONAL(sonic_asic_platform_mellanox, test x$CONFIGURED_PLATFORM = xmellanox)
AM_CONDITIONAL(SONIC_ASIC_PLATFORM_BAREFOOT, test x$CONFIGURED_PLATFORM = xbarefoot)
AM_CONDITIONAL(SONIC_ASIC_PLATFORM_MELLANOX, test x$CONFIGURED_PLATFORM = xmellanox)

AC_ARG_ENABLE(debug,
[ --enable-debug turn on debugging],
Expand Down
34 changes: 17 additions & 17 deletions lib/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc

if DEBUG
DBGFLAGS = -ggdb -D_DEBUG_
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g
endif

lib_LTLIBRARIES = libsairedis.la

noinst_LIBRARIES = libSaiRedis.a

libSaiRedis_a_SOURCES = \
Channel.cpp \
ClientConfig.cpp \
ServerConfig.cpp \
ClientServerSai.cpp \
ClientSai.cpp \
ServerSai.cpp \
ZeroMQChannel.cpp \
Channel.cpp \
ClientServerSai.cpp \
Context.cpp \
ContextConfigContainer.cpp \
ContextConfig.cpp \
SwitchConfig.cpp \
SwitchConfigContainer.cpp \
ContextConfigContainer.cpp \
Recorder.cpp \
RedisChannel.cpp \
RedisRemoteSaiInterface.cpp \
RedisVidIndexGenerator.cpp \
Sai.cpp \
ServerConfig.cpp \
ServerSai.cpp \
SkipRecordAttrContainer.cpp \
Switch.cpp \
SwitchConfig.cpp \
SwitchConfigContainer.cpp \
SwitchContainer.cpp \
VirtualObjectIdManager.cpp \
RedisVidIndexGenerator.cpp \
Recorder.cpp \
RedisRemoteSaiInterface.cpp \
Utils.cpp \
SkipRecordAttrContainer.cpp
VirtualObjectIdManager.cpp \
ZeroMQChannel.cpp

libsairedis_la_SOURCES = \
sai_redis_acl.cpp \
Expand Down Expand Up @@ -88,11 +89,10 @@ libsairedis_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libsairedis_la_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
libsairedis_la_LIBADD = -lhiredis -lswsscommon libSaiRedis.a $(CODE_COVERAGE_LIBS)


bin_PROGRAMS = tests

tests_SOURCES = tests.cpp
tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
tests_LDADD = -lhiredis -lswsscommon -lpthread $(top_srcdir)/meta/libsaimetadata.la $(top_srcdir)/meta/libsaimeta.la libsairedis.la -lzmq
tests_LDADD = -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq

TESTS = tests
30 changes: 14 additions & 16 deletions meta/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# since we have SAI sumbodule we will use submodule headers
AM_CFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/lib/inc
AM_CFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc

if DEBUG
DBGFLAGS = -ggdb -D_DEBUG_
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g
endif
Expand All @@ -28,31 +27,30 @@ libsaimetadata_la_SOURCES = \
libsaimetadata_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libsaimetadata_la_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) -ansi $(CODE_COVERAGE_CFLAGS)


libsaimeta_la_SOURCES = \
AttrKeyMap.cpp \
Globals.cpp \
Meta.cpp \
MetaKeyHasher.cpp \
Notification.cpp \
NotificationFactory.cpp \
NotificationFdbEvent.cpp \
NotificationPortStateChange.cpp \
NotificationQueuePfcDeadlock.cpp \
NotificationSwitchShutdownRequest.cpp \
NotificationSwitchStateChange.cpp \
SaiInterface.cpp \
SaiAttributeList.cpp \
saiserialize.cpp \
SaiAttrWrapper.cpp \
OidRefCounter.cpp \
AttrKeyMap.cpp \
Globals.cpp \
PerformanceIntervalTimer.cpp \
PortRelatedSet.cpp \
RedisSelectableChannel.cpp \
SaiAttrWrapper.cpp \
SaiAttributeList.cpp \
SaiInterface.cpp \
SaiObject.cpp \
SaiObjectCollection.cpp \
PortRelatedSet.cpp \
MetaKeyHasher.cpp \
PerformanceIntervalTimer.cpp \
SelectableChannel.cpp \
RedisSelectableChannel.cpp \
ZeroMQSelectableChannel.cpp \
Meta.cpp
saiserialize.cpp

libsaimeta_la_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libsaimeta_la_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion pyext/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def fdb_event_notification(count, data):
pysairedis.sai_attribute_t_arr_setitem(attrs, 5, attr)

status = switch_api.create_switch(poid, 6, attrs)
print "create_switch: " + str(status)
print "create_switch: " + str(status)

swid = pysairedis.sai_object_id_t_p_value(poid)

Expand Down
13 changes: 6 additions & 7 deletions saiasiccmp/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc -I$(top_srcdir)/meta -I$(top_srcdir)/syncd
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/meta -I$(top_srcdir)/lib/inc -I$(top_srcdir)/syncd

bin_PROGRAMS = saiasiccmp

Expand All @@ -12,11 +12,11 @@ noinst_LIBRARIES = libAsicCmp.a

libAsicCmp_a_SOURCES = \
AsicCmp.cpp \
View.cpp \
ViewCmp.cpp \
SaiSwitchAsic.cpp \
CommandLineOptions.cpp \
CommandLineOptionsParser.cpp
CommandLineOptionsParser.cpp \
SaiSwitchAsic.cpp \
View.cpp \
ViewCmp.cpp

libAsicCmp_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libAsicCmp_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand All @@ -26,10 +26,9 @@ saiasiccmp_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
saiasiccmp_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
saiasiccmp_LDADD = libAsicCmp.a \
-lsaimetadata -lsaimeta -ldl -lhiredis -lswsscommon -lpthread -lzmq \
-L$(top_srcdir)/meta/.libs \
$(top_srcdir)/syncd/libSyncd.a \
-L$(top_srcdir)/syncd/.libs \
$(top_srcdir)/lib/src/libSaiRedis.a \
-L$(top_srcdir)/meta/.libs \
$(CODE_COVERAGE_LIBS)

TESTS = test.sh
2 changes: 1 addition & 1 deletion saidiscovery/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental -I${top_srcdir}/meta
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/meta -I$(top_srcdir)/lib/inc

bin_PROGRAMS = saidiscovery

Expand Down
2 changes: 1 addition & 1 deletion saidump/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc

bin_PROGRAMS = saidump

Expand Down
7 changes: 4 additions & 3 deletions saiplayer/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc

bin_PROGRAMS = saiplayer

Expand All @@ -9,16 +9,17 @@ DBGFLAGS = -g
endif

noinst_LIBRARIES = libSaiPlayer.a

libSaiPlayer_a_SOURCES = \
CommandLineOptions.cpp \
CommandLineOptionsParser.cpp \
SaiPlayer.cpp


libSaiPlayer_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libSaiPlayer_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)

saiplayer_SOURCES = saiplayer_main.cpp
saiplayer_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
saiplayer_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
saiplayer_LDADD = libSaiPlayer.a $(top_srcdir)/syncd/libSyncd.a $(top_srcdir)/lib/src/libSaiRedis.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
saiplayer_LDADD = libSaiPlayer.a $(top_srcdir)/syncd/libSyncd.a $(top_srcdir)/lib/src/libSaiRedis.a \
-lhiredis -lswsscommon -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
3 changes: 1 addition & 2 deletions saisdkdump/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta

bin_PROGRAMS = saisdkdump

Expand All @@ -8,7 +8,6 @@ else
DBGFLAGS = -g
endif


if SAIVS
SAILIB=-L$(top_srcdir)/vslib/src/.libs -lsaivs
else
Expand Down
78 changes: 39 additions & 39 deletions syncd/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/lib/inc -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental

bin_PROGRAMS = syncd syncd_request_shutdown tests
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc -I$(top_srcdir)/vslib/inc

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
Expand All @@ -14,48 +12,51 @@ else
SAILIB=-lsai
endif

bin_PROGRAMS = syncd syncd_request_shutdown tests

noinst_LIBRARIES = libSyncd.a libSyncdRequestShutdown.a

libSyncd_a_SOURCES = \
WatchdogScope.cpp \
SaiSwitchInterface.cpp \
ZeroMQNotificationProducer.cpp \
RedisNotificationProducer.cpp \
ComparisonLogic.cpp \
Syncd.cpp \
AsicOperation.cpp \
AsicView.cpp \
BestCandidateFinder.cpp \
BreakConfig.cpp \
BreakConfigParser.cpp \
RedisClient.cpp \
WarmRestartTable.cpp \
RequestShutdownCommandLineOptions.cpp \
CommandLineOptions.cpp \
CommandLineOptionsParser.cpp \
ComparisonLogic.cpp \
FlexCounter.cpp \
FlexCounterManager.cpp \
GlobalSwitchId.cpp \
HardReiniter.cpp \
MetadataLogger.cpp \
Workaround.cpp \
ServiceMethodTable.cpp \
SwitchNotifications.cpp \
VirtualOidTranslator.cpp \
NotificationProcessor.cpp \
NotificationHandler.cpp \
SingleReiniter.cpp \
HardReiniter.cpp \
NotificationProcessor.cpp \
NotificationQueue.cpp \
PortMap.cpp \
PortMapParser.cpp \
RedisClient.cpp \
RedisNotificationProducer.cpp \
RequestShutdownCommandLineOptions.cpp \
SaiAttr.cpp \
SaiDiscovery.cpp \
SaiObj.cpp \
SaiSwitch.cpp \
BestCandidateFinder.cpp \
FlexCounterManager.cpp \
FlexCounter.cpp \
SaiSwitchInterface.cpp \
ServiceMethodTable.cpp \
SingleReiniter.cpp \
SwitchNotifications.cpp \
Syncd.cpp \
TimerWatchdog.cpp \
VendorSai.cpp \
VidManager.cpp \
VidManager.cpp \
AsicOperation.cpp \
AsicView.cpp \
SaiObj.cpp \
SaiAttr.cpp \
VendorSai.cpp \
syncd_main.cpp \
TimerWatchdog.cpp \
NotificationQueue.cpp \
CommandLineOptions.cpp \
CommandLineOptionsParser.cpp \
PortMap.cpp \
PortMapParser.cpp
VirtualOidTranslator.cpp \
WarmRestartTable.cpp \
WatchdogScope.cpp \
Workaround.cpp \
ZeroMQNotificationProducer.cpp \
syncd_main.cpp

libSyncd_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libSyncd_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand All @@ -71,15 +72,15 @@ syncd_CXXFLAGS += -DSAITHRIFT=yes
syncd_LDADD += -lrpcserver -lthrift
endif

if sonic_asic_platform_mellanox
if SONIC_ASIC_PLATFORM_MELLANOX
syncd_CXXFLAGS += -DSAI_SUXXORT_UNINIT_DATA_PLANE_ON_REMOVAL
libSyncd_a_CXXFLAGS += -DSAI_SUXXORT_UNINIT_DATA_PLANE_ON_REMOVAL
endif

libSyncdRequestShutdown_a_SOURCES = \
RequestShutdown.cpp \
RequestShutdownCommandLineOptions.cpp \
RequestShutdownCommandLineOptionsParser.cpp
RequestShutdown.cpp \
RequestShutdownCommandLineOptions.cpp \
RequestShutdownCommandLineOptionsParser.cpp

libSyncdRequestShutdown_a_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
libSyncdRequestShutdown_a_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
Expand All @@ -90,7 +91,6 @@ syncd_request_shutdown_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
syncd_request_shutdown_LDADD = libSyncdRequestShutdown.a $(top_srcdir)/lib/src/libSaiRedis.a -lhiredis -lswsscommon -lpthread $(CODE_COVERAGE_LIBS)

tests_SOURCES = tests.cpp

tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON)
tests_LDADD = libSyncd.a -lhiredis -lswsscommon -lpthread -L$(top_srcdir)/lib/src/.libs -lsairedis -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)

Expand Down
9 changes: 5 additions & 4 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/SAI/experimental
AM_CXXFLAGS = -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/experimental -I$(top_srcdir)/SAI/meta -I$(top_srcdir)/lib/inc -I$(top_srcdir)/vslib/inc

bin_PROGRAMS = vssyncd tests testclient

Expand All @@ -11,10 +11,11 @@ endif
SAILIB=-L$(top_srcdir)/vslib/src/.libs -lsaivs

vssyncd_SOURCES = main.cpp

vssyncd_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
vssyncd_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
vssyncd_LDADD = $(top_srcdir)/syncd/libSyncd.a $(top_srcdir)/lib/src/libSaiRedis.a -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -ldl -lzmq $(CODE_COVERAGE_LIBS)
vssyncd_LDADD = $(top_srcdir)/syncd/libSyncd.a $(top_srcdir)/lib/src/libSaiRedis.a \
-lhiredis -lswsscommon $(SAILIB) -lpthread \
-L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -ldl -lzmq $(CODE_COVERAGE_LIBS)

if SAITHRIFT
vssyncd_LDADD += -lrpcserver -lthrift
Expand All @@ -36,4 +37,4 @@ testclient_LDADD = -lhiredis -lswsscommon -lpthread \
-L$(top_srcdir)/meta/.libs \
-lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)

TESTS = aspellcheck.pl conflictnames.pl swsslogentercheck.sh tests BCM56850.pl MLNX2700.pl
TESTS = aspellcheck.pl conflictnames.pl swsslogentercheck.sh checkwhitespace.sh tests BCM56850.pl MLNX2700.pl
10 changes: 10 additions & 0 deletions tests/checkwhitespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo Checkig for white spaces ...

find .. -type f | grep -v SAI/ | perl -ne 'print if /\.(c|cpp|h|hpp|am|sh|pl|pm|install|dirs|links|json|ini|yml|pws|md|py|cfg|conf|i|ac)$/' | xargs grep -P "\\s\$"

if [ $? -eq 0 ]; then
echo ERROR: some files contain white spaces at the end of line, please fix
exit 1
fi
Loading

0 comments on commit e75abb7

Please sign in to comment.