summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-01-04 13:55:07 +0100
committerThomas Haller <thaller@redhat.com>2020-01-08 11:23:24 +0100
commit7d8da6c9c1506f554a84a0edb5f26a7c7e833285 (patch)
tree713f6a13188b760fda0a9f445fa96aa18378d616
parent5ed1edc02a064d48017b56bfa929ec4c08795a10 (diff)
downloadNetworkManager-7d8da6c9c1506f554a84a0edb5f26a7c7e833285.tar.gz
build: build intermediate library with core wifi for device-plugin and tests
Don't build the same sources multiple times. The test code should statically link against the tested code, just like the device plugin that uses the code in production.
-rw-r--r--Makefile.am34
-rw-r--r--src/devices/wifi/meson.build46
2 files changed, 52 insertions, 28 deletions
diff --git a/Makefile.am b/Makefile.am
index f8020794b4..1673fc1fc3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3606,9 +3606,9 @@ EXTRA_DIST += \
if WITH_WIFI
-core_plugins += src/devices/wifi/libnm-device-plugin-wifi.la
+noinst_LTLIBRARIES += src/devices/wifi/libnm-wifi-base.la
-src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
+src_devices_wifi_libnm_wifi_base_la_SOURCES = \
src/devices/wifi/nm-device-olpc-mesh.c \
src/devices/wifi/nm-device-olpc-mesh.h \
src/devices/wifi/nm-device-wifi-p2p.c \
@@ -3619,7 +3619,6 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
src/devices/wifi/nm-wifi-ap.h \
src/devices/wifi/nm-wifi-common.c \
src/devices/wifi/nm-wifi-common.h \
- src/devices/wifi/nm-wifi-factory.c \
src/devices/wifi/nm-wifi-p2p-peer.c \
src/devices/wifi/nm-wifi-p2p-peer.h \
src/devices/wifi/nm-wifi-utils.c \
@@ -3627,7 +3626,7 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
$(NULL)
if WITH_IWD
-src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES += \
+src_devices_wifi_libnm_wifi_base_la_SOURCES += \
src/devices/wifi/nm-device-iwd.c \
src/devices/wifi/nm-device-iwd.h \
src/devices/wifi/nm-iwd-manager.c \
@@ -3635,6 +3634,19 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES += \
$(NULL)
endif
+src_devices_wifi_libnm_wifi_base_la_CPPFLAGS = $(src_cppflags_device_plugin)
+
+src_devices_wifi_libnm_wifi_base_la_LIBADD = \
+ $(GLIB_LIBS)
+
+$(src_devices_wifi_libnm_wifi_base_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
+
+core_plugins += src/devices/wifi/libnm-device-plugin-wifi.la
+
+src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES = \
+ src/devices/wifi/nm-wifi-factory.c \
+ $(NULL)
+
src_devices_wifi_libnm_device_plugin_wifi_la_CPPFLAGS = $(src_cppflags_device_plugin)
src_devices_wifi_libnm_device_plugin_wifi_la_LDFLAGS = \
@@ -3642,8 +3654,11 @@ src_devices_wifi_libnm_device_plugin_wifi_la_LDFLAGS = \
-Wl,--version-script="$(srcdir)/linker-script-devices.ver"
src_devices_wifi_libnm_device_plugin_wifi_la_LIBADD = \
+ src/devices/wifi/libnm-wifi-base.la \
$(GLIB_LIBS)
+$(src_devices_wifi_libnm_device_plugin_wifi_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
+
check-local-devices-wifi: src/devices/wifi/libnm-device-plugin-wifi.la
$(srcdir)/tools/check-exports.sh $(builddir)/src/devices/wifi/.libs/libnm-device-plugin-wifi.so "$(srcdir)/linker-script-devices.ver"
$(call check_so_symbols,$(builddir)/src/devices/wifi/.libs/libnm-device-plugin-wifi.so)
@@ -3654,14 +3669,15 @@ check_programs += src/devices/wifi/tests/test-devices-wifi
src_devices_wifi_tests_test_devices_wifi_SOURCES = \
src/devices/wifi/tests/test-devices-wifi.c \
- src/devices/wifi/nm-wifi-ap.c \
- src/devices/wifi/nm-wifi-ap.h \
- src/devices/wifi/nm-wifi-utils.c \
- src/devices/wifi/nm-wifi-utils.h
+ $(NULL)
src_devices_wifi_tests_test_devices_wifi_CPPFLAGS = $(src_cppflags_base_test)
-src_devices_wifi_tests_test_devices_wifi_LDADD = src/libNetworkManagerTest.la
+src_devices_wifi_tests_test_devices_wifi_LDADD = \
+ src/libNetworkManagerTest.la \
+ src/devices/wifi/libnm-wifi-base.la \
+ $(NULL)
+
src_devices_wifi_tests_test_devices_wifi_LDFLAGS = $(SANITIZER_EXEC_LDFLAGS)
$(src_devices_wifi_tests_test_devices_wifi_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build
index 6566f20119..9f18a36b18 100644
--- a/src/devices/wifi/meson.build
+++ b/src/devices/wifi/meson.build
@@ -1,28 +1,36 @@
-common_sources = files(
- 'nm-wifi-ap.c',
- 'nm-wifi-p2p-peer.c',
- 'nm-wifi-utils.c',
-)
-
-sources = common_sources + files(
- 'nm-device-olpc-mesh.c',
- 'nm-device-wifi-p2p.c',
- 'nm-device-wifi.c',
- 'nm-wifi-common.c',
- 'nm-wifi-factory.c',
-)
-
+iwd_sources = files()
if enable_iwd
- sources += files(
+ iwd_sources += files(
'nm-device-iwd.c',
'nm-iwd-manager.c',
)
endif
+libnm_wifi_base = static_library(
+ 'nm-wifi-base',
+ sources: files(
+ 'nm-device-olpc-mesh.c',
+ 'nm-device-wifi-p2p.c',
+ 'nm-device-wifi.c',
+ 'nm-wifi-ap.c',
+ 'nm-wifi-common.c',
+ 'nm-wifi-p2p-peer.c',
+ 'nm-wifi-utils.c',
+ ) + iwd_sources,
+ dependencies: daemon_nm_default_dep,
+ c_args: daemon_c_flags,
+)
+
+libnm_wifi_base_dep = declare_dependency(
+ link_with: libnm_wifi_base,
+)
+
libnm_device_plugin_wifi = shared_module(
'nm-device-plugin-wifi',
- sources: sources,
- dependencies: daemon_nm_default_dep,
+ sources: files(
+ 'nm-wifi-factory.c',
+ ),
+ dependencies: [ daemon_nm_default_dep, libnm_wifi_base_dep ],
c_args: daemon_c_flags,
link_args: ldflags_linker_script_devices,
link_depends: linker_script_devices,
@@ -43,8 +51,8 @@ if enable_tests
exe = executable(
test_unit,
- ['tests/' + test_unit + '.c'] + common_sources,
- dependencies: libnetwork_manager_test_dep,
+ 'tests/' + test_unit + '.c',
+ dependencies: [ libnetwork_manager_test_dep, libnm_wifi_base_dep ],
c_args: test_c_flags,
)