All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lttng-ust v2] Move include directive from CFLAGS to LOCAL_CPPFLAGS in examples' Makefiles
       [not found] <1369771309-1773-1-git-send-email-jeremie.galarneau@efficios.com>
@ 2013-05-28 22:19 ` Jérémie Galarneau
       [not found] ` <1369779558-20747-1-git-send-email-jeremie.galarneau@efficios.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Jérémie Galarneau @ 2013-05-28 22:19 UTC (permalink / raw)
  To: lttng-dev

The use of LOCAL_* flags and override directives ensures that the build
succeeds even if the user explicitly overrides CFLAGS/CPPFLAGS/LDFLAGS.

Fixes #537

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
---
 doc/examples/demo/Makefile             | 14 +++++++-------
 doc/examples/easy-ust/Makefile         | 10 +++++-----
 doc/examples/hello-static-lib/Makefile | 10 +++++-----
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/doc/examples/demo/Makefile b/doc/examples/demo/Makefile
index bbc8ccb..27ca92b 100644
--- a/doc/examples/demo/Makefile
+++ b/doc/examples/demo/Makefile
@@ -15,14 +15,14 @@
 CC = gcc
 LIBS = -ldl	# On Linux
 #LIBS = -lc	# On BSD
-CFLAGS += -I.
+LOCAL_CPPFLAGS += -I.
 
 # Only necessary when building from the source tree and lttng-ust is not
 # installed
 ifdef BUILD_EXAMPLES_FROM_TREE
-CFLAGS += -I../../../include/
+LOCAL_CPPFLAGS += -I../../../include/
 LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
-LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
+override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
 
 # Third-party Makefiles have to define these targets to integrate with an
 # automake project
@@ -37,22 +37,22 @@ endif
 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) $(CFLAGS) -fpic -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
 
 tp2.o: tp2.c ust_tests_demo2.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
 
 lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o
 	$(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
 
 tp3.o: tp3.c ust_tests_demo3.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
 
 lttng-ust-provider-ust-tests-demo3.so: tp3.o
 	$(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
 
 demo.o: demo.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 demo: demo.o
 	$(CC) -o $@ $^ $(LIBS)
diff --git a/doc/examples/easy-ust/Makefile b/doc/examples/easy-ust/Makefile
index e20e53a..e3546e1 100644
--- a/doc/examples/easy-ust/Makefile
+++ b/doc/examples/easy-ust/Makefile
@@ -17,14 +17,14 @@
 CC = gcc
 LIBS = -ldl -llttng-ust		# On Linux
 #LIBS = -lc -llttng-ust		# On BSD
-CFLAGS += -I.
+LOCAL_CPPFLAGS += -I.
 
 # Only necessary when building from the source tree and lttng-ust is not
 # installed
 ifdef BUILD_EXAMPLES_FROM_TREE
-CFLAGS += -I../../../include/
+LOCAL_CPPFLAGS += -I../../../include/
 LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
-LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
+override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
 
 # Third-party Makefiles have to define these targets to integrate with an
 # automake project
@@ -42,10 +42,10 @@ sample: sample.o tp.o
 	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
 
 sample.o: sample.c sample_component_provider.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 tp.o: tp.c sample_component_provider.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 html: sample_component_provider.html sample.html tp.html
 
diff --git a/doc/examples/hello-static-lib/Makefile b/doc/examples/hello-static-lib/Makefile
index dd246f7..85c64c1 100644
--- a/doc/examples/hello-static-lib/Makefile
+++ b/doc/examples/hello-static-lib/Makefile
@@ -13,16 +13,16 @@
 # a program with tracepoint provider probes compiled as static libraries.
 
 CC = gcc
-CFLAGS += -I.
+LOCAL_CPPFLAGS += -I.
 LIBS = -ldl -llttng-ust	# On Linux
 #LIBS = -lc -llttng-ust	# On BSD
 
 # Only necessary when building from the source tree and lttng-ust is not
 # installed
 ifdef BUILD_EXAMPLES_FROM_TREE
-CFLAGS += -I../../../include/
+LOCAL_CPPFLAGS += -I../../../include/
 LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
-LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
+override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
 
 # Third-party Makefiles have to define these targets to integrate with an
 # automake project
@@ -37,13 +37,13 @@ endif
 all: hello
 
 lttng-ust-provider-hello.o: tp.c ust_tests_hello.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 lttng-ust-provider-hello.a: lttng-ust-provider-hello.o
 	ar -rc $@ $^
 
 hello.o: hello.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 hello: hello.o lttng-ust-provider-hello.a
 	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
-- 
1.8.2.3


_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH lttng-ust v2] Move include directive from CFLAGS to LOCAL_CPPFLAGS in examples' Makefiles
       [not found] ` <1369779558-20747-1-git-send-email-jeremie.galarneau@efficios.com>
@ 2013-05-28 22:26   ` Mathieu Desnoyers
       [not found]   ` <20130528222616.GA1347@Krystal>
  2013-05-30 14:33   ` Mathieu Desnoyers
  2 siblings, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2013-05-28 22:26 UTC (permalink / raw)
  To: Jérémie Galarneau; +Cc: lttng-dev

* Jérémie Galarneau (jeremie.galarneau@efficios.com) wrote:
> The use of LOCAL_* flags and override directives ensures that the build
> succeeds even if the user explicitly overrides CFLAGS/CPPFLAGS/LDFLAGS.

why use LOCAL_CPPFLAGS on one hand, but "override LDFLAGS" on the other?
What's the difference ? Why should it differ ?

Thanks,

Mathieu

> 
> Fixes #537
> 
> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
> ---
>  doc/examples/demo/Makefile             | 14 +++++++-------
>  doc/examples/easy-ust/Makefile         | 10 +++++-----
>  doc/examples/hello-static-lib/Makefile | 10 +++++-----
>  3 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/doc/examples/demo/Makefile b/doc/examples/demo/Makefile
> index bbc8ccb..27ca92b 100644
> --- a/doc/examples/demo/Makefile
> +++ b/doc/examples/demo/Makefile
> @@ -15,14 +15,14 @@
>  CC = gcc
>  LIBS = -ldl	# On Linux
>  #LIBS = -lc	# On BSD
> -CFLAGS += -I.
> +LOCAL_CPPFLAGS += -I.
>  
>  # Only necessary when building from the source tree and lttng-ust is not
>  # installed
>  ifdef BUILD_EXAMPLES_FROM_TREE
> -CFLAGS += -I../../../include/
> +LOCAL_CPPFLAGS += -I../../../include/
>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>  
>  # Third-party Makefiles have to define these targets to integrate with an
>  # automake project
> @@ -37,22 +37,22 @@ endif
>  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) $(CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>  
>  tp2.o: tp2.c ust_tests_demo2.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>  
>  lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o
>  	$(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
>  
>  tp3.o: tp3.c ust_tests_demo3.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>  
>  lttng-ust-provider-ust-tests-demo3.so: tp3.o
>  	$(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
>  
>  demo.o: demo.c
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  demo: demo.o
>  	$(CC) -o $@ $^ $(LIBS)
> diff --git a/doc/examples/easy-ust/Makefile b/doc/examples/easy-ust/Makefile
> index e20e53a..e3546e1 100644
> --- a/doc/examples/easy-ust/Makefile
> +++ b/doc/examples/easy-ust/Makefile
> @@ -17,14 +17,14 @@
>  CC = gcc
>  LIBS = -ldl -llttng-ust		# On Linux
>  #LIBS = -lc -llttng-ust		# On BSD
> -CFLAGS += -I.
> +LOCAL_CPPFLAGS += -I.
>  
>  # Only necessary when building from the source tree and lttng-ust is not
>  # installed
>  ifdef BUILD_EXAMPLES_FROM_TREE
> -CFLAGS += -I../../../include/
> +LOCAL_CPPFLAGS += -I../../../include/
>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>  
>  # Third-party Makefiles have to define these targets to integrate with an
>  # automake project
> @@ -42,10 +42,10 @@ sample: sample.o tp.o
>  	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
>  
>  sample.o: sample.c sample_component_provider.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  tp.o: tp.c sample_component_provider.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  html: sample_component_provider.html sample.html tp.html
>  
> diff --git a/doc/examples/hello-static-lib/Makefile b/doc/examples/hello-static-lib/Makefile
> index dd246f7..85c64c1 100644
> --- a/doc/examples/hello-static-lib/Makefile
> +++ b/doc/examples/hello-static-lib/Makefile
> @@ -13,16 +13,16 @@
>  # a program with tracepoint provider probes compiled as static libraries.
>  
>  CC = gcc
> -CFLAGS += -I.
> +LOCAL_CPPFLAGS += -I.
>  LIBS = -ldl -llttng-ust	# On Linux
>  #LIBS = -lc -llttng-ust	# On BSD
>  
>  # Only necessary when building from the source tree and lttng-ust is not
>  # installed
>  ifdef BUILD_EXAMPLES_FROM_TREE
> -CFLAGS += -I../../../include/
> +LOCAL_CPPFLAGS += -I../../../include/
>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>  
>  # Third-party Makefiles have to define these targets to integrate with an
>  # automake project
> @@ -37,13 +37,13 @@ endif
>  all: hello
>  
>  lttng-ust-provider-hello.o: tp.c ust_tests_hello.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  lttng-ust-provider-hello.a: lttng-ust-provider-hello.o
>  	ar -rc $@ $^
>  
>  hello.o: hello.c
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  hello: hello.o lttng-ust-provider-hello.a
>  	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
> -- 
> 1.8.2.3
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH lttng-ust v2] Move include directive from CFLAGS to LOCAL_CPPFLAGS in examples' Makefiles
       [not found]   ` <20130528222616.GA1347@Krystal>
@ 2013-05-28 22:44     ` Jérémie Galarneau
  0 siblings, 0 replies; 4+ messages in thread
From: Jérémie Galarneau @ 2013-05-28 22:44 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev

On Tue, May 28, 2013 at 6:26 PM, Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
> * Jérémie Galarneau (jeremie.galarneau@efficios.com) wrote:
>> The use of LOCAL_* flags and override directives ensures that the build
>> succeeds even if the user explicitly overrides CFLAGS/CPPFLAGS/LDFLAGS.
>
> why use LOCAL_CPPFLAGS on one hand, but "override LDFLAGS" on the other?
> What's the difference ?

LOCAL_CPPFLAGS is necessary to build the example in and out of the
lttng-ust tree. However, the LDFLAGS modification is only necessary
when building in-tree (without installing lttng-ust).

> Why should it differ ?

I expect people to use these Makefiles as templates for their own
projects and to completely strip the "ifdef BUILD_EXAMPLES_FROM_TREE"
section. I'm using "override" here to avoid introducing a superfluous
variable in the intended purpose of these examples.

It doesn't make a functional difference; I just want to keep these
examples as dead-simple as possible :)

Jérémie

>
> Thanks,
>
> Mathieu
>
>>
>> Fixes #537
>>
>> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
>> ---
>>  doc/examples/demo/Makefile             | 14 +++++++-------
>>  doc/examples/easy-ust/Makefile         | 10 +++++-----
>>  doc/examples/hello-static-lib/Makefile | 10 +++++-----
>>  3 files changed, 17 insertions(+), 17 deletions(-)
>>
>> diff --git a/doc/examples/demo/Makefile b/doc/examples/demo/Makefile
>> index bbc8ccb..27ca92b 100644
>> --- a/doc/examples/demo/Makefile
>> +++ b/doc/examples/demo/Makefile
>> @@ -15,14 +15,14 @@
>>  CC = gcc
>>  LIBS = -ldl  # On Linux
>>  #LIBS = -lc  # On BSD
>> -CFLAGS += -I.
>> +LOCAL_CPPFLAGS += -I.
>>
>>  # Only necessary when building from the source tree and lttng-ust is not
>>  # installed
>>  ifdef BUILD_EXAMPLES_FROM_TREE
>> -CFLAGS += -I../../../include/
>> +LOCAL_CPPFLAGS += -I../../../include/
>>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
>> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>>
>>  # Third-party Makefiles have to define these targets to integrate with an
>>  # automake project
>> @@ -37,22 +37,22 @@ endif
>>  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) $(CFLAGS) -fpic -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>>
>>  tp2.o: tp2.c ust_tests_demo2.h
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>>
>>  lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o
>>       $(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
>>
>>  tp3.o: tp3.c ust_tests_demo3.h
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>>
>>  lttng-ust-provider-ust-tests-demo3.so: tp3.o
>>       $(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
>>
>>  demo.o: demo.c
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>>
>>  demo: demo.o
>>       $(CC) -o $@ $^ $(LIBS)
>> diff --git a/doc/examples/easy-ust/Makefile b/doc/examples/easy-ust/Makefile
>> index e20e53a..e3546e1 100644
>> --- a/doc/examples/easy-ust/Makefile
>> +++ b/doc/examples/easy-ust/Makefile
>> @@ -17,14 +17,14 @@
>>  CC = gcc
>>  LIBS = -ldl -llttng-ust              # On Linux
>>  #LIBS = -lc -llttng-ust              # On BSD
>> -CFLAGS += -I.
>> +LOCAL_CPPFLAGS += -I.
>>
>>  # Only necessary when building from the source tree and lttng-ust is not
>>  # installed
>>  ifdef BUILD_EXAMPLES_FROM_TREE
>> -CFLAGS += -I../../../include/
>> +LOCAL_CPPFLAGS += -I../../../include/
>>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
>> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>>
>>  # Third-party Makefiles have to define these targets to integrate with an
>>  # automake project
>> @@ -42,10 +42,10 @@ sample: sample.o tp.o
>>       $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
>>
>>  sample.o: sample.c sample_component_provider.h
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>>
>>  tp.o: tp.c sample_component_provider.h
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>>
>>  html: sample_component_provider.html sample.html tp.html
>>
>> diff --git a/doc/examples/hello-static-lib/Makefile b/doc/examples/hello-static-lib/Makefile
>> index dd246f7..85c64c1 100644
>> --- a/doc/examples/hello-static-lib/Makefile
>> +++ b/doc/examples/hello-static-lib/Makefile
>> @@ -13,16 +13,16 @@
>>  # a program with tracepoint provider probes compiled as static libraries.
>>
>>  CC = gcc
>> -CFLAGS += -I.
>> +LOCAL_CPPFLAGS += -I.
>>  LIBS = -ldl -llttng-ust      # On Linux
>>  #LIBS = -lc -llttng-ust      # On BSD
>>
>>  # Only necessary when building from the source tree and lttng-ust is not
>>  # installed
>>  ifdef BUILD_EXAMPLES_FROM_TREE
>> -CFLAGS += -I../../../include/
>> +LOCAL_CPPFLAGS += -I../../../include/
>>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
>> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>>
>>  # Third-party Makefiles have to define these targets to integrate with an
>>  # automake project
>> @@ -37,13 +37,13 @@ endif
>>  all: hello
>>
>>  lttng-ust-provider-hello.o: tp.c ust_tests_hello.h
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>>
>>  lttng-ust-provider-hello.a: lttng-ust-provider-hello.o
>>       ar -rc $@ $^
>>
>>  hello.o: hello.c
>> -     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
>> +     $(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>>
>>  hello: hello.o lttng-ust-provider-hello.a
>>       $(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
>> --
>> 1.8.2.3
>>
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev@lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH lttng-ust v2] Move include directive from CFLAGS to LOCAL_CPPFLAGS in examples' Makefiles
       [not found] ` <1369779558-20747-1-git-send-email-jeremie.galarneau@efficios.com>
  2013-05-28 22:26   ` Mathieu Desnoyers
       [not found]   ` <20130528222616.GA1347@Krystal>
@ 2013-05-30 14:33   ` Mathieu Desnoyers
  2 siblings, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2013-05-30 14:33 UTC (permalink / raw)
  To: Jérémie Galarneau; +Cc: lttng-dev

* Jérémie Galarneau (jeremie.galarneau@efficios.com) wrote:
> The use of LOCAL_* flags and override directives ensures that the build
> succeeds even if the user explicitly overrides CFLAGS/CPPFLAGS/LDFLAGS.

merged into master and stable-2.2.

Thanks!

Mathieu

> 
> Fixes #537
> 
> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
> ---
>  doc/examples/demo/Makefile             | 14 +++++++-------
>  doc/examples/easy-ust/Makefile         | 10 +++++-----
>  doc/examples/hello-static-lib/Makefile | 10 +++++-----
>  3 files changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/doc/examples/demo/Makefile b/doc/examples/demo/Makefile
> index bbc8ccb..27ca92b 100644
> --- a/doc/examples/demo/Makefile
> +++ b/doc/examples/demo/Makefile
> @@ -15,14 +15,14 @@
>  CC = gcc
>  LIBS = -ldl	# On Linux
>  #LIBS = -lc	# On BSD
> -CFLAGS += -I.
> +LOCAL_CPPFLAGS += -I.
>  
>  # Only necessary when building from the source tree and lttng-ust is not
>  # installed
>  ifdef BUILD_EXAMPLES_FROM_TREE
> -CFLAGS += -I../../../include/
> +LOCAL_CPPFLAGS += -I../../../include/
>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>  
>  # Third-party Makefiles have to define these targets to integrate with an
>  # automake project
> @@ -37,22 +37,22 @@ endif
>  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) $(CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>  
>  tp2.o: tp2.c ust_tests_demo2.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>  
>  lttng-ust-provider-ust-tests-demo.so: tp.o tp2.o
>  	$(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
>  
>  tp3.o: tp3.c ust_tests_demo3.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -fpic -c -o $@ $<
>  
>  lttng-ust-provider-ust-tests-demo3.so: tp3.o
>  	$(CC) -shared -o $@ $(LDFLAGS) -llttng-ust $^
>  
>  demo.o: demo.c
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  demo: demo.o
>  	$(CC) -o $@ $^ $(LIBS)
> diff --git a/doc/examples/easy-ust/Makefile b/doc/examples/easy-ust/Makefile
> index e20e53a..e3546e1 100644
> --- a/doc/examples/easy-ust/Makefile
> +++ b/doc/examples/easy-ust/Makefile
> @@ -17,14 +17,14 @@
>  CC = gcc
>  LIBS = -ldl -llttng-ust		# On Linux
>  #LIBS = -lc -llttng-ust		# On BSD
> -CFLAGS += -I.
> +LOCAL_CPPFLAGS += -I.
>  
>  # Only necessary when building from the source tree and lttng-ust is not
>  # installed
>  ifdef BUILD_EXAMPLES_FROM_TREE
> -CFLAGS += -I../../../include/
> +LOCAL_CPPFLAGS += -I../../../include/
>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>  
>  # Third-party Makefiles have to define these targets to integrate with an
>  # automake project
> @@ -42,10 +42,10 @@ sample: sample.o tp.o
>  	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
>  
>  sample.o: sample.c sample_component_provider.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  tp.o: tp.c sample_component_provider.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  html: sample_component_provider.html sample.html tp.html
>  
> diff --git a/doc/examples/hello-static-lib/Makefile b/doc/examples/hello-static-lib/Makefile
> index dd246f7..85c64c1 100644
> --- a/doc/examples/hello-static-lib/Makefile
> +++ b/doc/examples/hello-static-lib/Makefile
> @@ -13,16 +13,16 @@
>  # a program with tracepoint provider probes compiled as static libraries.
>  
>  CC = gcc
> -CFLAGS += -I.
> +LOCAL_CPPFLAGS += -I.
>  LIBS = -ldl -llttng-ust	# On Linux
>  #LIBS = -lc -llttng-ust	# On BSD
>  
>  # Only necessary when building from the source tree and lttng-ust is not
>  # installed
>  ifdef BUILD_EXAMPLES_FROM_TREE
> -CFLAGS += -I../../../include/
> +LOCAL_CPPFLAGS += -I../../../include/
>  LIBLTTNG_UST_PATH = ../../../liblttng-ust/.libs/
> -LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
> +override LDFLAGS += -L$(LIBLTTNG_UST_PATH) -Wl,-rpath='$$ORIGIN/$(LIBLTTNG_UST_PATH)'
>  
>  # Third-party Makefiles have to define these targets to integrate with an
>  # automake project
> @@ -37,13 +37,13 @@ endif
>  all: hello
>  
>  lttng-ust-provider-hello.o: tp.c ust_tests_hello.h
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  lttng-ust-provider-hello.a: lttng-ust-provider-hello.o
>  	ar -rc $@ $^
>  
>  hello.o: hello.c
> -	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
> +	$(CC) $(CPPFLAGS) $(LOCAL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
>  
>  hello: hello.o lttng-ust-provider-hello.a
>  	$(CC) -o $@ $(LDFLAGS) $^ $(LIBS)
> -- 
> 1.8.2.3
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-30 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1369771309-1773-1-git-send-email-jeremie.galarneau@efficios.com>
2013-05-28 22:19 ` [PATCH lttng-ust v2] Move include directive from CFLAGS to LOCAL_CPPFLAGS in examples' Makefiles Jérémie Galarneau
     [not found] ` <1369779558-20747-1-git-send-email-jeremie.galarneau@efficios.com>
2013-05-28 22:26   ` Mathieu Desnoyers
     [not found]   ` <20130528222616.GA1347@Krystal>
2013-05-28 22:44     ` Jérémie Galarneau
2013-05-30 14:33   ` Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.