[gnome-photos/wip/rishi/buffer-decoder: 1/12] build: Rearrange the Makefile.am for subsequent changes



commit 2f2f1813682f9f53d3ead13c9c2764742ca07d17
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Oct 2 12:55:45 2018 +0200

    build: Rearrange the Makefile.am for subsequent changes
    
    A subsequent commit will split some common code into a private shared
    library. It's desirable to ensure that each binary artifact doesn't
    inadvertently grow new dependencies.
    
    So far, there was a global AM_CPPFLAGS and target-specific LDADDs.
    It means that the build would've only failed for unintended linker
    dependencies while linking the final binaries, and not while compiling
    the individual translation units into object files. This is improved
    by replacing the global AM_CPPFLAGS with target-specific CPPFLAGS. It
    is likely to catch such issues sooner because linker dependencies are
    often accompanied by matching preprocessor dependencies; and also
    prevent against inadvertent preprocessor-only dependencies.
    
    Using target-specific CPPFLAGS does have the negative side-effect of
    building the common source files multiple times - once for each target.
    Hopefully this will only be a temporary setback until the common code
    is split out into a private shared library.
    
    The target-specific variables were moved closer to their SOURCES
    counterparts for better readability.
    
    https://gitlab.gnome.org/GNOME/gnome-photos/issues/63

 src/Makefile.am | 173 +++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 102 insertions(+), 71 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b13dfb6e..1ebaf665 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,27 @@
+pkglib_LTLIBRARIES = libgnome-photos.la
+
 bin_PROGRAMS = gnome-photos
 
 libexec_PROGRAMS = gnome-photos-thumbnailer
 
+libgnome_photos_la_SOURCES = \
+       photos-quarks.c \
+       photos-quarks.h \
+       $(NULL)
+
+libgnome_photos_la_CPPFLAGS = \
+       $(GLIB_CFLAGS) \
+       $(NULL)
+
+libgnome_photos_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
+       -avoid-version \
+       $(NULL)
+
+libgnome_photos_la_LIBADD = \
+       $(GLIB_LIBS) \
+       $(NULL)
+
 gnome_photos_built_sources = \
        photos-about-data.c \
        photos-about-data.h \
@@ -195,8 +215,6 @@ gnome_photos_SOURCES = \
        photos-print-setup.h \
        photos-properties-dialog.c \
        photos-properties-dialog.h \
-       photos-quarks.c \
-       photos-quarks.h \
        photos-query.c \
        photos-query.h \
        photos-query-builder.h \
@@ -302,6 +320,59 @@ gnome_photos_SOURCES = \
        photos-main.c \
        $(NULL)
 
+gnome_photos_CPPFLAGS = \
+       -DPACKAGE_LIBEXEC_DIR=\""${libexecdir}"\" \
+       -DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
+       $(BABL_CFLAGS) \
+       $(CAIRO_CFLAGS) \
+       $(DAZZLE_CFLAGS) \
+       $(GDATA_CFLAGS) \
+       $(GDK_PIXBUF_CFLAGS) \
+       $(GEOCODE_CFLAGS) \
+       $(GFBGRAPH_CFLAGS) \
+       $(GEGL_CFLAGS) \
+       $(GEXIV2_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GLIB_CFLAGS) \
+       $(GOA_CFLAGS) \
+       $(GOBJECT_CFLAGS) \
+       $(GRILO_CFLAGS) \
+       $(GSETTINGS_DESKTOP_SCHEMAS_CFLAGS) \
+       $(GTK_CFLAGS) \
+       $(GTK_UNIX_PRINT_CFLAGS) \
+       $(PNG_CFLAGS) \
+       $(TRACKER_CFLAGS) \
+       -I$(top_srcdir)/subprojects/libgd \
+       $(NULL)
+
+gnome_photos_LDFLAGS = \
+       $(WARN_LDFLAGS) \
+       $(NULL)
+
+gnome_photos_LDADD = \
+       $(BABL_LIBS) \
+       $(CAIRO_LIBS) \
+       $(DAZZLE_LIBS) \
+       $(GDATA_LIBS) \
+       $(GDK_PIXBUF_LIBS) \
+       $(GEOCODE_LIBS) \
+       $(GFBGRAPH_LIBS) \
+       $(GEGL_LIBS) \
+       $(GEXIV2_LIBS) \
+       $(GIO_LIBS) \
+       $(GLIB_LIBS) \
+       $(GOA_LIBS) \
+       $(GRILO_LIBS) \
+       $(GTK_LIBS) \
+       $(GTK_UNIX_PRINT_LIBS) \
+       $(JPEG_LIBS) \
+       $(PNG_LIBS) \
+       $(TRACKER_LIBS) \
+       $(LIBM) \
+       $(top_builddir)/subprojects/libgd/libgd.la \
+       libgnome-photos.la \
+       $(NULL)
+
 gnome_photos_thumbnailer_built_sources = \
        photos-enums-gegl.c \
        photos-enums-gegl.h \
@@ -351,13 +422,40 @@ gnome_photos_thumbnailer_SOURCES = \
        photos-pixbuf.h \
        photos-png-count.c \
        photos-png-count.h \
-       photos-quarks.c \
-       photos-quarks.h \
        photos-thumbnailer.c \
        photos-thumbnailer.h \
        photos-thumbnailer-main.c \
        $(NULL)
 
+gnome_photos_thumbnailer_CPPFLAGS = \
+       -DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
+       $(BABL_CFLAGS) \
+       $(DAZZLE_CFLAGS) \
+       $(GDK_PIXBUF_CFLAGS) \
+       $(GEGL_CFLAGS) \
+       $(GIO_CFLAGS) \
+       $(GLIB_CFLAGS) \
+       $(GOBJECT_CFLAGS) \
+       $(PNG_CFLAGS) \
+       $(NULL)
+
+gnome_photos_thumbnailer_LDFLAGS = \
+       $(WARN_LDFLAGS) \
+       $(NULL)
+
+gnome_photos_thumbnailer_LDADD = \
+       $(BABL_LIBS) \
+       $(DAZZLE_LIBS) \
+       $(GEGL_LIBS) \
+       $(GDK_PIXBUF_LIBS) \
+       $(GIO_LIBS) \
+       $(GLIB_LIBS) \
+       $(JPEG_LIBS) \
+       $(PNG_LIBS) \
+       $(LIBM) \
+       libgnome-photos.la \
+       $(NULL)
+
 BUILT_SOURCES = \
        $(gnome_photos_built_sources) \
        $(gnome_photos_thumbnailer_built_sources) \
@@ -399,77 +497,10 @@ EXTRA_DIST = \
        photos-mpris-player.xml \
        $(NULL)
 
-AM_CPPFLAGS = \
-       -DPACKAGE_LIBEXEC_DIR=\""${libexecdir}"\" \
-       -DPACKAGE_LOCALE_DIR=\""${datadir}/locale"\" \
-       $(BABL_CFLAGS) \
-       $(CAIRO_CFLAGS) \
-       $(DAZZLE_CFLAGS) \
-       $(GDATA_CFLAGS) \
-       $(GDK_PIXBUF_CFLAGS) \
-       $(GEOCODE_CFLAGS) \
-       $(GFBGRAPH_CFLAGS) \
-       $(GEGL_CFLAGS) \
-       $(GEXIV2_CFLAGS) \
-       $(GIO_CFLAGS) \
-       $(GLIB_CFLAGS) \
-       $(GOA_CFLAGS) \
-       $(GRILO_CFLAGS) \
-       $(GSETTINGS_DESKTOP_SCHEMAS_CFLAGS) \
-       $(GTK_CFLAGS) \
-       $(GTK_UNIX_PRINT_CFLAGS) \
-       $(PNG_CFLAGS) \
-       $(TRACKER_CFLAGS) \
-       -I$(top_srcdir)/subprojects/libgd \
-       $(NULL)
-
 AM_CFLAGS = \
        $(WARN_CFLAGS) \
        $(NULL)
 
-gnome_photos_LDFLAGS = \
-       $(WARN_LDFLAGS) \
-       $(NULL)
-
-gnome_photos_LDADD = \
-       $(BABL_LIBS) \
-       $(CAIRO_LIBS) \
-       $(DAZZLE_LIBS) \
-       $(GDATA_LIBS) \
-       $(GDK_PIXBUF_LIBS) \
-       $(GEOCODE_LIBS) \
-       $(GFBGRAPH_LIBS) \
-       $(GEGL_LIBS) \
-       $(GEXIV2_LIBS) \
-       $(GIO_LIBS) \
-       $(GLIB_LIBS) \
-       $(GOA_LIBS) \
-       $(GRILO_LIBS) \
-       $(GTK_LIBS) \
-       $(GTK_UNIX_PRINT_LIBS) \
-       $(JPEG_LIBS) \
-       $(PNG_LIBS) \
-       $(TRACKER_LIBS) \
-       $(LIBM) \
-       $(top_builddir)/subprojects/libgd/libgd.la \
-       $(NULL)
-
-gnome_photos_thumbnailer_LDFLAGS = \
-       $(WARN_LDFLAGS) \
-       $(NULL)
-
-gnome_photos_thumbnailer_LDADD = \
-       $(BABL_LIBS) \
-       $(DAZZLE_LIBS) \
-       $(GEGL_LIBS) \
-       $(GDK_PIXBUF_LIBS) \
-       $(GIO_LIBS) \
-       $(GLIB_LIBS) \
-       $(JPEG_LIBS) \
-       $(PNG_LIBS) \
-       $(LIBM) \
-       $(NULL)
-
 CLEANFILES = \
        $(BUILT_SOURCES) \
        stamp-photos-about-data.h \


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