[gjs] build: Untangle (AM_) CFLAGS, CPPFLAGS, CXXFLAGS
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] build: Untangle (AM_) CFLAGS, CPPFLAGS, CXXFLAGS
- Date: Wed, 10 Feb 2016 04:27:42 +0000 (UTC)
commit 0f92f6be86ac64c35b5671ccc05749aa9cbeeb8c
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Jan 24 13:37:20 2016 -0800
build: Untangle (AM_) CFLAGS, CPPFLAGS, CXXFLAGS
In Automake, CPPFLAGS stands for C PreProcessor flags. C source files are
compiled with CPPFLAGS and CFLAGS, while C++ source files are compiled
with CPPFLAGS and CXXFLAGS. The exception to this naming convention is
the PKG_CHECK_MODULES macro which substs a variable named <FOO>_CFLAGS
which should properly be called <FOO>_CPPFLAGS.
This untangles all the flags definitions so that -I and -D flags, which
are preprocessor arguments, are put into CPPFLAGS variables, not into
CFLAGS or CXXFLAGS. Otherwise they won't apply to both C and C++ source
files.
In addition, when using per-target flags, make sure to include the AM_
prefixed variable as well, because otherwise per-target flags will
override it. Conversely, if an assignment sets a per-target flags variable
to only be the AM_ prefixed variable (e.g., "something_CFLAGS =
$(AM_CFLAGS)") then it is redundant.
https://bugzilla.gnome.org/show_bug.cgi?id=761072
Makefile-insttest.am | 17 ++++++++++-------
Makefile-modules.am | 10 +++++-----
Makefile.am | 7 +++----
3 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/Makefile-insttest.am b/Makefile-insttest.am
index 799084a..dc390ce 100644
--- a/Makefile-insttest.am
+++ b/Makefile-insttest.am
@@ -24,8 +24,12 @@ TEST_PROGS += jsunit
TEST_INTROSPECTION_GIRS =
-jsunit_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS) -DPKGLIBDIR=\"$(pkglibdir)\"
-DINSTTESTDIR=\"$(gjsinsttestdir)\"
-jsunit_CFLAGS = $(AM_CFLAGS) $(GJS_CFLAGS) -I$(top_srcdir)
+jsunit_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(GJS_CFLAGS) \
+ -DPKGLIBDIR=\"$(pkglibdir)\" \
+ -DINSTTESTDIR=\"$(gjsinsttestdir)\" \
+ -I$(top_srcdir)
jsunit_LDADD = $(GJS_LIBS) libgjs.la
jsunit_LDFLAGS = -rpath $(pkglibdir)
jsunit_SOURCES = \
@@ -59,24 +63,23 @@ common_test_ldflags += -rpath /nowhere
endif
nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
-libregress_la_CPPFLAGS = $(AM_CPPFLAGS)
-libregress_la_CFLAGS = $(GJS_CFLAGS) $(GJS_GDBUS_CFLAGS)
+libregress_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS) $(GJS_GDBUS_CFLAGS)
libregress_la_LDFLAGS = $(common_test_ldflags) $(GJS_GDBUS_LIBS)
libregress_la_LIBADD = $(common_test_libadd)
libregress_scannerflags_includes = --include=Gio-2.0
if ENABLE_CAIRO
-libregress_la_CFLAGS += $(GJS_CAIRO_CFLAGS)
+libregress_la_CPPFLAGS += $(GJS_CAIRO_CFLAGS)
libregress_la_LDFLAGS += $(GJS_CAIRO_LIBS)
libregress_scannerflags_includes += --include=cairo-1.0
else
libregress_la_CPPFLAGS += -D_GI_DISABLE_CAIRO
endif
nodist_libwarnlib_la_SOURCES = $(GI_DATADIR)/tests/warnlib.c $(GI_DATADIR)/tests/warnlib.h
-libwarnlib_la_CFLAGS = $(GJS_CFLAGS)
+libwarnlib_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
libwarnlib_la_LDFLAGS = $(common_test_ldflags)
libwarnlib_la_LIBADD = $(common_test_libadd)
nodist_libgimarshallingtests_la_SOURCES = $(GI_DATADIR)/tests/gimarshallingtests.c
$(GI_DATADIR)/tests/gimarshallingtests.h
-libgimarshallingtests_la_CFLAGS = $(GJS_CFLAGS)
+libgimarshallingtests_la_CPPFLAGS = $(AM_CPPFLAGS) $(GJS_CFLAGS)
libgimarshallingtests_la_LDFLAGS = $(common_test_ldflags)
libgimarshallingtests_la_LIBADD = $(common_test_libadd)
diff --git a/Makefile-modules.am b/Makefile-modules.am
index 4b6e356..5cdbd28 100644
--- a/Makefile-modules.am
+++ b/Makefile-modules.am
@@ -8,7 +8,7 @@ endif
noinst_LTLIBRARIES += $(NATIVE_MODULES)
libgjs_la_LIBADD += $(NATIVE_MODULES)
-JS_NATIVE_MODULE_CFLAGS = \
+JS_NATIVE_MODULE_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DGJS_COMPILATION \
$(GJS_CFLAGS)
@@ -25,10 +25,10 @@ EXTRA_DIST += $(modules_resource_files) $(srcdir)/modules/modules.gresource.xml
nodist_libmodules_resources_la_SOURCES = modules-resources.c modules-resources.h
CLEANFILES += $(nodist_libmodules_resources_la_SOURCES)
-libmodules_resources_la_CPPFLAGS = $(JS_NATIVE_MODULE_CFLAGS)
+libmodules_resources_la_CPPFLAGS = $(JS_NATIVE_MODULE_CPPFLAGS)
libmodules_resources_la_LIBADD = $(JS_NATIVE_MODULE_LIBADD)
-libcairoNative_la_CPPFLAGS = $(JS_NATIVE_MODULE_CFLAGS) $(GJS_CAIRO_CFLAGS) $(GJS_CAIRO_XLIB_CFLAGS)
+libcairoNative_la_CPPFLAGS = $(JS_NATIVE_MODULE_CPPFLAGS) $(GJS_CAIRO_CFLAGS) $(GJS_CAIRO_XLIB_CFLAGS)
libcairoNative_la_LIBADD = $(JS_NATIVE_MODULE_LIBADD) $(GJS_CAIRO_LIBS) $(GJS_CAIRO_XLIB_LIBS)
libcairoNative_la_SOURCES = \
modules/cairo-private.h \
@@ -49,10 +49,10 @@ libcairoNative_la_SOURCES = \
modules/cairo-solid-pattern.cpp \
modules/cairo.cpp
-libsystem_la_CPPFLAGS = $(JS_NATIVE_MODULE_CFLAGS)
+libsystem_la_CPPFLAGS = $(JS_NATIVE_MODULE_CPPFLAGS)
libsystem_la_LIBADD = $(JS_NATIVE_MODULE_LIBADD)
libsystem_la_SOURCES = modules/system.h modules/system.cpp
-libconsole_la_CPPFLAGS = $(JS_NATIVE_MODULE_CFLAGS)
+libconsole_la_CPPFLAGS = $(JS_NATIVE_MODULE_CPPFLAGS)
libconsole_la_LIBADD = $(JS_NATIVE_MODULE_LIBADD) $(READLINE_LIBS)
libconsole_la_SOURCES = modules/console.h modules/console.cpp
diff --git a/Makefile.am b/Makefile.am
index dcb1c54..c32afc9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,9 @@ TEST_PROGS =
check_PROGRAMS = $(TEST_PROGS)
INTROSPECTION_GIRS =
ACLOCAL_AMFLAGS = -I m4
-AM_CFLAGS = $(WARN_CFLAGS) -DG_LOG_DOMAIN=\"Gjs\"
-AM_CPPFLAGS = $(WARN_CXXFLAGS) -DG_LOG_DOMAIN=\"Gjs\"
+AM_CFLAGS = $(WARN_CFLAGS)
+AM_CXXFLAGS = $(WARN_CXXFLAGS)
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gjs\"
gjsjsdir = @gjsjsdir@
gjsoverridedir = $(gjsjsdir)/overrides
@@ -93,8 +94,6 @@ libgjs_la_CPPFLAGS = \
$(gjs_directory_defines)\
-I$(top_srcdir)/gi \
-DGJS_COMPILATION
-libgjs_la_CFLAGS = \
- $(AM_CFLAGS)
libgjs_la_LDFLAGS = \
$(EXTRA_LINK_FLAGS) \
-export-symbols-regex "^[^_]" -version-info 0:0:0 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]