From 336c5159b292db2b24c3593f72a12bb2077d836b Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Sat, 8 Feb 2014 19:41:50 +0100 Subject: [PATCH 1/2] use pkg-config to add valgrind include path makes knowledge of VALGRIND_VALGRIND_H vs. VALGRIND_H optional --- boards/native/Makefile.include | 3 ++- cpu/native/README | 8 -------- dist/Makefile | 10 +++------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index 5fee14a7d9..f8ddcdfa8e 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -22,7 +22,8 @@ export LINKFLAGS += -m32 -gc -ldl export ASFLAGS = export DEBUGGER_FLAGS = $(ELF) export VALGRIND_FLAGS ?= --track-origins=yes -all-valgrind: export CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -g +all-valgrind: export CFLAGS += -DHAVE_VALGRIND_H -g +all-valgrind: export INCLUDES += $(shell pkg-config valgrind --cflags) # backward compatability with glibc <= 2.17 for native ifeq ($(CPU),native) diff --git a/cpu/native/README b/cpu/native/README index 89ced7e029..956a815f49 100644 --- a/cpu/native/README +++ b/cpu/native/README @@ -32,14 +32,6 @@ As root call: echo 0 > /proc/sys/kernel/yama/ptrace_scope -PS: -If the all-valgrind make target fails you might have to adjust the -headers path. Change the parameter in boards/native/Makefile.include -from HAVE_VALGRIND_VALGRIND_H to HAVE_VALGRIND_H to resolve the -situation locally and open an issue to get it resolved permanently. (I -have not yet encountered a platform that actually uses the other -header path.) - NETWORK SUPPORT =============== diff --git a/dist/Makefile b/dist/Makefile index 116869de89..23d16d80d0 100644 --- a/dist/Makefile +++ b/dist/Makefile @@ -23,13 +23,9 @@ export RIOTBASE ?= $(CURDIR)/../../RIOT # Uncomment this to enable scheduler statistics for ps: #CFLAGS += -DSCHEDSTATISTICS -# If you want to use valgrind, you should recompile native with either -# HAVE_VALGRIND_H or HAVE_VALGRIND_VALGRIND_H depending on the location -# of the valgrind header (i.e. or ) -# For more information about the valgrind support of RIOT read: -# RIOT/cpu/native/README -#CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -#CFLAGS += -DHAVE_VALGRIND_H +# If you want to use native with valgrind, you should recompile native +# with the target all-valgrind instead of all: +# make -B clean all-valgrind # Uncomment this to enable code in RIOT that does safety checking # which is not needed in a production environment but helps in the From b175dbee918577818ce84b26dd6bd6f9cdfdc3b7 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Sat, 8 Feb 2014 19:42:54 +0100 Subject: [PATCH 2/2] update Makefiles to point to all-valgrind target Header path knowledge is not necessary anymore --- examples/ccn-lite-client/HOWTO | 2 +- examples/ccn-lite-client/Makefile | 10 +++------- examples/ccn-lite-relay/Makefile | 10 +++------- examples/default/Makefile | 10 +++------- examples/rpl_udp/Makefile | 10 +++------- tests/test_irq/Makefile | 7 ------- 6 files changed, 13 insertions(+), 36 deletions(-) diff --git a/examples/ccn-lite-client/HOWTO b/examples/ccn-lite-client/HOWTO index 5c8bd19f68..863187582e 100644 --- a/examples/ccn-lite-client/HOWTO +++ b/examples/ccn-lite-client/HOWTO @@ -2,7 +2,7 @@ simple appserver (all in one shell) ==================================================== 0. create tap devices: *./cpu/native/tapsetup.sh create 3* -1. build ccn-lite-client: *CFLAGS="-DHAVE_VALGRIND_VALGRIND_H" make -B clean all* +1. build ccn-lite-client: *make -B clean all-valgrind* 2. start: *./bin/native/ccn-lite-client.elf tap0* (valgrind support included) 3. start ccn thread: *ccn* [enter] (this starts the ccn relay network stack) 4. start appserver thread: *appserver* [enter] (this starts the userland appserver, which registers for "/riot/appserver/" diff --git a/examples/ccn-lite-client/Makefile b/examples/ccn-lite-client/Makefile index d850dbd18b..28680a180d 100644 --- a/examples/ccn-lite-client/Makefile +++ b/examples/ccn-lite-client/Makefile @@ -15,13 +15,9 @@ export RIOTBASE ?= $(CURDIR)/../.. # Uncomment this to enable scheduler statistics for ps: #CFLAGS += -DSCHEDSTATISTICS -# If you want to use valgrind, you should recompile native with either -# HAVE_VALGRIND_H or HAVE_VALGRIND_VALGRIND_H depending on the location -# of the valgrind header (i.e. or ) -# For more information about the valgrind support of RIOT read: -# RIOT/cpu/native/README -#CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -#CFLAGS += -DHAVE_VALGRIND_H +# If you want to use native with valgrind, you should recompile native +# with the target all-valgrind instead of all: +# make -B clean all-valgrind # Uncomment this to enable code in RIOT that does safety checking # which is not needed in a production environment but helps in the diff --git a/examples/ccn-lite-relay/Makefile b/examples/ccn-lite-relay/Makefile index 230e536d0b..96cf6d919e 100644 --- a/examples/ccn-lite-relay/Makefile +++ b/examples/ccn-lite-relay/Makefile @@ -15,13 +15,9 @@ export RIOTBASE ?= $(CURDIR)/../.. # Uncomment this to enable scheduler statistics for ps: #CFLAGS += -DSCHEDSTATISTICS -# If you want to use valgrind, you should recompile native with either -# HAVE_VALGRIND_H or HAVE_VALGRIND_VALGRIND_H depending on the location -# of the valgrind header (i.e. or ) -# For more information about the valgrind support of RIOT read: -# RIOT/cpu/native/README -#CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -#CFLAGS += -DHAVE_VALGRIND_H +# If you want to use native with valgrind, you should recompile native +# with the target all-valgrind instead of all: +# make -B clean all-valgrind # Uncomment this to enable code in RIOT that does safety checking # which is not needed in a production environment but helps in the diff --git a/examples/default/Makefile b/examples/default/Makefile index f5d01c389d..1ac0c27c08 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -15,13 +15,9 @@ export RIOTBASE ?= $(CURDIR)/../.. # Uncomment this to enable scheduler statistics for ps: #CFLAGS += -DSCHEDSTATISTICS -# If you want to use valgrind, you should recompile native with either -# HAVE_VALGRIND_H or HAVE_VALGRIND_VALGRIND_H depending on the location -# of the valgrind header (i.e. or ) -# For more information about the valgrind support of RIOT read: -# RIOT/cpu/native/README -#CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -#CFLAGS += -DHAVE_VALGRIND_H +# If you want to use native with valgrind, you should recompile native +# with the target all-valgrind instead of all: +# make -B clean all-valgrind # Uncomment this to enable code in RIOT that does safety checking # which is not needed in a production environment but helps in the diff --git a/examples/rpl_udp/Makefile b/examples/rpl_udp/Makefile index 13048094da..88a3f477c4 100644 --- a/examples/rpl_udp/Makefile +++ b/examples/rpl_udp/Makefile @@ -15,13 +15,9 @@ export RIOTBASE ?= $(CURDIR)/../.. # Uncomment this to enable scheduler statistics for ps: #CFLAGS += -DSCHEDSTATISTICS -# If you want to use valgrind, you should recompile native with either -# HAVE_VALGRIND_H or HAVE_VALGRIND_VALGRIND_H depending on the location -# of the valgrind header (i.e. or ) -# For more information about the valgrind support of RIOT read: -# RIOT/cpu/native/README -#CFLAGS += -DHAVE_VALGRIND_VALGRIND_H -#CFLAGS += -DHAVE_VALGRIND_H +# If you want to use native with valgrind, you should recompile native +# with the target all-valgrind instead of all: +# make -B clean all-valgrind # Uncomment this to enable code in RIOT that does safety checking # which is not needed in a production environment but helps in the diff --git a/tests/test_irq/Makefile b/tests/test_irq/Makefile index 4fc604b6ff..3a7ababb9b 100644 --- a/tests/test_irq/Makefile +++ b/tests/test_irq/Makefile @@ -1,6 +1,3 @@ -valgrind: CFLAGS += -g -valgrind: CFLAGS += -DHAVE_VALGRIND_VALGRIND_H - # name of your project export PROJECT = test_irq # @@ -19,7 +16,3 @@ else USEMODULE += auto_init USEMODULE += hwtimer USEMODULE += posix - -include $(RIOTBASE)/Makefile.include -valgrind: all -endif