[lttng-dev] [PATCH lttng-ust] Fix: Don't override user variables within the build system

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue May 9 18:56:59 UTC 2017


Merging for master, 2.10, 2.9.

Can you prepare a version for 2.8 ? It does not cherry-pick cleanly.

Thanks,

Mathieu

----- On May 9, 2017, at 2:25 PM, Michael Jeanson mjeanson at efficios.com wrote:

> Instead use the appropriatly prefixed AM_* variables as to not interfere
> when a user variable is passed to a make command. The proper use of flag
> variables is documented at :
> 
> https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering
> 
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
> configure.ac                                   | 11 +++++++---
> doc/examples/Makefile.am                       |  8 +++----
> doc/examples/clock-override/Makefile           | 12 ++++-------
> doc/examples/demo-tracef/Makefile              | 10 +++------
> doc/examples/demo-tracelog/Makefile            | 10 +++------
> doc/examples/demo/Makefile                     | 30 +++++++++++---------------
> doc/examples/easy-ust/Makefile                 | 14 +++++-------
> doc/examples/gen-tp/Makefile                   | 16 ++++++--------
> doc/examples/getcpu-override/Makefile          | 12 ++++-------
> doc/examples/hello-static-lib/Makefile         | 14 +++++-------
> liblttng-ust-ctl/Makefile.am                   |  2 +-
> liblttng-ust-cyg-profile/Makefile.am           |  2 +-
> liblttng-ust-dl/Makefile.am                    |  4 ++--
> liblttng-ust-fd/Makefile.am                    |  4 ++--
> liblttng-ust-fork/Makefile.am                  |  4 ++--
> liblttng-ust-java-agent/jni/common/Makefile.am |  2 +-
> liblttng-ust-java-agent/jni/jul/Makefile.am    |  2 +-
> liblttng-ust-java-agent/jni/log4j/Makefile.am  |  2 +-
> liblttng-ust-java/Makefile.am                  |  2 +-
> liblttng-ust-libc-wrapper/Makefile.am          |  2 +-
> liblttng-ust-python-agent/Makefile.am          |  2 +-
> liblttng-ust/Makefile.am                       |  6 +++---
> libringbuffer/Makefile.am                      |  4 ++--
> snprintf/Makefile.am                           |  4 ++--
> tests/benchmark/Makefile.am                    |  2 +-
> tests/ctf-types/Makefile.am                    |  2 +-
> tests/hello/Makefile.am                        |  2 +-
> tests/test-app-ctx/Makefile.am                 |  2 +-
> tests/trace_event/Makefile.am                  |  2 +-
> tests/tracepoint/Makefile.am                   |  2 +-
> tests/tracepoint/benchmark/Makefile.am         |  2 +-
> tests/ust-variant/Makefile.am                  |  2 +-
> 32 files changed, 84 insertions(+), 111 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 77b5db4..6f7c6f1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -187,8 +187,6 @@ dnl AC_CHECK_TYPES([ptrdiff_t])
> AC_FUNC_MALLOC
> AC_CHECK_FUNCS([gettimeofday munmap socket strerror strtol sched_getcpu
> sysconf])
> 
> -CFLAGS="-Wall $CFLAGS"
> -
> # URCU
> 
> # urcu - check if we just find the headers it out of the box.
> @@ -306,10 +304,13 @@ AS_IF([test "x$jni_interface" = "xyes" || test
> "x$java_agent_jul" = "xyes" || te
> 	AX_JNI_INCLUDE_DIR
> 	for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
> 	do
> -		CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
> +		JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
> 	done
> 
> +	saved_CPPFLAGS="$CPPFLAGS"
> +	CPPFLAGS="$CPPFLAGS $JNI_CPPFLAGS"
> 	AX_PROG_JAVAH
> +	CPPFLAGS="$saved_CPPFLAGS"
> ])
> 
> AS_IF([test "x$java_agent_log4j" = "xyes"], [
> @@ -446,6 +447,10 @@
> _AC_DEFINE_AND_SUBST([LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS], [3000])
> # By default, do not retry on buffer full condition.
> _AC_DEFINE_AND_SUBST([LTTNG_UST_DEFAULT_BLOCKING_RETRY_TIMEOUT_MS], [0])
> 
> +AM_CFLAGS="-Wall"
> +AC_SUBST(AM_CFLAGS)
> +AC_SUBST(JNI_CPPFLAGS)
> +
> AC_CONFIG_FILES([
> 	Makefile
> 	doc/Makefile
> diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
> index 239046f..02e449a 100644
> --- a/doc/examples/Makefile.am
> +++ b/doc/examples/Makefile.am
> @@ -131,7 +131,7 @@ all-local:
> 		rel_build_subdir="../"; \
> 	fi; \
> 	for subdir in $(SUBDIRS_PROXY); do \
> -		(cd $$subdir && $(MAKE) AM_CC="$(CC)" AM_CPPFLAGS="$(CPPFLAGS)
> -I$$rel_src_subdir$(top_srcdir)/include/
> -I$$rel_build_subdir$(top_builddir)/include/" AM_CFLAGS='$(CFLAGS)'
> AM_LDFLAGS='$(LDFLAGS) -L../../../liblttng-ust/.libs
> -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/"
> -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"'
> LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
> +		(cd $$subdir && $(MAKE) CC="$(CC)" CPPFLAGS="$(CPPLAGS)"
> AM_CPPFLAGS="$(AM_CPPFLAGS) -I$$rel_src_subdir$(top_srcdir)/include/
> -I$$rel_build_subdir$(top_builddir)/include/" CFLAGS='$(CFLAGS)'
> AM_CFLAGS='$(AM_CFLAGS)' LDFLAGS="$(LDFLAGS)" AM_LDFLAGS='$(AM_LDFLAGS)
> -L../../../liblttng-ust/.libs -Wl,-rpath="$(PWD)/../../liblttng-ust/.libs/"
> -Wl,-rpath-link="$(PWD)/../../liblttng-ust/.libs/"'
> LTTNG_GEN_TP_PATH="../../../tools/" $(AM_MAKEFLAGS) all && cd ..) || exit 1; \
> 	done; \
> 	if [ x"$(SUBDIRS_JUL)" != x"" ]; then \
> 		for subdir in $(SUBDIRS_JUL); do \
> @@ -154,9 +154,9 @@ all-local:
> 				cmake \
> 				-DCMAKE_INCLUDE_PATH="$(abs_top_srcdir)/include;$(abs_top_builddir)/include" \
> 				-DCMAKE_LIBRARY_PATH="$(abs_top_builddir)/liblttng-ust/.libs" \
> -				-DCMAKE_C_FLAGS="$(CFLAGS) $(CPPFLAGS)" \
> -				-DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS)" \
> -				-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
> +				-DCMAKE_C_FLAGS="$(AM_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)" \
> +				-DCMAKE_CXX_FLAGS="$(AM_CXXFLAGS) $(AM_CPPFLAGS) $(CXXFLAGS) $(CPPFLAGS)" \
> +				-DCMAKE_EXE_LINKER_FLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \
> 				.. && \
> 				$(MAKE) && \
> 				cd .. \
> diff --git a/doc/examples/clock-override/Makefile
> b/doc/examples/clock-override/Makefile
> index 8f38c4f..5433427 100644
> --- a/doc/examples/clock-override/Makefile
> +++ b/doc/examples/clock-override/Makefile
> @@ -15,10 +15,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl	# On Linux
> #LIBS = -lc	# On BSD
> LOCAL_CPPFLAGS += -I.
> @@ -26,12 +22,12 @@ LOCAL_CPPFLAGS += -I.
> all: lttng-ust-clock-override-example.so
> 
> lttng-ust-clock-override-example.o: lttng-ust-clock-override-example.c
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -fpic -c -o $@ $<
> 
> lttng-ust-clock-override-example.so: lttng-ust-clock-override-example.o
> -	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(CFLAGS) \
> -		$(AM_LDFLAGS) $(AM_CFLAGS) lttng-ust-clock-override-example.o
> +	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
> +		$(AM_LDFLAGS) $(CFLAGS) lttng-ust-clock-override-example.o
> 
> .PHONY: clean
> clean:
> diff --git a/doc/examples/demo-tracef/Makefile
> b/doc/examples/demo-tracef/Makefile
> index 40e9a58..1e4544c 100644
> --- a/doc/examples/demo-tracef/Makefile
> +++ b/doc/examples/demo-tracef/Makefile
> @@ -15,10 +15,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl -llttng-ust	# On Linux
> #LIBS = -lc	# On BSD
> LOCAL_CPPFLAGS += -I.
> @@ -26,11 +22,11 @@ LOCAL_CPPFLAGS += -I.
> all: demo-tracef
> 
> demo-tracef.o: demo-tracef.c
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> demo-tracef: demo-tracef.o
> -	$(CC) $(LDFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
> +	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
> 		-o $@ $< $(LIBS)
> 
> .PHONY: clean
> diff --git a/doc/examples/demo-tracelog/Makefile
> b/doc/examples/demo-tracelog/Makefile
> index cc6843a..a16d6c5 100644
> --- a/doc/examples/demo-tracelog/Makefile
> +++ b/doc/examples/demo-tracelog/Makefile
> @@ -15,10 +15,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl -llttng-ust	# On Linux
> #LIBS = -lc	# On BSD
> LOCAL_CPPFLAGS += -I.
> @@ -26,11 +22,11 @@ LOCAL_CPPFLAGS += -I.
> all: demo-tracelog
> 
> demo-tracelog.o: demo-tracelog.c
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> demo-tracelog: demo-tracelog.o
> -	$(CC) $(LDFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
> +	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
> 		-o $@ $< $(LIBS)
> 
> .PHONY: clean
> diff --git a/doc/examples/demo/Makefile b/doc/examples/demo/Makefile
> index 9c847b1..6272a2b 100644
> --- a/doc/examples/demo/Makefile
> +++ b/doc/examples/demo/Makefile
> @@ -14,10 +14,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl	# On Linux
> #LIBS = -lc	# On BSD
> LOCAL_CPPFLAGS += -I.
> @@ -25,31 +21,31 @@ LOCAL_CPPFLAGS += -I.
> all: demo lttng-ust-provider-ust-tests-demo.so
> lttng-ust-provider-ust-tests-demo3.so
> 
> tp.o: tp.c ust_tests_demo.h
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -fpic -c -o $@ $<
> 
> tp2.o: tp2.c ust_tests_demo2.h
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -fpic -c -o $@ $<
> 
> lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o
> -	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(CFLAGS) \
> -		$(AM_LDFLAGS) $(AM_CFLAGS) -llttng-ust tp.o tp2.o
> +	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
> +		$(AM_LDFLAGS) $(CFLAGS) -llttng-ust tp.o tp2.o
> 
> tp3.o: tp3.c ust_tests_demo3.h
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -fpic -c -o $@ $<
> 
> lttng-ust-provider-ust-tests-demo3.so: tp3.o
> -	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(CFLAGS) \
> -		$(AM_LDFLAGS) $(AM_CFLAGS) -llttng-ust tp3.o
> +	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
> +		$(AM_LDFLAGS) $(CFLAGS) -llttng-ust tp3.o
> 
> demo.o: demo.c
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> demo: demo.o
> -	$(CC) $(LDFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
> +	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
> 		-o $@ demo.o $(LIBS)
> 
> .PHONY: clean
> diff --git a/doc/examples/easy-ust/Makefile b/doc/examples/easy-ust/Makefile
> index 723780f..0227293 100644
> --- a/doc/examples/easy-ust/Makefile
> +++ b/doc/examples/easy-ust/Makefile
> @@ -16,10 +16,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl -llttng-ust		# On Linux
> #LIBS = -lc -llttng-ust		# On BSD
> LOCAL_CPPFLAGS += -I.
> @@ -27,16 +23,16 @@ LOCAL_CPPFLAGS += -I.
> all: sample
> 
> sample: sample.o tp.o
> -	$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
> +	$(CC) -o $@ $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
> 		sample.o tp.o $(LIBS)
> 
> sample.o: sample.c sample_component_provider.h
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> tp.o: tp.c sample_component_provider.h
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> html: sample_component_provider.html sample.html tp.html
> 
> diff --git a/doc/examples/gen-tp/Makefile b/doc/examples/gen-tp/Makefile
> index 5c2a78c..6d9ec10 100644
> --- a/doc/examples/gen-tp/Makefile
> +++ b/doc/examples/gen-tp/Makefile
> @@ -17,34 +17,30 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl -llttng-ust		#On Linux
> #LIBS = -lc -llttng-ust		#On BSD
> 
> all: sample
> 
> sample: sample.o sample_tracepoint.o
> -	$(CC) $(LDFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
> +	$(CC) $(LDFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) $(CFLAGS) \
> 		-o $@ sample.o sample_tracepoint.o $(LIBS)
> 
> sample.o: sample.c sample_tracepoint.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) $(AM_CFLAGS) \
> +	$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
> 		-c -o $@ $<
> 
> # Use this command to compile the .c manually
> #sample_tracepoint.o: sample_tracepoint.c sample_tracepoint.h
> -#	$(CC) $(CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) $(AM_CFLAGS) \
> +#	$(CC) $(CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) \
> #		-I. -c -o $@ $<
> 
> # This rule generate .o only and depends on rules for generating
> # the .h and .c
> %.o: %.tp %.c %.h
> -	CPPFLAGS="$(CPPFLAGS) $(AM_CPPFLAGS)" \
> -	CFLAGS="$(CFLAGS) $(AM_CFLAGS)" \
> -	LDFLAGS="$(LDFLAGS) $(AM_LDFLAGS)" \
> +	CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS)" \
> +	CFLAGS="$(AM_CFLAGS) $(CFLAGS)" \
> +	LDFLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \
> 	CC="$(CC)" \
> 	$(LTTNG_GEN_TP_PATH)lttng-gen-tp -o $@ $<
> 
> diff --git a/doc/examples/getcpu-override/Makefile
> b/doc/examples/getcpu-override/Makefile
> index ec752d7..de295c6 100644
> --- a/doc/examples/getcpu-override/Makefile
> +++ b/doc/examples/getcpu-override/Makefile
> @@ -15,10 +15,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LIBS = -ldl	# On Linux
> #LIBS = -lc	# On BSD
> LOCAL_CPPFLAGS += -I.
> @@ -26,12 +22,12 @@ LOCAL_CPPFLAGS += -I.
> all: lttng-ust-getcpu-override-example.so
> 
> lttng-ust-getcpu-override-example.o: lttng-ust-getcpu-override-example.c
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -fpic -c -o $@ $<
> 
> lttng-ust-getcpu-override-example.so: lttng-ust-getcpu-override-example.o
> -	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(CFLAGS) \
> -		$(AM_LDFLAGS) $(AM_CFLAGS) lttng-ust-getcpu-override-example.o
> +	$(CC) -shared -Wl,--no-as-needed -o $@ $(LDFLAGS) $(AM_CFLAGS) \
> +		$(AM_LDFLAGS) $(CFLAGS) lttng-ust-getcpu-override-example.o
> 
> .PHONY: clean
> clean:
> diff --git a/doc/examples/hello-static-lib/Makefile
> b/doc/examples/hello-static-lib/Makefile
> index ec185c1..cf72b35 100644
> --- a/doc/examples/hello-static-lib/Makefile
> +++ b/doc/examples/hello-static-lib/Makefile
> @@ -14,10 +14,6 @@
> #
> # This makefile is purposefully kept simple to support GNU and BSD make.
> 
> -ifdef AM_CC
> -	CC = $(AM_CC)
> -endif
> -
> LOCAL_CPPFLAGS += -I.
> LIBS = -ldl -llttng-ust	# On Linux
> #LIBS = -lc -llttng-ust	# On BSD
> @@ -25,19 +21,19 @@ LIBS = -ldl -llttng-ust	# On Linux
> all: hello
> 
> lttng-ust-provider-hello.o: tp.c ust_tests_hello.h
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> lttng-ust-provider-hello.a: lttng-ust-provider-hello.o
> 	ar -rc $@ lttng-ust-provider-hello.o
> 
> hello.o: hello.c
> -	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) $(AM_CPPFLAGS) \
> -		$(AM_CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) \
> +		$(CFLAGS) -c -o $@ $<
> 
> hello: hello.o lttng-ust-provider-hello.a
> 	$(CC) -o $@ $(LDFLAGS) $(CPPFLAGS) $(AM_LDFLAGS) $(AM_CFLAGS) \
> -		hello.o lttng-ust-provider-hello.a $(LIBS)
> +		$(CFLAGS) hello.o lttng-ust-provider-hello.a $(LIBS)
> 
> .PHONY: clean
> clean:
> diff --git a/liblttng-ust-ctl/Makefile.am b/liblttng-ust-ctl/Makefile.am
> index e10ba8b..6043d17 100644
> --- a/liblttng-ust-ctl/Makefile.am
> +++ b/liblttng-ust-ctl/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/liblttng-ust-comm
> -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> lib_LTLIBRARIES = liblttng-ust-ctl.la
> 
> diff --git a/liblttng-ust-cyg-profile/Makefile.am
> b/liblttng-ust-cyg-profile/Makefile.am
> index d325f53..3130282 100644
> --- a/liblttng-ust-cyg-profile/Makefile.am
> +++ b/liblttng-ust-cyg-profile/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> lib_LTLIBRARIES = liblttng-ust-cyg-profile.la \
> 	liblttng-ust-cyg-profile-fast.la
> diff --git a/liblttng-ust-dl/Makefile.am b/liblttng-ust-dl/Makefile.am
> index 049ac65..c0168f3 100644
> --- a/liblttng-ust-dl/Makefile.am
> +++ b/liblttng-ust-dl/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> lib_LTLIBRARIES = liblttng-ust-dl.la
> liblttng_ust_dl_la_SOURCES = \
> @@ -16,4 +16,4 @@ if LTTNG_UST_BUILD_WITH_LIBC_DL
> liblttng_ust_dl_la_LIBADD += -lc
> endif
> 
> -liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl
> -fno-strict-aliasing
> +liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS)
> diff --git a/liblttng-ust-fd/Makefile.am b/liblttng-ust-fd/Makefile.am
> index 52f897d..e9fc3b4 100644
> --- a/liblttng-ust-fd/Makefile.am
> +++ b/liblttng-ust-fd/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> lib_LTLIBRARIES = liblttng-ust-fd.la
> liblttng_ust_fd_la_SOURCES = \
> @@ -14,4 +14,4 @@ if LTTNG_UST_BUILD_WITH_LIBC_DL
> liblttng_ust_fd_la_LIBADD += -lc
> endif
> 
> -liblttng_ust_fd_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fd
> -fno-strict-aliasing
> +liblttng_ust_fd_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fd $(AM_CFLAGS)
> diff --git a/liblttng-ust-fork/Makefile.am b/liblttng-ust-fork/Makefile.am
> index aea276e..2f0976d 100644
> --- a/liblttng-ust-fork/Makefile.am
> +++ b/liblttng-ust-fork/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> lib_LTLIBRARIES = liblttng-ust-fork.la
> liblttng_ust_fork_la_SOURCES = ustfork.c
> @@ -13,4 +13,4 @@ if LTTNG_UST_BUILD_WITH_LIBC_DL
> liblttng_ust_fork_la_LIBADD += -lc
> endif
> 
> -liblttng_ust_fork_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fork
> -fno-strict-aliasing
> +liblttng_ust_fork_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fork $(AM_CFLAGS)
> diff --git a/liblttng-ust-java-agent/jni/common/Makefile.am
> b/liblttng-ust-java-agent/jni/common/Makefile.am
> index 704f2bb..7612932 100644
> --- a/liblttng-ust-java-agent/jni/common/Makefile.am
> +++ b/liblttng-ust-java-agent/jni/common/Makefile.am
> @@ -1,4 +1,4 @@
> -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(JNI_CPPFLAGS)
> 
> lib_LTLIBRARIES = liblttng-ust-context-jni.la
> liblttng_ust_context_jni_la_SOURCES = lttng_ust_context.c lttng_ust_context.h
> diff --git a/liblttng-ust-java-agent/jni/jul/Makefile.am
> b/liblttng-ust-java-agent/jni/jul/Makefile.am
> index a94d44e..45bc1b5 100644
> --- a/liblttng-ust-java-agent/jni/jul/Makefile.am
> +++ b/liblttng-ust-java-agent/jni/jul/Makefile.am
> @@ -1,4 +1,4 @@
> -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(JNI_CPPFLAGS)
> 
> lib_LTLIBRARIES = liblttng-ust-jul-jni.la
> liblttng_ust_jul_jni_la_SOURCES = lttng_ust_jul.c \
> diff --git a/liblttng-ust-java-agent/jni/log4j/Makefile.am
> b/liblttng-ust-java-agent/jni/log4j/Makefile.am
> index 5545631..5e5fe0f 100644
> --- a/liblttng-ust-java-agent/jni/log4j/Makefile.am
> +++ b/liblttng-ust-java-agent/jni/log4j/Makefile.am
> @@ -1,4 +1,4 @@
> -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(JNI_CPPFLAGS)
> 
> lib_LTLIBRARIES = liblttng-ust-log4j-jni.la
> liblttng_ust_log4j_jni_la_SOURCES = lttng_ust_log4j.c \
> diff --git a/liblttng-ust-java/Makefile.am b/liblttng-ust-java/Makefile.am
> index 0c2f6a5..399b62c 100644
> --- a/liblttng-ust-java/Makefile.am
> +++ b/liblttng-ust-java/Makefile.am
> @@ -7,7 +7,7 @@ dist_noinst_JAVA = $(pkgpath)/LTTngUst.java
> jar_DATA = $(jarfile)
> BUILT_SOURCES = org_lttng_ust_LTTngUst.h
> 
> -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(JNI_CPPFLAGS)
> lib_LTLIBRARIES = liblttng-ust-java.la
> liblttng_ust_java_la_SOURCES = LTTngUst.c lttng_ust_java.h
> nodist_liblttng_ust_java_la_SOURCES = org_lttng_ust_LTTngUst.h
> diff --git a/liblttng-ust-libc-wrapper/Makefile.am
> b/liblttng-ust-libc-wrapper/Makefile.am
> index d402d53..e73b4d8 100644
> --- a/liblttng-ust-libc-wrapper/Makefile.am
> +++ b/liblttng-ust-libc-wrapper/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> lib_LTLIBRARIES = liblttng-ust-libc-wrapper.la \
>   liblttng-ust-pthread-wrapper.la
> diff --git a/liblttng-ust-python-agent/Makefile.am
> b/liblttng-ust-python-agent/Makefile.am
> index 726ffe4..2c6668a 100644
> --- a/liblttng-ust-python-agent/Makefile.am
> +++ b/liblttng-ust-python-agent/Makefile.am
> @@ -1,7 +1,7 @@
> # tracepoint provider: always built/installed (does not depend on Python per se)
> AM_CPPFLAGS = -I$(top_srcdir)/include/ \
> 	-I$(top_builddir)/include/
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> lib_LTLIBRARIES = liblttng-ust-python-agent.la
> liblttng_ust_python_agent_la_SOURCES = lttng_ust_python.c lttng_ust_python.h
> liblttng_ust_python_agent_la_LIBADD = -lc -llttng-ust \
> diff --git a/liblttng-ust/Makefile.am b/liblttng-ust/Makefile.am
> index e79591a..982be69 100644
> --- a/liblttng-ust/Makefile.am
> +++ b/liblttng-ust/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> noinst_LTLIBRARIES = liblttng-ust-runtime.la liblttng-ust-support.la
> 
> @@ -17,7 +17,7 @@ liblttng_ust_tracepoint_la_LIBADD = \
> 	-lpthread \
> 	$(top_builddir)/snprintf/libustsnprintf.la
> liblttng_ust_tracepoint_la_LDFLAGS = -no-undefined -version-info
> $(LTTNG_UST_LIBRARY_VERSION)
> -liblttng_ust_tracepoint_la_CFLAGS = -DUST_COMPONENT="liblttng_ust_tracepoint"
> -fno-strict-aliasing
> +liblttng_ust_tracepoint_la_CFLAGS = -DUST_COMPONENT="liblttng_ust_tracepoint"
> $(AM_CFLAGS)
> 
> liblttng_ust_runtime_la_SOURCES = \
> 	lttng-ust-comm.c \
> @@ -100,4 +100,4 @@ liblttng_ust_la_LIBADD = \
> 	liblttng-ust-tracepoint.la \
> 	liblttng-ust-runtime.la liblttng-ust-support.la
> 
> -liblttng_ust_la_CFLAGS = -DUST_COMPONENT="liblttng_ust" -fno-strict-aliasing
> +liblttng_ust_la_CFLAGS = -DUST_COMPONENT="liblttng_ust" $(AM_CFLAGS)
> diff --git a/libringbuffer/Makefile.am b/libringbuffer/Makefile.am
> index 33db165..9c3b993 100644
> --- a/libringbuffer/Makefile.am
> +++ b/libringbuffer/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> noinst_LTLIBRARIES = libringbuffer.la
> 
> @@ -17,4 +17,4 @@ libringbuffer_la_LIBADD = \
> 	-lpthread \
> 	-lrt
> 
> -libringbuffer_la_CFLAGS = -DUST_COMPONENT="libringbuffer" -fno-strict-aliasing
> +libringbuffer_la_CFLAGS = -DUST_COMPONENT="libringbuffer" $(AM_CFLAGS)
> diff --git a/snprintf/Makefile.am b/snprintf/Makefile.am
> index a32ed4f..b01d13e 100644
> --- a/snprintf/Makefile.am
> +++ b/snprintf/Makefile.am
> @@ -1,5 +1,5 @@
> AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libustcomm
> -AM_CFLAGS = -fno-strict-aliasing
> +AM_CFLAGS += -fno-strict-aliasing
> 
> noinst_LTLIBRARIES = libustsnprintf.la
> libustsnprintf_la_SOURCES = \
> @@ -19,4 +19,4 @@ libustsnprintf_la_SOURCES = \
> 	patient_write.c
> 
> libustsnprintf_la_LDFLAGS = -no-undefined -static
> -libustsnprintf_la_CFLAGS = -DUST_COMPONENT="lttng_ust_snprintf" -fPIC
> -fno-strict-aliasing
> +libustsnprintf_la_CFLAGS = -DUST_COMPONENT="lttng_ust_snprintf" -fPIC
> $(AM_CFLAGS)
> diff --git a/tests/benchmark/Makefile.am b/tests/benchmark/Makefile.am
> index 89452d2..4ea420c 100644
> --- a/tests/benchmark/Makefile.am
> +++ b/tests/benchmark/Makefile.am
> @@ -5,7 +5,7 @@ bench1_SOURCES = bench.c tp.c ust_tests_benchmark.h
> bench1_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
> bench2_SOURCES = bench.c tp.c ust_tests_benchmark.h
> bench2_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
> -bench2_CFLAGS = -DTRACING
> +bench2_CFLAGS = -DTRACING $(AM_CFLAGS)
> 
> dist_noinst_SCRIPTS = test_benchmark ptime
> 
> diff --git a/tests/ctf-types/Makefile.am b/tests/ctf-types/Makefile.am
> index 366870e..a9b40b6 100644
> --- a/tests/ctf-types/Makefile.am
> +++ b/tests/ctf-types/Makefile.am
> @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -Wsystem-headers
> noinst_PROGRAMS = ctf-types
> ctf_types_SOURCES = ctf-types.c tp.c ust_tests_ctf_types.h
> ctf_types_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
> -ctf_types_CFLAGS = -Werror=old-style-definition
> +ctf_types_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
> 
> if LTTNG_UST_BUILD_WITH_LIBDL
> ctf_types_LDADD += -ldl
> diff --git a/tests/hello/Makefile.am b/tests/hello/Makefile.am
> index 324c2cd..cb4d462 100644
> --- a/tests/hello/Makefile.am
> +++ b/tests/hello/Makefile.am
> @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -Wsystem-headers
> noinst_PROGRAMS = hello
> hello_SOURCES = hello.c tp.c ust_tests_hello.h
> hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
> -hello_CFLAGS = -Werror=old-style-definition
> +hello_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
> 
> if LTTNG_UST_BUILD_WITH_LIBDL
> hello_LDADD += -ldl
> diff --git a/tests/test-app-ctx/Makefile.am b/tests/test-app-ctx/Makefile.am
> index 324c2cd..cb4d462 100644
> --- a/tests/test-app-ctx/Makefile.am
> +++ b/tests/test-app-ctx/Makefile.am
> @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -Wsystem-headers
> noinst_PROGRAMS = hello
> hello_SOURCES = hello.c tp.c ust_tests_hello.h
> hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
> -hello_CFLAGS = -Werror=old-style-definition
> +hello_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
> 
> if LTTNG_UST_BUILD_WITH_LIBDL
> hello_LDADD += -ldl
> diff --git a/tests/trace_event/Makefile.am b/tests/trace_event/Makefile.am
> index 3e2fe81..2105a18 100644
> --- a/tests/trace_event/Makefile.am
> +++ b/tests/trace_event/Makefile.am
> @@ -5,6 +5,6 @@ trace_event_test_SOURCES = trace_event_test.c trace_event_test.h
> trace_event_test_LDADD = $(top_builddir)/libust/libust.la \
> 			 $(top_builddir)/libust-initializer.o -lpthread -lrt
> 
> -CFLAGS_trace_event_test.o = -I$(src)
> +CFLAGS_trace_event_test.o = -I$(src) $(AM_CFLAGS)
> noinst_SCRIPTS = run
> EXTRA_DIST = run
> diff --git a/tests/tracepoint/Makefile.am b/tests/tracepoint/Makefile.am
> index 3c3fe90..cf8aaa0 100644
> --- a/tests/tracepoint/Makefile.am
> +++ b/tests/tracepoint/Makefile.am
> @@ -9,6 +9,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
> #FIXME: this test is broken:
> #ust/tests/tracepoint/tracepoint_test.c:64: undefined reference to
> #`register_trace_ust_event_msg'
> -#CFLAGS_tracepoint_test.o = -I$(src)
> +#CFLAGS_tracepoint_test.o = -I$(src) $(AM_CFLAGS)
> noinst_SCRIPTS = run
> EXTRA_DIST = run
> diff --git a/tests/tracepoint/benchmark/Makefile.am
> b/tests/tracepoint/benchmark/Makefile.am
> index 1080b44..4a38707 100644
> --- a/tests/tracepoint/benchmark/Makefile.am
> +++ b/tests/tracepoint/benchmark/Makefile.am
> @@ -4,4 +4,4 @@ noinst_PROGRAMS = tracepoint_benchmark
> tracepoint_benchmark_SOURCES = tracepoint_benchmark.c tracepoint_benchmark.h
> tracepoint_benchmark_LDADD = $(top_builddir)/libust/libust.la
> $(top_builddir)/libust-initializer.o -lpthread
> 
> -CFLAGS_tracepoint_benchmark.o = -I$(src) -g
> +CFLAGS_tracepoint_benchmark.o = -I$(src) -g $(AM_CFLAGS)
> diff --git a/tests/ust-variant/Makefile.am b/tests/ust-variant/Makefile.am
> index 3c3d61d..5d741bd 100644
> --- a/tests/ust-variant/Makefile.am
> +++ b/tests/ust-variant/Makefile.am
> @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
> -Wsystem-headers
> noinst_PROGRAMS = ust-variant
> ust_variant_SOURCES = ust-variant.c
> ust_variant_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
> -ust_variant_CFLAGS = -Werror=old-style-definition
> +ust_variant_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
> 
> if LTTNG_UST_BUILD_WITH_LIBDL
> ust_variant_LDADD += -ldl
> --
> 2.7.4

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list