[network-manager-openvpn] build: build shared files individually without creating a library



commit 3f5d77983f61c390b587f1835cf04cfb8ffcea15
Author: Thomas Haller <thaller redhat com>
Date:   Thu Jun 16 11:30:08 2016 +0200

    build: build shared files individually without creating a library
    
    Previously, we would build static libraries out of the shared
    files. But the users (in properties/, src/, auth-dialog/) themself
    want to build those files differently.
    
    For example, the core part under src/ wants to include <glib/gi18n.h>
    for translation, while the properties/ shall use <glib/gi18n-lib.h>.
    We get this right via "nm-default.h" and NETWORKMANAGER_COMPILATION,
    but for that we have to rebuild the files each time.
    
    Instead, let each user of those files explicitly pick the shared
    files as source.
    
    To workaround a bug in autotools, we have to disable subdir-objects
    (see https://lists.gnu.org/archive/html/automake/2015-08/msg00003.html).

 auth-dialog/Makefile.am |    5 ++-
 configure.ac            |    2 +-
 properties/Makefile.am  |   24 ++++++++++++-----
 shared/Makefile.am      |   67 +++++-----------------------------------------
 src/Makefile.am         |   22 ++++++++++-----
 5 files changed, 43 insertions(+), 77 deletions(-)
---
diff --git a/auth-dialog/Makefile.am b/auth-dialog/Makefile.am
index 0042f3a..a687b2c 100644
--- a/auth-dialog/Makefile.am
+++ b/auth-dialog/Makefile.am
@@ -13,13 +13,14 @@ nm_openvpn_auth_dialog_CPPFLAGS =                   \
        -DGNOMELOCALEDIR=\"$(datadir)/locale\"
 
 nm_openvpn_auth_dialog_SOURCES = \
+       $(top_srcdir)/shared/utils.c \
+       $(top_srcdir)/shared/utils.h \
        main.c
 
 nm_openvpn_auth_dialog_LDADD = \
        $(GTK_LIBS) \
        $(LIBNM_LIBS) \
        $(LIBNMA_LIBS) \
-       $(LIBSECRET_LIBS) \
-       $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
+       $(LIBSECRET_LIBS)
 
 CLEANFILES = *~
diff --git a/configure.ac b/configure.ac
index fd34617..e2e9c3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_INIT(NetworkManager-openvpn,
         1.2.3,
         https://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager,
         NetworkManager-openvpn)
-AM_INIT_AUTOMAKE([1.9 subdir-objects tar-ustar no-dist-gzip dist-xz])
+AM_INIT_AUTOMAKE([1.9 tar-ustar no-dist-gzip dist-xz])
 AM_MAINTAINER_MODE
 
 AC_CONFIG_MACRO_DIR([m4])
diff --git a/properties/Makefile.am b/properties/Makefile.am
index 028709d..552e537 100644
--- a/properties/Makefile.am
+++ b/properties/Makefile.am
@@ -9,6 +9,14 @@ plugin_LTLIBRARIES += libnm-openvpn-properties.la
 endif
 endif
 
+shared_sources = \
+        $(top_srcdir)/shared/nm-utils/nm-shared-utils.c \
+        $(top_srcdir)/shared/nm-utils/nm-shared-utils.h \
+        $(top_srcdir)/shared/utils.c \
+        $(top_srcdir)/shared/utils.h \
+        $(top_srcdir)/shared/nm-service-defines.h \
+        $(NULL)
+
 plugin_sources = \
         nm-openvpn-editor-plugin.c \
         nm-openvpn-editor-plugin.h \
@@ -36,6 +44,10 @@ common_CFLAGS =                                         \
 ###############################################################################
 
 libnm_vpn_plugin_openvpn_la_SOURCES = \
+        $(shared_sources) \
+        $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c \
+        $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.h \
+        $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-macros.h \
         $(plugin_sources)
 
 libnm_vpn_plugin_openvpn_la_CFLAGS =                    \
@@ -45,9 +57,7 @@ libnm_vpn_plugin_openvpn_la_CFLAGS =                    \
         $(LIBNM_CFLAGS)
 
 libnm_vpn_plugin_openvpn_la_LIBADD = \
-        $(LIBNM_LIBS) \
-        $(top_builddir)/shared/libnm-vpn-editor-utils-shared.la \
-        $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
+        $(LIBNM_LIBS)
 
 libnm_vpn_plugin_openvpn_la_LDFLAGS = \
         -avoid-version \
@@ -56,6 +66,7 @@ libnm_vpn_plugin_openvpn_la_LDFLAGS = \
 ###############################################################################
 
 libnm_vpn_plugin_openvpn_editor_la_SOURCES = \
+        $(shared_sources) \
         $(editor_sources)
 
 libnm_vpn_plugin_openvpn_editor_la_CFLAGS = \
@@ -68,8 +79,7 @@ libnm_vpn_plugin_openvpn_editor_la_CFLAGS = \
 libnm_vpn_plugin_openvpn_editor_la_LIBADD = \
         $(GTK_LIBS) \
         $(LIBNM_LIBS) \
-        $(LIBNMA_LIBS) \
-        $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
+        $(LIBNMA_LIBS)
 
 libnm_vpn_plugin_openvpn_editor_la_LDFLAGS = \
         -avoid-version \
@@ -78,6 +88,7 @@ libnm_vpn_plugin_openvpn_editor_la_LDFLAGS = \
 ###############################################################################
 
 libnm_openvpn_properties_la_SOURCES = \
+        $(shared_sources) \
         $(plugin_sources) \
         $(editor_sources)
 
@@ -92,8 +103,7 @@ libnm_openvpn_properties_la_CFLAGS =                \
 libnm_openvpn_properties_la_LIBADD =                \
         $(GTK_LIBS)                                     \
         $(LIBNM_GLIB_LIBS)                              \
-        $(LIBNM_GTK_LIBS)                               \
-        $(top_builddir)/shared/libnm-openvpn-shared.la
+        $(LIBNM_GTK_LIBS)
 
 libnm_openvpn_properties_la_LDFLAGS = \
         -avoid-version \
diff --git a/shared/Makefile.am b/shared/Makefile.am
index b8cf611..3acc1a5 100644
--- a/shared/Makefile.am
+++ b/shared/Makefile.am
@@ -1,63 +1,12 @@
-noinst_LTLIBRARIES = \
-       libnm-vpn-plugin-openvpn-shared.la \
-       libnm-vpn-editor-utils-shared.la
-if WITH_LIBNM_GLIB
-noinst_LTLIBRARIES += libnm-openvpn-shared.la
-endif
-
-shared_sources = \
+EXTRA_DIST = \
+    nm-utils/gsystem-local-alloc.h \
+    nm-utils/nm-glib.h \
+    nm-utils/nm-macros-internal.h \
     nm-utils/nm-shared-utils.c \
     nm-utils/nm-shared-utils.h \
+    nm-utils/nm-test-utils.h \
+    nm-default.h \
+    nm-service-defines.h \
     utils.c \
     utils.h \
-    nm-service-defines.h
-
-###############################################################################
-
-libnm_vpn_plugin_openvpn_shared_la_CPPFLAGS = \
-    $(LIBNM_CFLAGS) \
-    -I$(top_srcdir)/shared
-
-libnm_vpn_plugin_openvpn_shared_la_SOURCES= \
-    $(shared_sources)
-
-libnm_vpn_plugin_openvpn_shared_la_LIBADD = \
-    $(LIBNM_LIBS)
-
-###############################################################################
-
-libnm_openvpn_shared_la_SOURCES = \
-    $(shared_sources)
-
-libnm_openvpn_shared_la_CPPFLAGS = \
-    -DNM_VPN_OLD \
-    $(LIBNM_GLIB_CFLAGS) \
-    -I$(top_srcdir)/shared
-
-libnm_openvpn_shared_la_LIBADD = \
-    $(LIBNM_GLIB_LIBS)
-
-###############################################################################
-
-libnm_vpn_editor_utils_shared_la_CPPFLAGS = \
-    $(LIBNM_CFLAGS) \
-    -I$(top_srcdir)/shared
-
-libnm_vpn_editor_utils_shared_la_SOURCES = \
-    nm-utils/nm-vpn-plugin-utils.c \
-    nm-utils/nm-vpn-plugin-utils.h \
-    nm-utils/nm-vpn-plugin-macros.h
-
-libnm_vpn_editor_utils_shared_la_LIBADD = \
-    $(LIBNM_LIBS) \
-    -ldl
-
-###############################################################################
-
-EXTRA_DIST = \
-     nm-utils/gsystem-local-alloc.h \
-     nm-utils/nm-glib.h \
-     nm-utils/nm-macros-internal.h \
-     nm-utils/nm-test-utils.h \
-     nm-default.h
-
+    $(NULL)
diff --git a/src/Makefile.am b/src/Makefile.am
index 5f8ed86..0bd68b7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,26 +16,32 @@ libexec_PROGRAMS = \
        nm-openvpn-service \
        nm-openvpn-service-openvpn-helper
 
+shared_sources = \
+       $(top_srcdir)/shared/nm-utils/nm-shared-utils.c \
+       $(top_srcdir)/shared/nm-utils/nm-shared-utils.h \
+       $(top_srcdir)/shared/utils.c \
+       $(top_srcdir)/shared/utils.h \
+       $(top_srcdir)/shared/nm-service-defines.h \
+       $(NULL)
+
 ###############################################################################
 
 nm_openvpn_service_SOURCES = \
+       $(shared_sources) \
        nm-openvpn-service.c \
-       nm-openvpn-service.h \
-       $(top_srcdir)/shared/nm-service-defines.h
+       nm-openvpn-service.h
 
 nm_openvpn_service_LDADD = \
-       $(LIBNM_LIBS) \
-       $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
+       $(LIBNM_LIBS)
 
 ###############################################################################
 
 nm_openvpn_service_openvpn_helper_SOURCES = \
-       nm-openvpn-service-openvpn-helper.c \
-       $(top_srcdir)/shared/nm-service-defines.h
+       $(shared_sources) \
+       nm-openvpn-service-openvpn-helper.c
 
 nm_openvpn_service_openvpn_helper_LDADD = \
-       $(LIBNM_LIBS) \
-       $(top_builddir)/shared/libnm-vpn-plugin-openvpn-shared.la
+       $(LIBNM_LIBS)
 
 ###############################################################################
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]