Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only compile example snippets for make check #59

Merged
merged 2 commits into from
Nov 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $(top_builddir)/src/libpifegeneric.la \
$(top_builddir)/src/libpip4info.la \
$(top_builddir)/targets/dummy/libpi_dummy.la

noinst_PROGRAMS = example_1 example_2
check_PROGRAMS = example_1 example_2

example_1_SOURCES = example_1.c

Expand All @@ -26,9 +26,11 @@ gen_fe_defines = $(top_builddir)/generators/pi_gen_fe_defines
$(fe_defines) : $(srcdir)/testdata/simple_router.json $(gen_fe_defines)
$(gen_fe_defines) -c $< -d $(abs_builddir) -n $(p4_name)

BUILT_SOURCES = $(fe_defines)

example_2_SOURCES = example_2.c
nodist_example_2_SOURCES = $(fe_defines)
# This is a bit risky. See "Recording Dependencies manually" at
# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Built-Sources-Example
example_2.$(OBJEXT) : $(fe_defines)

EXTRA_DIST = \
testdata/simple_router.json
Expand Down
32 changes: 2 additions & 30 deletions frontends_extra/cpp/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

SUBDIRS = . example

AM_CPPFLAGS = \
-I$(top_srcdir)/../../include

Expand All @@ -9,34 +11,4 @@ src/tables.cpp
nobase_include_HEADERS = \
PI/frontends/cpp/tables.h

noinst_PROGRAMS = example
example_SOURCES = example.cpp
testdata_dirpath = $(top_srcdir)/../../examples/testdata
p4_name = p4
example_CPPFLAGS = \
-I$(top_srcdir)/../../include \
-DTESTDATADIR=\"$(testdata_dirpath)\"
fe_defines = pi_fe_defines_$(p4_name).h
gen_fe_defines = $(top_builddir)/../../generators/pi_gen_fe_defines
$(fe_defines) : $(testdata_dirpath)/simple_router.json $(gen_fe_defines)
$(gen_fe_defines) -c $< -d $(abs_builddir) -n $(p4_name)
BUILT_SOURCES = $(fe_defines)

if WITH_BMV2
example_LDADD = \
$(top_builddir)/../../src/libpi.la \
libpifecpp.la \
$(top_builddir)/../../targets/bmv2/libpi_bmv2.la \
$(top_builddir)/../../src/libpip4info.la \
-lthrift -lruntimestubs -lsimpleswitch_thrift
else
example_LDADD = \
$(top_builddir)/../../src/libpi.la \
libpifecpp.la \
$(top_builddir)/../../src/libpip4info.la \
$(top_builddir)/../../targets/dummy/libpi_dummy.la
endif

lib_LTLIBRARIES = libpifecpp.la

CLEANFILES = $(fe_defines)
3 changes: 2 additions & 1 deletion frontends_extra/cpp/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ AC_TYPE_SIZE_T
AC_SUBST([AM_CXXFLAGS], ["-Wall -Werror -Wextra"])

# Generate makefiles
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile
example/Makefile])

AC_OUTPUT
File renamed without changes.
35 changes: 35 additions & 0 deletions frontends_extra/cpp/example/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

check_PROGRAMS = example
testdata_dirpath = $(top_srcdir)/../../examples/testdata
p4_name = p4
AM_CPPFLAGS = \
-I$(top_srcdir)/../../include \
-DTESTDATADIR=\"$(testdata_dirpath)\"
fe_defines = pi_fe_defines_$(p4_name).h
gen_fe_defines = $(top_builddir)/../../generators/pi_gen_fe_defines
$(fe_defines) : $(testdata_dirpath)/simple_router.json $(gen_fe_defines)
$(gen_fe_defines) -c $< -d $(abs_builddir) -n $(p4_name)
example_SOURCES = example.cpp
nodist_example_SOURCES = $(fe_defines)
# This is a bit risky. See "Recording Dependencies manually" at
# https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Built-Sources-Example
# note the example-example instead of example, because of the per-binary flags
example.$(OBJEXT) : $(fe_defines)

if WITH_BMV2
LDADD = \
$(top_builddir)/../../src/libpi.la \
$(top_builddir)/libpifecpp.la \
$(top_builddir)/../../targets/bmv2/libpi_bmv2.la \
$(top_builddir)/../../src/libpip4info.la \
-lthrift -lruntimestubs -lsimpleswitch_thrift
else
LDADD = \
$(top_builddir)/../../src/libpi.la \
$(top_builddir)/libpifecpp.la \
$(top_builddir)/../../src/libpip4info.la \
$(top_builddir)/../../targets/dummy/libpi_dummy.la
endif

CLEANFILES = $(fe_defines)