next-build: create both static and shared libs
Subsystems (3)
cover next-build: create both static and shared libs
This patchset changes the meson+ninja build system to always create both static and shared libraries when doing a build. The applications compiled as part of a build use either the shared or static libraries depending on what the default_library build setting is.
NOTE:
The main difficulty with this change is adjusting the pkgconfig file so that external apps, like the examples, can be built using either the static or shared libraries. One of the key issues was the fact that running "pkg-config --static --libs libdpdk" outputs first the normal libs, and then the extra static ones. This is a problem because the driver libs are for static only builds, but need to come before, not after the standard DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.
There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags needed.
2. Modifying the single .pc file so that it was "good enough" to enable static builds without too much work.
For this version of this set, I took option #2. To link using dynamic libs, all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be seen in the changes to the example application makefiles, which now support building the examples using shared or static DPDK libs.
Bruce Richardson (6):
build: remove library special cases
eal: fix list of source files to meson build
build: build all libs and drivers as both static and shared
build: change default library type to static
build: symlink drivers to library directory
examples: enable linking examples both static and shared
app/test-pmd/meson.build | 5 +- buildtools/symlink-drivers-solibs.sh | 16 ++++ config/meson.build | 14 ++++ doc/guides/contributing/coding_style.rst | 9 +++ drivers/meson.build | 43 +++++++--- drivers/net/e1000/base/meson.build | 2 +- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/i40e/base/meson.build | 2 +- drivers/net/ixgbe/base/meson.build | 2 +- examples/bond/Makefile | 21 +++-- examples/cmdline/Makefile | 21 +++-- examples/distributor/Makefile | 21 +++-- examples/eventdev_pipeline_sw_pmd/Makefile | 21 +++-- examples/exception_path/Makefile | 21 +++-- examples/flow_classify/Makefile | 21 +++-- examples/flow_filtering/Makefile | 21 +++-- examples/helloworld/Makefile | 21 +++-- examples/ip_fragmentation/Makefile | 21 +++-- examples/ip_pipeline/Makefile | 21 +++-- examples/ip_reassembly/Makefile | 21 +++-- examples/ipsec-secgw/Makefile | 21 +++-- examples/ipv4_multicast/Makefile | 21 +++-- examples/kni/Makefile | 21 +++-- examples/l2fwd-cat/Makefile | 21 +++-- examples/l2fwd-crypto/Makefile | 21 +++-- examples/l2fwd-jobstats/Makefile | 21 +++-- examples/l2fwd-keepalive/Makefile | 21 +++-- examples/l2fwd/Makefile | 21 +++-- examples/l3fwd-acl/Makefile | 21 +++-- examples/l3fwd-power/Makefile | 21 +++-- examples/l3fwd-vf/Makefile | 21 +++-- examples/l3fwd/Makefile | 21 +++-- examples/link_status_interrupt/Makefile | 21 +++-- examples/load_balancer/Makefile | 21 +++-- examples/meson.build | 2 +- examples/packet_ordering/Makefile | 21 +++-- examples/ptpclient/Makefile | 21 +++-- examples/qos_meter/Makefile | 21 +++-- examples/qos_sched/Makefile | 21 +++-- examples/rxtx_callbacks/Makefile | 21 +++-- examples/service_cores/Makefile | 21 +++-- examples/skeleton/Makefile | 21 +++-- examples/tep_termination/Makefile | 21 +++-- examples/timer/Makefile | 21 +++-- examples/vhost/Makefile | 21 +++-- examples/vhost_scsi/Makefile | 21 +++-- examples/vmdq/Makefile | 21 +++-- examples/vmdq_dcb/Makefile | 21 +++-- lib/librte_eal/bsdapp/eal/meson.build | 34 +------- lib/librte_eal/bsdapp/meson.build | 55 ------------- lib/librte_eal/common/arch/meson.build | 33 -------- lib/librte_eal/common/include/arch/meson.build | 33 -------- lib/librte_eal/common/include/meson.build | 71 ---------------- lib/librte_eal/common/meson.build | 74 ++++++++++++++--- lib/librte_eal/linuxapp/eal/meson.build | 36 +-------- lib/librte_eal/linuxapp/igb_uio/meson.build | 8 +- lib/librte_eal/linuxapp/meson.build | 42 ---------- lib/librte_eal/meson.build | 45 +++++++++-- lib/meson.build | 107 ++++++++++++++++--------- meson.build | 31 ++++--- 60 files changed, 885 insertions(+), 579 deletions(-) create mode 100644 buildtools/symlink-drivers-solibs.sh delete mode 100644 lib/librte_eal/bsdapp/meson.build delete mode 100644 lib/librte_eal/common/arch/meson.build delete mode 100644 lib/librte_eal/common/include/arch/meson.build delete mode 100644 lib/librte_eal/common/include/meson.build delete mode 100644 lib/librte_eal/linuxapp/meson.build
Signature · 1 line
2.14.3
PATCH 1/6 build: remove library special cases
The EAL and compat libraries were special-cases in the library build process, the former because of it's complexity, and the latter because it only consists of a single header file.
By reworking the EAL meson.build files, we can eliminate the need for it to be a special case, by having it build up and return the list of sources, headers, and objects and return those to the higher level build file. This should also simplify the building of EAL, as we can eliminate a number of meson.build files that would no longer be needed, and have fewer, but larger meson.build files (9 now vs 14 previous) - thereby making the logic easier to follow and items easier to find.
Once done, we can pull eal into the main library loop, with some modifications to support it. Compat can also be pulled it once we add in a check to handle the case of an empty sources list.
--- app/test-pmd/meson.build | 1 - config/meson.build | 14 ++++ doc/guides/contributing/coding_style.rst | 9 +++ drivers/net/e1000/base/meson.build | 2 +- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/i40e/base/meson.build | 2 +- drivers/net/ixgbe/base/meson.build | 2 +- lib/librte_eal/bsdapp/eal/meson.build | 34 +--------- lib/librte_eal/bsdapp/meson.build | 55 ---------------- lib/librte_eal/common/arch/meson.build | 33 ---------- lib/librte_eal/common/include/arch/meson.build | 33 ---------- lib/librte_eal/common/include/meson.build | 71 --------------------- lib/librte_eal/common/meson.build | 66 +++++++++++++++++-- lib/librte_eal/linuxapp/eal/meson.build | 36 ++--------- lib/librte_eal/linuxapp/igb_uio/meson.build | 8 ++- lib/librte_eal/linuxapp/meson.build | 42 ------------ lib/librte_eal/meson.build | 45 +++++++++++-- lib/meson.build | 88 +++++++++++++++----------- 18 files changed, 193 insertions(+), 350 deletions(-) delete mode 100644 lib/librte_eal/bsdapp/meson.build delete mode 100644 lib/librte_eal/common/arch/meson.build delete mode 100644 lib/librte_eal/common/include/arch/meson.build delete mode 100644 lib/librte_eal/common/include/meson.build delete mode 100644 lib/librte_eal/linuxapp/meson.build
app/test-pmd/meson.build +0 -1
@@ -75,6 +75,5 @@ executable('dpdk-testpmd', sources, link_whole: link_libs, dependencies: dep_objs, - link_args: eal_extra_link_arg, # add -ldl for linux, -lexecinfo for BSD install_rpath: join_paths(get_option('prefix'), driver_install_path), install: true)
config/meson.build +14 -0
@@ -33,10 +33,24 @@ machine = get_option('machine') dpdk_conf.set('RTE_MACHINE', machine) add_project_arguments('-march=@0@'.format(machine), language: 'c') + +# use pthreads +add_project_link_arguments('-pthread', language: 'c') +dpdk_extra_ldflags += '-pthread' + # some libs depend on maths lib add_project_link_arguments('-lm', language: 'c') dpdk_extra_ldflags += '-lm' +# for linux link against dl, for bsd execinfo +if host_machine.system() == 'linux' + link_lib = 'dl' +else + link_lib = 'execinfo' +endif +add_project_link_arguments('-l' + link_lib, language: 'c') +dpdk_extra_ldflags += '-l' + link_lib + # check for libraries used in multiple places in DPDK has_libnuma = 0 numa_dep = cc.find_library('numa', required: false)
doc/guides/contributing/coding_style.rst +9 -0
@@ -840,6 +840,15 @@ headers source files, these should be specified using the meson ``files()`` function. +includes: + **Default Value = []**. + Used to indicate any additional header file paths which should be + added to the header search path for other libs depending on this + library. EAL uses this so that other libraries building against it + can find the headers in subdirectories of the main EAL directory. The + base directory of each library is always given in the include path, + it does not need to be specified here. + name **Default Value = library name derived from the directory name**. If a library's .so or .a file differs from that given in the directory
drivers/net/e1000/base/meson.build +1 -1
@@ -60,6 +60,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('e1000_base', sources, - dependencies: rte_eal, + dependencies: dep_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
drivers/net/fm10k/base/meson.build +1 -1
@@ -50,6 +50,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('fm10k_base', sources, - dependencies: rte_eal, + dependencies: dep_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
drivers/net/i40e/base/meson.build +1 -1
@@ -51,6 +51,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('i40e_base', sources, - dependencies: rte_eal, + dependencies: dep_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
drivers/net/ixgbe/base/meson.build +1 -1
@@ -55,6 +55,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('ixgbe_base', sources, - dependencies: rte_eal, + dependencies: dep_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
lib/librte_eal/bsdapp/eal/meson.build +3 -31
@@ -29,7 +29,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -sources = ['eal_alarm.c', +env_objs = [] +env_headers = [] +env_sources = files('eal_alarm.c', 'eal_debug.c', 'eal_hugepage_info.c', 'eal_interrupts.c',
@@ -38,35 +40,5 @@ sources = ['eal_alarm.c', 'eal_timer.c', 'eal.c', 'eal_memory.c', -] - -eal_extra_link_arg = '-lexecinfo' - -if get_option('per_library_versions') - lib_version = '@[email protected]'.format(version) - so_version = '@0@'.format(version) -else - pver = meson.project_version().split('.') - lib_version = '@0@.@1@'.format(pver.get(0), pver.get(1)) - so_version = lib_version -endif - -eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_sources, - dependencies: dependency('threads'), - include_directories : eal_inc, - version: lib_version, - soversion: so_version, - c_args: '-D_GNU_SOURCE', - link_depends: version_map, - link_args: [eal_extra_link_arg, - '-Wl,--version-script=' + version_map], - install: true ) -dpdk_libraries += eal_lib -dpdk_extra_ldflags += ['-pthread', eal_extra_link_arg] - -rte_eal = declare_dependency(link_with: eal_lib, - include_directories: eal_inc, - dependencies: dependency('threads')) -set_variable('dep_rte_eal', rte_eal)
lib/librte_eal/bsdapp/meson.build deleted +0 -55
55 lines not on this page · raw message
lib/librte_eal/common/arch/meson.build deleted +0 -33
@@ -1,33 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2017 Intel Corporation. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -eal_inc += include_directories(arch_subdir) -subdir(arch_subdir)
lib/librte_eal/common/include/arch/meson.build deleted +0 -33
@@ -1,33 +0,0 @@ -# BSD LICENSE -# -# Copyright(c) 2017 Intel Corporation. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -eal_inc += include_directories(arch_subdir) -subdir(arch_subdir)
lib/librte_eal/common/include/meson.build deleted +0 -71
71 lines not on this page · raw message
lib/librte_eal/common/meson.build +62 -4
76 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/meson.build +4 -32
@@ -32,7 +32,9 @@ eal_inc += include_directories('include') install_subdir('include/exec-env', install_dir: get_option('includedir')) -sources = ['eal_alarm.c', +env_objs = [] +env_headers = [] +env_sources = files('eal_alarm.c', 'eal_debug.c', 'eal_hugepage_info.c', 'eal_interrupts.c',
@@ -44,38 +46,8 @@ sources = ['eal_alarm.c', 'eal_vfio_mp_sync.c', 'eal.c', 'eal_memory.c', -] +) -eal_extra_link_arg = '-ldl' if has_libnuma == 1 dpdk_conf.set10('RTE_EAL_NUMA_AWARE_HUGEPAGES', true) endif - -if get_option('per_library_versions') - lib_version = '@[email protected]'.format(version) - so_version = '@0@'.format(version) -else - pver = meson.project_version().split('.') - lib_version = '@0@.@1@'.format(pver.get(0), pver.get(1)) - so_version = lib_version -endif - -eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_sources, - dependencies: dependency('threads'), - include_directories : eal_inc, - version: lib_version, - soversion: so_version, - c_args: '-D_GNU_SOURCE', - link_depends: version_map, - link_args: [eal_extra_link_arg, - '-Wl,--version-script=' + version_map], - install: true -) - -dpdk_libraries += eal_lib -dpdk_extra_ldflags += ['-pthread', eal_extra_link_arg] - -rte_eal = declare_dependency(link_with: eal_lib, - include_directories: eal_inc, - dependencies: dependency('threads')) -set_variable('dep_rte_eal', rte_eal)
lib/librte_eal/linuxapp/igb_uio/meson.build +7 -1
@@ -29,6 +29,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +kernel_dir = get_option('kernel_dir') +if kernel_dir == '' + kernel_version = run_command('uname', '-r').stdout().strip() + kernel_dir = '/lib/modules/' + kernel_version + '/build' +endif + mkfile = custom_target('igb_uio_makefile', output: 'Makefile', command: ['touch', '@OUTPUT@'])
@@ -43,4 +49,4 @@ custom_target('igb_uio', '/../../common/include', 'modules'], depends: mkfile, - build_by_default: true) + build_by_default: get_option('enable_kmods'))
lib/librte_eal/linuxapp/meson.build deleted +0 -42
42 lines not on this page · raw message
lib/librte_eal/meson.build +40 -5
57 lines not on this page · raw message
lib/meson.build +50 -38
118 lines not on this page · raw message
Signature · 1 line
2.14.3
PATCH 2/6 eal: fix list of source files to meson build
In reply to Bruce RichardsonHeader files should not be listed in the sources list.
--- lib/librte_eal/common/meson.build | 8 -------- 1 file changed, 8 deletions(-)
lib/librte_eal/common/meson.build +0 -8
@@ -51,16 +51,8 @@ common_sources = files( 'eal_common_tailqs.c', 'eal_common_thread.c', 'eal_common_timer.c', - 'eal_filesystem.h', - 'eal_hugepages.h', - 'eal_internal_cfg.h', - 'eal_options.h', - 'eal_private.h', - 'eal_thread.h', 'malloc_elem.c', - 'malloc_elem.h', 'malloc_heap.c', - 'malloc_heap.h', 'rte_keepalive.c', 'rte_malloc.c', 'rte_service.c'
Signature · 1 line
2.14.3
PATCH 3/6 build: build all libs and drivers as both static and shared
In reply to Bruce RichardsonThis patch changes the build process to group all .o files for a driver or library into a static archive first, and then link the .o files together into a shared library. This eliminates the need for separate static or shared object builds when packaging, for instance.
The "default_library" configuration option now only affects the apps and examples, which are either linked against the static or shared library versions depending on the value of the option.
--- app/test-pmd/meson.build | 4 ++-- drivers/meson.build | 43 +++++++++++++++++++++++++++----------- drivers/net/e1000/base/meson.build | 2 +- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/i40e/base/meson.build | 2 +- drivers/net/ixgbe/base/meson.build | 2 +- examples/meson.build | 2 +- lib/meson.build | 37 ++++++++++++++++++++++++-------- meson.build | 22 +++++++------------ 9 files changed, 73 insertions(+), 43 deletions(-)
app/test-pmd/meson.build +2 -2
@@ -46,7 +46,7 @@ sources = files('cmdline.c', 'testpmd.c', 'txonly.c') -deps = ['ethdev', 'gro', 'gso', 'cmdline', 'metrics', 'meter'] +deps = ['ethdev', 'gro', 'gso', 'cmdline', 'metrics', 'meter', 'bus_pci'] if dpdk_conf.has('RTE_LIBRTE_PDUMP') deps += 'pdump' endif
@@ -63,7 +63,7 @@ endif dep_objs = [] foreach d:deps - dep_objs += get_variable('dep_rte_' + d) + dep_objs += get_variable(get_option('default_library') + '_rte_' + d) endforeach link_libs = []
drivers/meson.build +31 -12
79 lines not on this page · raw message
drivers/net/e1000/base/meson.build +1 -1
@@ -60,6 +60,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('e1000_base', sources, - dependencies: dep_rte_eal, + dependencies: static_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
drivers/net/fm10k/base/meson.build +1 -1
@@ -50,6 +50,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('fm10k_base', sources, - dependencies: dep_rte_eal, + dependencies: static_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
drivers/net/i40e/base/meson.build +1 -1
@@ -51,6 +51,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('i40e_base', sources, - dependencies: dep_rte_eal, + dependencies: static_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
drivers/net/ixgbe/base/meson.build +1 -1
@@ -55,6 +55,6 @@ foreach flag: error_cflags endforeach base_lib = static_library('ixgbe_base', sources, - dependencies: dep_rte_eal, + dependencies: static_rte_eal, c_args: c_args) base_objs = base_lib.extract_all_objects()
examples/meson.build +1 -1
@@ -45,7 +45,7 @@ foreach example: get_option('examples').split(',') dep_objs = ext_deps foreach d:deps - dep_objs += [get_variable('dep_rte_' + d)] + dep_objs += [get_variable(get_option('default_library') + '_rte_' + d)] endforeach executable('dpdk-' + name, sources, include_directories: includes,
lib/meson.build +28 -9
@@ -83,11 +83,14 @@ foreach l:libraries if sources.length() == 0 # if no C files, just set a dependency on header path - dep = declare_dependency(include_directories: includes) + shared_dep = declare_dependency(include_directories: includes) + static_dep = shared_dep else - dep_objs = ext_deps + shared_deps = ext_deps + static_deps = ext_deps foreach d:deps - dep_objs += [get_variable('dep_rte_' + d)] + shared_deps += [get_variable('shared_rte_' + d)] + static_deps += [get_variable('static_rte_' + d)] endforeach if get_option('per_library_versions')
@@ -100,26 +103,42 @@ foreach l:libraries so_version = lib_version endif + # first build static lib + static_lib = static_library(libname, + sources, + objects: objs, + c_args: cflags, + dependencies: static_deps, + include_directories: includes, + install: true) + static_dep = declare_dependency(link_with: static_lib, + include_directories: includes, + dependencies: static_deps) + + # then use pre-build objects to build shared lib + sources = [] + objs += static_lib.extract_all_objects() version_map = '@0@/@1@/rte_@2@_version.map'.format( meson.current_source_dir(), dir_name, name) - lib = library(libname, + shared_lib = shared_library(libname, sources, objects: objs, c_args: cflags, - dependencies: dep_objs, + dependencies: shared_deps, include_directories: includes, link_args: '-Wl,--version-script=' + version_map, link_depends: version_map, version: lib_version, soversion: so_version, install: true) - dep = declare_dependency(link_with: lib, + shared_dep = declare_dependency(link_with: shared_lib, include_directories: includes, - dependencies: dep_objs) + dependencies: shared_deps) - dpdk_libraries = [lib] + dpdk_libraries + dpdk_libraries = [shared_lib] + dpdk_libraries endif # sources.length() > 0 - set_variable('dep_' + libname, dep) + set_variable('shared_' + libname, shared_dep) + set_variable('static_' + libname, static_dep) endif # if build endforeach
meson.build +7 -15
@@ -43,15 +43,8 @@ dpdk_libraries = [] dpdk_drivers = [] dpdk_extra_ldflags = [] -# for static libs, treat the drivers as regular libraries, otherwise -# for shared libs, put them in a driver folder -if get_option('default_library') == 'static' - driver_install_path = get_option('libdir') - eal_pmd_path = '' -else - driver_install_path = join_paths(get_option('libdir'), 'dpdk/drivers') - eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) -endif +driver_install_path = join_paths(get_option('libdir'), 'dpdk/drivers') +eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) # configure the build, and make sure configs here and in config folder are # able to be included in any file. We also store a global array of include dirs
@@ -80,18 +73,17 @@ configure_file(output: build_cfg, install_dir: join_paths(get_option('includedir'), get_option('include_subdir_arch'))) -# for static builds, include the drivers as libs, and also any -# other dependent libs that DPDK needs to link against -if get_option('default_library') == 'static' - dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] - dpdk_libraries = dpdk_drivers + dpdk_libraries + dpdk_extra_ldflags -endif +# for static builds, include the drivers as libs and we need to "whole-archive" +# them. +dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] pkg = import('pkgconfig') pkg.generate(name: meson.project_name(), filebase: 'lib' + meson.project_name().to_lower(), version: meson.project_version(), libraries: dpdk_libraries, + libraries_private: dpdk_drivers + dpdk_libraries + + ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, description: 'The Data Plane Development Kit (DPDK)', subdirs: [get_option('include_subdir_arch'), '.'], extra_cflags: ['-include "rte_config.h"', '-march=@0@'.format(machine)]
Signature · 1 line
2.14.3
PATCH 4/6 build: change default library type to static
In reply to Bruce RichardsonNow that we always build both static and shared libraries, the default library type only applies to apps and examples. To avoid issues with paths when doing actual development with DPDK, change the default app build to static. This makes sure that testpmd, and any examples built as part of a development build, are runnable without being installed.
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -32,7 +32,7 @@ project('DPDK', 'C', version: '17.11.0', license: 'BSD', - default_options: ['buildtype=release'], + default_options: ['buildtype=release', 'default_library=static'], meson_version: '>= 0.41' )
Signature · 1 line
2.14.3
PATCH 5/6 build: symlink drivers to library directory
In reply to Bruce RichardsonWith the introduction of bus drivers, we now have a situation where driver libraries will start to depend upon each other. Because of this, the driver libs need to be discoverable by the dynamic loader.
There are three options to fix this:
1. Force the user to put the $libdir/dpdk/drivers folder into their library path.
2. Move all libraries from drivers sub-directory to $libdir.
3. Symlink all libraries from the subfolder to the main library dir.
Option 1 is not great for usability or distro packaging, and option 2 means that we can't have EAL load all drivers from a known path automatically (as it would error out on non-PMD libs), so option 3 was chosen as the best fix. The only downside is that on a "ninja uninstall" the symlinks are not removed, as they are unknown to meson/ninja.
--- buildtools/symlink-drivers-solibs.sh | 16 ++++++++++++++++ meson.build | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 buildtools/symlink-drivers-solibs.sh
buildtools/symlink-drivers-solibs.sh new file +16 -0
@@ -0,0 +1,16 @@ +#! /bin/sh + +# +# Copyright(c) 2017 Intel Corporation. +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause + +# post-install script for meson/ninja builds to symlink the PMDs stored in +# $libdir/dpdk/drivers/ to $libdir. This is needed as some PMDs depend on +# others, e.g. PCI device PMDs depending on the PCI bus driver. + +# parameters to script are paths relative to install prefix: +# 1. directory containing driver files e.g. lib64/dpdk/drivers +# 2. directory for installed regular libs e.g. lib64 +ln -sf ${DESTDIR}/${MESON_INSTALL_PREFIX}/$1/* ${DESTDIR}/${MESON_INSTALL_PREFIX}/$2
meson.build +7 -0
@@ -77,6 +77,13 @@ configure_file(output: build_cfg, # them. dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive'] +# driver .so files often depend upon the bus drivers for their connect bus, +# e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need +# to be in the library path, so symlink the drivers from the main lib directory. +meson.add_install_script('buildtools/symlink-drivers-solibs.sh', + driver_install_path, + get_option('libdir')) + pkg = import('pkgconfig') pkg.generate(name: meson.project_name(), filebase: 'lib' + meson.project_name().to_lower(),
Signature · 1 line
2.14.3
PATCH 6/6 examples: enable linking examples both static and shared
In reply to Bruce RichardsonSince the DPDK build now includes both static and shared libraries, we need a new way to enable building the examples using either method from the one installation. To do this, we add in a default "shared" target, and a separate "static" target which links in the DPDK static libraries. In both cases, the final application name is symlinked to the last-built static or shared target, with both binaries able to co-exist in the build directory.
--- examples/bond/Makefile | 21 ++++++++++++++++----- examples/cmdline/Makefile | 21 ++++++++++++++++----- examples/distributor/Makefile | 21 ++++++++++++++++----- examples/eventdev_pipeline_sw_pmd/Makefile | 21 ++++++++++++++++----- examples/exception_path/Makefile | 21 ++++++++++++++++----- examples/flow_classify/Makefile | 21 ++++++++++++++++----- examples/flow_filtering/Makefile | 21 ++++++++++++++++----- examples/helloworld/Makefile | 21 ++++++++++++++++----- examples/ip_fragmentation/Makefile | 21 ++++++++++++++++----- examples/ip_pipeline/Makefile | 21 ++++++++++++++++----- examples/ip_reassembly/Makefile | 21 ++++++++++++++++----- examples/ipsec-secgw/Makefile | 21 ++++++++++++++++----- examples/ipv4_multicast/Makefile | 21 ++++++++++++++++----- examples/kni/Makefile | 21 ++++++++++++++++----- examples/l2fwd-cat/Makefile | 21 ++++++++++++++++----- examples/l2fwd-crypto/Makefile | 21 ++++++++++++++++----- examples/l2fwd-jobstats/Makefile | 21 ++++++++++++++++----- examples/l2fwd-keepalive/Makefile | 21 ++++++++++++++++----- examples/l2fwd/Makefile | 21 ++++++++++++++++----- examples/l3fwd-acl/Makefile | 21 ++++++++++++++++----- examples/l3fwd-power/Makefile | 21 ++++++++++++++++----- examples/l3fwd-vf/Makefile | 21 ++++++++++++++++----- examples/l3fwd/Makefile | 21 ++++++++++++++++----- examples/link_status_interrupt/Makefile | 21 ++++++++++++++++----- examples/load_balancer/Makefile | 21 ++++++++++++++++----- examples/packet_ordering/Makefile | 21 ++++++++++++++++----- examples/ptpclient/Makefile | 21 ++++++++++++++++----- examples/qos_meter/Makefile | 21 ++++++++++++++++----- examples/qos_sched/Makefile | 21 ++++++++++++++++----- examples/rxtx_callbacks/Makefile | 21 ++++++++++++++++----- examples/service_cores/Makefile | 21 ++++++++++++++++----- examples/skeleton/Makefile | 21 ++++++++++++++++----- examples/tep_termination/Makefile | 21 ++++++++++++++++----- examples/timer/Makefile | 21 ++++++++++++++++----- examples/vhost/Makefile | 21 ++++++++++++++++----- examples/vhost_scsi/Makefile | 21 ++++++++++++++++----- examples/vmdq/Makefile | 21 ++++++++++++++++----- examples/vmdq_dcb/Makefile | 21 ++++++++++++++++----- 38 files changed, 608 insertions(+), 190 deletions(-)
examples/bond/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/cmdline/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c commands.c parse_obj_list.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/distributor/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/eventdev_pipeline_sw_pmd/Makefile +16 -5
@@ -38,19 +38,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/exception_path/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/flow_classify/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := flow_classify.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/flow_filtering/Makefile +16 -5
@@ -38,19 +38,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/helloworld/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/ip_fragmentation/Makefile +16 -5
@@ -40,19 +40,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/ip_pipeline/Makefile +16 -5
@@ -62,9 +62,17 @@ SRCS-y += pipeline_routing.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) VPATH += pipeline CFLAGS += -I. -I./pipeline/
@@ -74,15 +82,18 @@ OBJS := $(patsubst %.c,build/%.o,$(SRCS-y)) build/%.o: %.c Makefile $(PC_FILE) | build $(CC) $(CFLAGS) -c $< -o $@ -build/$(APP): $(OBJS) - $(CC) $(OBJS) -o $@ $(LDFLAGS) +build/$(APP)-shared: $(OBJS) + $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) + +build/$(APP)-static: $(OBJS) + $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) build/*.o + rm -f build/$(APP)* build/*.o rmdir --ignore-fail-on-non-empty build else
examples/ip_reassembly/Makefile +16 -5
@@ -40,19 +40,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/ipsec-secgw/Makefile +16 -5
@@ -49,19 +49,30 @@ CFLAGS += -gdwarf-2 $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/ipv4_multicast/Makefile +16 -5
@@ -40,19 +40,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/kni/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l2fwd-cat/Makefile +16 -5
@@ -39,22 +39,33 @@ SRCS-y := l2fwd-cat.c cat.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) CFLAGS += -D_GNU_SOURCE LDFLAGS += -lpqos -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) + +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l2fwd-crypto/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l2fwd-jobstats/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l2fwd-keepalive/Makefile +16 -5
@@ -40,19 +40,30 @@ LDFLAGS += -lrt $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l2fwd/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l3fwd-acl/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l3fwd-power/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l3fwd-vf/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/l3fwd/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c l3fwd_lpm.c l3fwd_em.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/link_status_interrupt/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/load_balancer/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c config.c init.c runtime.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/packet_ordering/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/ptpclient/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := ptpclient.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/qos_meter/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c rte_policer.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/qos_sched/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c args.c init.c app_thread.c cfg_file.c cmdline.c stats.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/rxtx_callbacks/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/service_cores/Makefile +16 -5
@@ -38,19 +38,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else
examples/skeleton/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := basicfwd.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/tep_termination/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c vxlan_setup.c vxlan.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/timer/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/vhost/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c virtio_net.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/vhost_scsi/Makefile +16 -5
@@ -41,19 +41,30 @@ CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/vmdq/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
examples/vmdq_dcb/Makefile +16 -5
@@ -39,19 +39,30 @@ SRCS-y := main.c $(shell pkg-config --exists libdpdk) ifeq ($(.SHELLSTATUS),0) +all: shared +.PHONY: shared static +shared: build/$(APP)-shared + ln -sf $(APP)-shared build/$(APP) +static: build/$(APP)-static + ln -sf $(APP)-static build/$(APP) + PC_FILE := $(shell pkg-config --path libdpdk) -CFLAGS += $(shell pkg-config --cflags libdpdk) -LDFLAGS += $(shell pkg-config --libs libdpdk) +CFLAGS += -O3 $(shell pkg-config --cflags libdpdk) +LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk) +LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk) + +build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) -build/$(APP): $(SRCS-y) Makefile $(PC_FILE) | build - $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) +build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build + $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC) build: @mkdir -p $@ .PHONY: clean clean: - rm -f build/$(APP) + rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared rmdir --ignore-fail-on-non-empty build else # Build using legacy build system
Signature · 1 line
2.14.3
Quoted 21 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both static and shared libraries when doing a build. The applications compiled as part of a build use either the shared or static libraries depending on what the
default_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so that external apps, like the examples, can be built using either the static or shared libraries. One of the key issues was the fact that running "pkg-config --static --libs libdpdk" outputs first the normal libs, and then the extra static ones. This is a problem because the driver libs are for static only builds, but need to come before, not after the standard DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags needed.
2. Modifying the single .pc file so that it was "good enough" to enable static builds without too much work.
Quoted 6 lines
For this version of this set, I took option #2. To link using dynamic libs, all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be seen in the changes to the example application makefiles, which now support building the examples using shared or static DPDK libs.
Just to emphasise that I'm looking for input into whether I took the right choice here. Option #1 has some advantages in that we can tune the output specifically for the static build case, but I wasn't sure whether it would be the done thing to have two different .pc files for a single package. Feedback from packagers welcome!
/Bruce
Quoted 53 lines · Bruce Richardson
Quoted 33 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both
static and shared libraries when doing a build. The applications compiled
as part of a build use either the shared or static libraries depending on
what thedefault_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so
that external apps, like the examples, can be built using either the static
or shared libraries. One of the key issues was the fact that running
"pkg-config --static --libs libdpdk" outputs first the normal libs, and
then the extra static ones. This is a problem because the driver libs are
for static only builds, but need to come before, not after the standard
DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags
needed.
2. Modifying the single .pc file so that it was "good enough" to enable
static builds without too much work.Quoted 9 lines
For this version of this set, I took option #2. To link using dynamic libs,
all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be
seen in the changes to the example application makefiles, which now support
building the examples using shared or static DPDK libs.Just to emphasise that I'm looking for input into whether I took the right choice here. Option #1 has some advantages in that we can tune the
output specifically for the static build case, but I wasn't sure whether
it would be the done thing to have two different .pc files for a single
package. Feedback from packagers welcome!
Quoted 1 line
/Bruce
I don't link #1 too much - too "special". I think an additional flag is more friendly.
A good solution would be a Cflags.private feature, sadly that is not supported by pkgconfig despite many requests for it.
A possible way to sugar-coat it could be to add a custom variable, and then instruct the users to do something like:
$(shell pkg-config --variable=ldflags.static libdpdk) $(shell pkg- config --static --libs libdpdk)
Unfortunately, again, --variable cannot be used together with --libs in the same call.
Signature · 2 lines
Kind regards, Luca Boccassi
Quoted 112 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both
static and shared libraries when doing a build. The applications compiled
as part of a build use either the shared or static libraries depending on
what thedefault_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so
that external apps, like the examples, can be built using either the static
or shared libraries. One of the key issues was the fact that running "pkg-config --static --libs libdpdk" outputs first the normal libs, and
then the extra static ones. This is a problem because the driver libs are
for static only builds, but need to come before, not after the standard
DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags
needed.
2. Modifying the single .pc file so that it was "good enough" to enable
static builds without too much work.For this version of this set, I took option #2. To link using dynamic libs,
all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be
seen in the changes to the example application makefiles, which now support
building the examples using shared or static DPDK libs.Bruce Richardson (6):
build: remove library special cases
eal: fix list of source files to meson build
build: build all libs and drivers as both static and shared
build: change default library type to static
build: symlink drivers to library directory
examples: enable linking examples both static and sharedapp/test-pmd/meson.build | 5 +- buildtools/symlink-drivers-solibs.sh | 16 ++++ config/meson.build | 14 ++++ doc/guides/contributing/coding_style.rst | 9 +++ drivers/meson.build | 43 +++++++--- drivers/net/e1000/base/meson.build | 2 +- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/i40e/base/meson.build | 2 +- drivers/net/ixgbe/base/meson.build | 2 +- examples/bond/Makefile | 21 +++-- examples/cmdline/Makefile | 21 +++-- examples/distributor/Makefile | 21 +++-- examples/eventdev_pipeline_sw_pmd/Makefile | 21 +++-- examples/exception_path/Makefile | 21 +++-- examples/flow_classify/Makefile | 21 +++-- examples/flow_filtering/Makefile | 21 +++-- examples/helloworld/Makefile | 21 +++-- examples/ip_fragmentation/Makefile | 21 +++-- examples/ip_pipeline/Makefile | 21 +++-- examples/ip_reassembly/Makefile | 21 +++-- examples/ipsec-secgw/Makefile | 21 +++-- examples/ipv4_multicast/Makefile | 21 +++-- examples/kni/Makefile | 21 +++-- examples/l2fwd-cat/Makefile | 21 +++-- examples/l2fwd-crypto/Makefile | 21 +++-- examples/l2fwd-jobstats/Makefile | 21 +++-- examples/l2fwd-keepalive/Makefile | 21 +++-- examples/l2fwd/Makefile | 21 +++-- examples/l3fwd-acl/Makefile | 21 +++-- examples/l3fwd-power/Makefile | 21 +++-- examples/l3fwd-vf/Makefile | 21 +++-- examples/l3fwd/Makefile | 21 +++-- examples/link_status_interrupt/Makefile | 21 +++-- examples/load_balancer/Makefile | 21 +++-- examples/meson.build | 2 +- examples/packet_ordering/Makefile | 21 +++--
examples/ptpclient/Makefile | 21 +++-- examples/qos_meter/Makefile | 21 +++-- examples/qos_sched/Makefile | 21 +++--examples/rxtx_callbacks/Makefile | 21 +++-- examples/service_cores/Makefile | 21 +++-- examples/skeleton/Makefile | 21 +++-- examples/tep_termination/Makefile | 21 +++-- examples/timer/Makefile | 21 +++-- examples/vhost/Makefile | 21 +++-- examples/vhost_scsi/Makefile | 21 +++-- examples/vmdq/Makefile | 21 +++-- examples/vmdq_dcb/Makefile | 21 +++-- lib/librte_eal/bsdapp/eal/meson.build | 34 +------- lib/librte_eal/bsdapp/meson.build | 55 ------------- lib/librte_eal/common/arch/meson.build | 33 --------
lib/librte_eal/common/include/arch/meson.build| 33 -------- lib/librte_eal/common/include/meson.build | 71 -------------
---
lib/librte_eal/common/meson.build | 74 ++++++++++++++- --
lib/librte_eal/linuxapp/eal/meson.build | 36 +-------- lib/librte_eal/linuxapp/igb_uio/meson.build | 8 +- lib/librte_eal/linuxapp/meson.build | 42 ---------- lib/librte_eal/meson.build | 45 +++++++++-- lib/meson.build | 107
++++++++++++++++---------
meson.build | 31 ++++---
Quoted 8 lines
60 files changed, 885 insertions(+), 579 deletions(-)create mode 100644
buildtools/symlink-drivers-solibs.shdelete mode 100644lib/librte_eal/bsdapp/meson.builddelete mode 100644lib/librte_eal/common/arch/meson.builddelete mode 100644lib/librte_eal/common/include/arch/meson.builddelete mode 100644lib/librte_eal/common/include/meson.builddelete mode 100644lib/librte_eal/linuxapp/meson.build
Tested with my Debian build, looks good!
Signature · 2 lines
Kind regards, Luca Boccassi
Quoted 54 lines · Luca Boccassi
Quoted 53 lines · Bruce Richardson
Quoted 33 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both
static and shared libraries when doing a build. The applications compiled
as part of a build use either the shared or static libraries depending on
what thedefault_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so
that external apps, like the examples, can be built using either the static
or shared libraries. One of the key issues was the fact that running
"pkg-config --static --libs libdpdk" outputs first the normal libs, and
then the extra static ones. This is a problem because the driver libs are
for static only builds, but need to come before, not after the standard
DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags
needed.
2. Modifying the single .pc file so that it was "good enough" to enable
static builds without too much work.Quoted 9 lines
For this version of this set, I took option #2. To link using dynamic libs,
all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be
seen in the changes to the example application makefiles, which now support
building the examples using shared or static DPDK libs.Just to emphasise that I'm looking for input into whether I took the right choice here. Option #1 has some advantages in that we can tune the
output specifically for the static build case, but I wasn't sure whether
it would be the done thing to have two different .pc files for a single
package. Feedback from packagers welcome!
Quoted 5 lines
Quoted 1 line
/Bruce
I don't link #1 too much - too "special". I think an additional flag is more friendly.
Yes, it is not very neat indeed. The main advantage of it would include the fact that we could do away with all the -Wl,-Bstatic/-Bdynamic flags completely, and have the libs line just have the direct paths to the .a files.
Quoted 3 lines
A good solution would be a Cflags.private feature, sadly that is not supported by pkgconfig despite many requests for it.
Not sure that would help. It's the ldflags that need to be special-cased, as far as I can see.
Quoted 8 lines
A possible way to sugar-coat it could be to add a custom variable, and then instruct the users to do something like:
$(shell pkg-config --variable=ldflags.static libdpdk) $(shell pkg- config --static --libs libdpdk)
Unfortunately, again, --variable cannot be used together with --libs in the same call.
Yes, that could work, but having the user specific a special variable from pkgconfig is just as much work as just telling the user to add -Wl,-Bstatic to their existing pkg-config lines.
In any case, none of this is cast in stone. Even after this is merged, we can support #1 alongside this if that turns out to be easier for users.
/Bruce
Quoted 122 lines · Luca Boccassi
Quoted 112 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both
static and shared libraries when doing a build. The applications compiled
as part of a build use either the shared or static libraries depending on
what thedefault_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so
that external apps, like the examples, can be built using either the static
or shared libraries. One of the key issues was the fact that running "pkg-config --static --libs libdpdk" outputs first the normal libs, and
then the extra static ones. This is a problem because the driver libs are
for static only builds, but need to come before, not after the standard
DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags
needed.
2. Modifying the single .pc file so that it was "good enough" to enable
static builds without too much work.For this version of this set, I took option #2. To link using dynamic libs,
all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be
seen in the changes to the example application makefiles, which now support
building the examples using shared or static DPDK libs.Bruce Richardson (6):
build: remove library special cases
eal: fix list of source files to meson build
build: build all libs and drivers as both static and shared
build: change default library type to static
build: symlink drivers to library directory
examples: enable linking examples both static and sharedapp/test-pmd/meson.build | 5 +- buildtools/symlink-drivers-solibs.sh | 16 ++++ config/meson.build | 14 ++++ doc/guides/contributing/coding_style.rst | 9 +++ drivers/meson.build | 43 +++++++--- drivers/net/e1000/base/meson.build | 2 +- drivers/net/fm10k/base/meson.build | 2 +- drivers/net/i40e/base/meson.build | 2 +- drivers/net/ixgbe/base/meson.build | 2 +- examples/bond/Makefile | 21 +++-- examples/cmdline/Makefile | 21 +++-- examples/distributor/Makefile | 21 +++-- examples/eventdev_pipeline_sw_pmd/Makefile | 21 +++-- examples/exception_path/Makefile | 21 +++-- examples/flow_classify/Makefile | 21 +++-- examples/flow_filtering/Makefile | 21 +++-- examples/helloworld/Makefile | 21 +++-- examples/ip_fragmentation/Makefile | 21 +++-- examples/ip_pipeline/Makefile | 21 +++-- examples/ip_reassembly/Makefile | 21 +++-- examples/ipsec-secgw/Makefile | 21 +++-- examples/ipv4_multicast/Makefile | 21 +++-- examples/kni/Makefile | 21 +++-- examples/l2fwd-cat/Makefile | 21 +++-- examples/l2fwd-crypto/Makefile | 21 +++-- examples/l2fwd-jobstats/Makefile | 21 +++-- examples/l2fwd-keepalive/Makefile | 21 +++-- examples/l2fwd/Makefile | 21 +++-- examples/l3fwd-acl/Makefile | 21 +++-- examples/l3fwd-power/Makefile | 21 +++-- examples/l3fwd-vf/Makefile | 21 +++-- examples/l3fwd/Makefile | 21 +++-- examples/link_status_interrupt/Makefile | 21 +++-- examples/load_balancer/Makefile | 21 +++-- examples/meson.build | 2 +- examples/packet_ordering/Makefile | 21 +++--
examples/ptpclient/Makefile | 21 +++-- examples/qos_meter/Makefile | 21 +++-- examples/qos_sched/Makefile | 21 +++--examples/rxtx_callbacks/Makefile | 21 +++-- examples/service_cores/Makefile | 21 +++-- examples/skeleton/Makefile | 21 +++-- examples/tep_termination/Makefile | 21 +++-- examples/timer/Makefile | 21 +++-- examples/vhost/Makefile | 21 +++-- examples/vhost_scsi/Makefile | 21 +++-- examples/vmdq/Makefile | 21 +++-- examples/vmdq_dcb/Makefile | 21 +++-- lib/librte_eal/bsdapp/eal/meson.build | 34 +------- lib/librte_eal/bsdapp/meson.build | 55 ------------- lib/librte_eal/common/arch/meson.build | 33 --------
lib/librte_eal/common/include/arch/meson.build| 33 -------- lib/librte_eal/common/include/meson.build | 71 -------------
---
lib/librte_eal/common/meson.build | 74 ++++++++++++++- --
lib/librte_eal/linuxapp/eal/meson.build | 36 +-------- lib/librte_eal/linuxapp/igb_uio/meson.build | 8 +- lib/librte_eal/linuxapp/meson.build | 42 ---------- lib/librte_eal/meson.build | 45 +++++++++-- lib/meson.build | 107
++++++++++++++++---------
meson.build | 31 ++++---Quoted 8 lines
60 files changed, 885 insertions(+), 579 deletions(-)create mode 100644
buildtools/symlink-drivers-solibs.shdelete mode 100644lib/librte_eal/bsdapp/meson.builddelete mode 100644lib/librte_eal/common/arch/meson.builddelete mode 100644lib/librte_eal/common/include/arch/meson.builddelete mode 100644lib/librte_eal/common/include/meson.builddelete mode 100644lib/librte_eal/linuxapp/meson.build
Quoted 2 lines
Acked-by Luca Boccassi <[email protected]>
Pushed to dpdk-next-build.
[One change made from submitted patches in that the new file was added with a traditional license header, rather than SPDX tag, given that the format of the tags is not fully locked-down. Once that's settled, the new file can be updated along with all the other meson build system ones.]
/Bruce
Quoted 54 lines · Luca Boccassi
Quoted 53 lines · Bruce Richardson
Quoted 33 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both
static and shared libraries when doing a build. The applications compiled
as part of a build use either the shared or static libraries depending on
what thedefault_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so
that external apps, like the examples, can be built using either the static
or shared libraries. One of the key issues was the fact that running
"pkg-config --static --libs libdpdk" outputs first the normal libs, and
then the extra static ones. This is a problem because the driver libs are
for static only builds, but need to come before, not after the standard
DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags
needed.
2. Modifying the single .pc file so that it was "good enough" to enable
static builds without too much work.Quoted 9 lines
For this version of this set, I took option #2. To link using dynamic libs,
all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be
seen in the changes to the example application makefiles, which now support
building the examples using shared or static DPDK libs.Just to emphasise that I'm looking for input into whether I took the right choice here. Option #1 has some advantages in that we can tune the
output specifically for the static build case, but I wasn't sure whether
it would be the done thing to have two different .pc files for a single
package. Feedback from packagers welcome!
Quoted 4 lines
Quoted 1 line
/Bruce
I don't link #1 too much - too "special". I think an additional flag is more friendly.
I agree with this.
Quoted 8 lines
A good solution would be a Cflags.private feature, sadly that is not supported by pkgconfig despite many requests for it.
A possible way to sugar-coat it could be to add a custom variable, and then instruct the users to do something like:
$(shell pkg-config --variable=ldflags.static libdpdk) $(shell pkg- config --static --libs libdpdk)
I don't think this is needed. Most linkers (and libtool based linkers as well) have no 'distinction' between static / dynamic - just the static option gets passed.
In this case, I think it's fine to require the application build system to expose such a distinct option to the user doing the builds. There's generally no good reasons to want static builds (well... okay that's a bit strong, but hopefully I don't get my head chewed off) anyway, so making them slightly more work is okay by me.
Quoted 2 lines
Unfortunately, again, --variable cannot be used together with --libs in the same call.
Quoted 76 lines · Aaron Conole
Quoted 54 lines · Luca Boccassi
Quoted 53 lines · Bruce Richardson
Quoted 33 lines · Bruce Richardson
This patchset changes the meson+ninja build system to always create both
static and shared libraries when doing a build. The applications compiled
as part of a build use either the shared or static libraries depending on
what thedefault_librarybuild setting is.NOTE:
The main difficulty with this change is adjusting the pkgconfig file so
that external apps, like the examples, can be built using either the static
or shared libraries. One of the key issues was the fact that running
"pkg-config --static --libs libdpdk" outputs first the normal libs, and
then the extra static ones. This is a problem because the driver libs are
for static only builds, but need to come before, not after the standard
DDPK libraries. It also procludes adding in the -Wl,-Bstatic flag into the output for the standard libraries to link them statically.There were two options considered for mananging the pkg-config settings.
1. Creating a separate .pc file for static builds with exactly the flags
needed.
2. Modifying the single .pc file so that it was "good enough" to enable
static builds without too much work.Quoted 9 lines
For this version of this set, I took option #2. To link using dynamic libs,
all is as normal, to use static libs, the user needs to prepend "-Wl,-Bstatic" before the "pkgconfig --static" library output. This can be
seen in the changes to the example application makefiles, which now support
building the examples using shared or static DPDK libs.Just to emphasise that I'm looking for input into whether I took the right choice here. Option #1 has some advantages in that we can tune the
output specifically for the static build case, but I wasn't sure whether
it would be the done thing to have two different .pc files for a single
package. Feedback from packagers welcome!Quoted 4 lines
Quoted 1 line
/Bruce
I don't link #1 too much - too "special". I think an additional flag is more friendly.
I agree with this.
Quoted 8 lines
A good solution would be a Cflags.private feature, sadly that is not supported by pkgconfig despite many requests for it.
A possible way to sugar-coat it could be to add a custom variable, and then instruct the users to do something like:
$(shell pkg-config --variable=ldflags.static libdpdk) $(shell pkg- config --static --libs libdpdk)
I don't think this is needed. Most linkers (and libtool based linkers as well) have no 'distinction' between static / dynamic - just the static option gets passed.
Quoted 6 lines
In this case, I think it's fine to require the application build system to expose such a distinct option to the user doing the builds. There's generally no good reasons to want static builds (well... okay that's a bit strong, but hopefully I don't get my head chewed off) anyway, so making them slightly more work is okay by me.
Ok, thanks for the input. Seems like we have a consensus on the approach (which has already been merged).