All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
To: lttng-dev@lists.lttng.org
Subject: [PATCH lttng-ust v2] Move include directive from CFLAGS to LOCAL_CPPFLAGS in examples' Makefiles
Date: Tue, 28 May 2013 18:19:18 -0400	[thread overview]
Message-ID: <1369779558-20747-1-git-send-email-jeremie.galarneau__23228.440542198$1369779606$gmane$org@efficios.com> (raw)
In-Reply-To: <1369771309-1773-1-git-send-email-jeremie.galarneau@efficios.com>

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

       reply	other threads:[~2013-05-28 22:19 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1369779558-20747-1-git-send-email-jeremie.galarneau__23228.440542198$1369779606$gmane$org@efficios.com' \
    --to=jeremie.galarneau@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.