@@ -35,6 +35,9 @@ AM_CFLAGS += $(OVS_CFLAGS)
if DPDK_NETDEV
AM_CFLAGS += -D_FILE_OFFSET_BITS=64
+SOEXPAND_DPDK_BLOCKS ="--dpdk"
+else
+SOEXPAND_DPDK_BLOCKS ="--nodpdk"
endif
if NDEBUG
@@ -136,7 +139,8 @@ ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-
SUFFIXES += .in
.in:
- $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
+ $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) \
+ $(SOEXPAND_DPDK_BLOCKS) < $< | \
sed \
-e 's,[@]PKIDIR[@],$(PKIDIR),g' \
-e 's,[@]LOGDIR[@],$(LOGDIR),g' \
@@ -18,15 +18,25 @@ use Getopt::Long;
my ($exit_code) = 0;
my (@include_dirs);
+my ($check_dpdk) = 0;
+my ($disabled_output) = 0;
+
Getopt::Long::Configure ("bundling");
-GetOptions("I|include=s" => \@include_dirs) or exit(1);
+GetOptions("I|include=s" => \@include_dirs,
+ 'dpdk!' => \$check_dpdk) or exit(1);
@include_dirs = ('.') if !@include_dirs;
OUTER: while (<STDIN>) {
if (my ($name) = /^\.so (\S+)$/) {
foreach my $dir (@include_dirs, '.') {
if (open(INNER, "$dir/$name")) {
while (<INNER>) {
- print $_;
+ if (/@(begin|end)_dpdk@/) {
+ if (!$check_dpdk) {
+ $disabled_output = ! $disabled_output;
+ }
+ next;
+ }
+ print $_ unless $disabled_output;
}
close(INNER);
next OUTER;
@@ -35,6 +45,13 @@ OUTER: while (<STDIN>) {
print STDERR "$name not found in: ", join(' ', @include_dirs), "\n";
$exit_code = 1;
}
- print $_;
+ if (/@(begin|end)_dpdk@/) {
+ if (!$check_dpdk) {
+ $disabled_output = ! $disabled_output;
+ }
+ next;
+ }
+
+ print $_ unless $disabled_output;
}
exit $exit_code;
Normally, in C code, pre-processing macros can be used to enable/disable specific functionality based on switches passed to configure. This works for DPDK using the --with-dpdk flag, which sets the DPDK_NETDEV define to the appropriate value. However, not all files are processed with the C pre-processor. For those files which are not, the soexpand utility grows a new feature to simply filter out those stanzas which aren't dpdk relevant. Signed-off-by: Aaron Conole <aconole@redhat.com> --- Makefile.am | 6 +++++- build-aux/soexpand.pl | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-)