From 26a0bc34cd727789d3263dd5627b566b5ed979a2 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Wed, 19 Dec 2012 22:14:28 +0100 Subject: [PATCH] build: corrected --libs flags Stuff to keep in mind: - LDFLAGS are reserved for linker *flags*; - LIBADD is a per-library variable and must include object/libraries to link library against; - LDADD is the per-program version of LIBADD; - external objects/libraries should be specified with -L and -l; - internal objects/libraries should be specified directly (adding full path to .la for shared internal libraries); - objects/libraries order is significative: any item can depend on the following items but not on the preceeding ones. --- src/adg/Makefile.am | 74 ++++++++++++++++++++++++++-------------------------- src/cpml/Makefile.am | 6 ++--- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/adg/Makefile.am b/src/adg/Makefile.am index 9f0e53d0..32c7e0b4 100644 --- a/src/adg/Makefile.am +++ b/src/adg/Makefile.am @@ -15,10 +15,8 @@ else AM_CPPFLAGS+= -DADG_DATADIR='"$(pkgdatadir)"' endif -ADG_CFLAGS= $(CAIRO_CFLAGS) \ - $(GOBJECT_CFLAGS) -ADG_LDFLAGS= $(CAIRO_LIBS) \ - $(GOBJECT_LIBS) +ADG_CFLAGS= +ADG_LIBADD= # file groups @@ -158,60 +156,36 @@ CLEANFILES= $(built_h_sources) \ $(built_private_h_sources) \ $(built_c_sources) -pkgconfig_DATA= adg-1.pc - -adg_includedir= $(includedir)/adg-1/adg -adg_include_DATA= $(h_sources) \ - $(built_h_sources) - -lib_LTLIBRARIES= libadg-1.la -libadg_1_la_SOURCES= $(h_sources) \ - $(private_h_sources) \ - $(c_sources) -nodist_libadg_1_la_SOURCES= $(built_h_sources) \ - $(built_private_h_sources) \ - $(built_c_sources) -libadg_1_la_CFLAGS= $(ADG_CFLAGS) -libadg_1_la_LDFLAGS= -no-undefined \ - -version-info @ADG_LT_VERSION@ \ - $(ADG_LDFLAGS) -libadg_1_la_LIBADD= $(top_builddir)/src/cpml/libcpml-1.la - ## Optional GTK+ related stuff -if HAVE_GTK +if HAVE_GTK h_sources+= adg-gtk-area.h \ adg-gtk-layout.h \ adg-gtk-utils.h private_h_sources+= adg-gtk-area-private.h \ adg-gtk-layout-private.h c_sources+= adg-gtk-utils.c -ADG_CFLAGS+= $(GTK3_CFLAGS) \ - $(GTK2_CFLAGS) -ADG_LDFLAGS+= $(GTK3_LIBS) \ - $(GTK2_LIBS) - endif if HAVE_GTK3 - c_sources+= adg-gtk-area.c \ adg-gtk-layout.c - +ADG_CFLAGS+= $(GTK3_CFLAGS) +ADG_LIBADD+= $(GTK3_LIBS) endif if HAVE_GTK2 - c_sources+= adg-gtk-area-gtk2.c \ adg-gtk-layout-gtk2.c - +ADG_CFLAGS+= $(GTK2_CFLAGS) +ADG_LIBADD+= $(GTK2_LIBS) endif ## Optional pangocairo related stuff -if HAVE_PANGO +if HAVE_PANGO h_sources+= adg-pango-style.h \ adg-text.h private_h_sources+= adg-pango-style-private.h \ @@ -219,11 +193,37 @@ private_h_sources+= adg-pango-style-private.h \ c_sources+= adg-pango-style.c \ adg-text.c ADG_CFLAGS+= $(PANGO_CFLAGS) -ADG_LDFLAGS+= $(PANGO_LIBS) - +ADG_LIBADD+= $(PANGO_LIBS) endif +ADG_CFLAGS+= $(CAIRO_CFLAGS) \ + $(GOBJECT_CFLAGS) +ADG_LIBADD+= $(CAIRO_LIBS) \ + $(GOBJECT_LIBS) + + +pkgconfig_DATA= adg-1.pc + +adg_includedir= $(includedir)/adg-1/adg +adg_include_DATA= $(h_sources) \ + $(built_h_sources) + +lib_LTLIBRARIES= libadg-1.la +libadg_1_la_SOURCES= $(h_sources) \ + $(private_h_sources) \ + $(c_sources) +nodist_libadg_1_la_SOURCES= $(built_h_sources) \ + $(built_private_h_sources) \ + $(built_c_sources) +libadg_1_la_CFLAGS= $(ADG_CFLAGS) +libadg_1_la_LDFLAGS= -no-undefined \ + -version-info @ADG_LT_VERSION@ +libadg_1_la_LIBADD= $(top_builddir)/src/cpml/libcpml-1.la \ + $(ADG_LIBADD) + + + ## GObject introspection -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS= @@ -266,7 +266,7 @@ Adg_1_0_gir_FILES= adg-introspection.h \ ## Dependency from CPML will be added manually because it is still an ## internal component, hence not yet installed at this point Adg_1_0_gir_CFLAGS= $(AM_CPPFLAGS) -Adg_1_0_gir_LDFLAGS= $(ADG_LDFLAGS) +Adg_1_0_gir_LDFLAGS= Adg_1_0_gir_SCANNERFLAGS= --c-include='adg.h' \ --warn-all \ --include-uninstalled=$(top_builddir)/src/cpml/Cpml-1.0.gir diff --git a/src/cpml/Makefile.am b/src/cpml/Makefile.am index f4a48211..6b94bdf1 100644 --- a/src/cpml/Makefile.am +++ b/src/cpml/Makefile.am @@ -7,7 +7,7 @@ SUBDIRS= tests AM_CPPFLAGS= -I$(top_srcdir)/src \ -I$(top_builddir)/src CPML_CFLAGS= $(CAIRO_CFLAGS) -CPML_LDFLAGS= $(CAIRO_LIBS) +CPML_LIBADD= $(CAIRO_LIBS) # file groups @@ -57,8 +57,8 @@ nodist_libcpml_1_la_SOURCES= $(built_h_sources) \ $(built_c_sources) libcpml_1_la_CFLAGS= $(CPML_CFLAGS) libcpml_1_la_LDFLAGS= -no-undefined \ - -version-info @CPML_LT_VERSION@ \ - $(CPML_LDFLAGS) + -version-info @CPML_LT_VERSION@ +libcpml_1_la_LIBADD= $(CPML_LIBADD) ## GObject introspection -- 2.11.4.GIT