diff mbox

Makefiles: Allow CFLAGS to overide the build

Message ID 1392851698-31979-1-git-send-email-mike.holmes@linaro.org
State Accepted, archived
Commit f5829c4a78f561422bbc831518d53f621490b4cb
Headers show

Commit Message

Mike Holmes Feb. 19, 2014, 11:14 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---

clean up other minor issues seen in LDFLAGS

 .checkpatch.conf                |  1 +
 Makefile.inc                    | 15 +++++++--------
 platform/linux-generic/Makefile | 10 +++++-----
 test/Makefile.inc               |  4 ++--
 test/api_test/Makefile          |  6 +++---
 test/example/Makefile           |  2 +-
 test/packet/Makefile            |  4 ++--
 test/packet_netmap/Makefile     |  5 ++---
 8 files changed, 23 insertions(+), 24 deletions(-)

Comments

Anders Roxell Feb. 20, 2014, 7:25 a.m. UTC | #1
On 2014-02-19 18:14, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
> 
> clean up other minor issues seen in LDFLAGS
> 
>  .checkpatch.conf                |  1 +
>  Makefile.inc                    | 15 +++++++--------
>  platform/linux-generic/Makefile | 10 +++++-----
>  test/Makefile.inc               |  4 ++--
>  test/api_test/Makefile          |  6 +++---
>  test/example/Makefile           |  2 +-
>  test/packet/Makefile            |  4 ++--
>  test/packet_netmap/Makefile     |  5 ++---
>  8 files changed, 23 insertions(+), 24 deletions(-)
> 
> diff --git a/.checkpatch.conf b/.checkpatch.conf
> index e1a25c8..9076410 100644
> --- a/.checkpatch.conf
> +++ b/.checkpatch.conf
> @@ -1,3 +1,4 @@
>  --no-tree
>  --strict
>  --ignore=NEW_TYPEDEFS
> +--ignore=DEPRECATED_VARIABLE
> diff --git a/Makefile.inc b/Makefile.inc
> index 523385d..fd7d435 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -4,17 +4,16 @@
>  # SPDX-License-Identifier:	BSD-3-Clause
>  
>  PLATFORM ?= linux-generic
> -CFLAGS  += -DODP_DEBUG=1
> -CFLAGS  += -O3
> -#CFLAGS  += -O0 -g
> +EXTRA_CFLAGS  += -DODP_DEBUG=1
> +EXTRA_CFLAGS  += -O3
>  
>  OBJ_DIR  = ./obj
>  DESTDIR ?= $(ODP_ROOT)/build
>  
> -CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -CFLAGS += -Wformat-security -Wundef -Wwrite-strings
> +EXTRA_CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> +EXTRA_CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> +EXTRA_CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> +EXTRA_CFLAGS += -Wformat-security -Wundef -Wwrite-strings
>  
>  CC     ?= gcc
>  LD     ?= gcc
> @@ -26,5 +25,5 @@ RMDIR  := rm -rf
>  RM     := rm -f
>  COPY   := cp -r
>  
> -CFLAGS  += -pthread
> +EXTRA_CFLAGS  += -pthread
>  LDFLAGS += -pthread
> diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile
> index b640928..9284a0a 100644
> --- a/platform/linux-generic/Makefile
> +++ b/platform/linux-generic/Makefile
> @@ -32,12 +32,12 @@ ODP_ROOT = ../..
>  LIB_DIR  = ./lib
>  DOC_DIR  = ./doc
>  
> -CFLAGS  += -I$(ODP_ROOT)/include
> -CFLAGS  += -I./include
> -CFLAGS  += -I./include/api
> +EXTRA_CFLAGS  += -I$(ODP_ROOT)/include
> +EXTRA_CFLAGS  += -I./include
> +EXTRA_CFLAGS  += -I./include/api
>  
>  ifeq ($(ODP_HAVE_NETMAP),yes)
> -CFLAGS  += -DODP_HAVE_NETMAP
> +EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
>  endif
>  
>  include $(ODP_ROOT)/Makefile.inc
> @@ -93,7 +93,7 @@ $(DOC_DIR):
>  #
>  $(OBJ_DIR)/%.o: ./source/%.c
>  	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>  
>  #
>  # Lib rule
> diff --git a/test/Makefile.inc b/test/Makefile.inc
> index 72bbebd..63feecf 100644
> --- a/test/Makefile.inc
> +++ b/test/Makefile.inc
> @@ -5,8 +5,8 @@
>  
>  ODP_TEST_ROOT = $(ODP_ROOT)/test
>  
> -CFLAGS += -I$(DESTDIR)/include
> +EXTRA_CFLAGS += -I$(DESTDIR)/include
>  LIB = -L$(DESTDIR)/lib -lodp
>  
>  LDFLAGS += -lrt
> -LDFLAGS += $(EXTRA_CFLAGS)
> +#LDFLAGS += $(CFLAGS)

Can't we remove this line instead?

Cheers,
Anders

> diff --git a/test/api_test/Makefile b/test/api_test/Makefile
> index 15c18f4..741fbe4 100644
> --- a/test/api_test/Makefile
> +++ b/test/api_test/Makefile
> @@ -12,12 +12,12 @@ ODP_ATOMIC    = odp_atomic
>  ODP_SHM       = odp_shm
>  ODP_RING      = odp_ring
>  
> -CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
> +EXTRA_CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
>  
>  include ../Makefile.inc
>  include $(ODP_ROOT)/Makefile.inc
>  
> -CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
> +EXTRA_CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
>  
>  ATOMIC_OBJS  =
>  ATOMIC_OBJS += $(OBJ_DIR)/odp_common.o
> @@ -52,7 +52,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>  #
>  $(OBJ_DIR)/%.o: %.c
>  	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>  
>  #
>  # Link rule
> diff --git a/test/example/Makefile b/test/example/Makefile
> index d43e780..8064977 100644
> --- a/test/example/Makefile
> +++ b/test/example/Makefile
> @@ -30,7 +30,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>  #
>  $(OBJ_DIR)/%.o: %.c
>  	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>  
>  #
>  # Link rule
> diff --git a/test/packet/Makefile b/test/packet/Makefile
> index f1cb7d9..c66b37c 100644
> --- a/test/packet/Makefile
> +++ b/test/packet/Makefile
> @@ -9,7 +9,7 @@ ODP_APP  = odp_packet
>  include ../Makefile.inc
>  include $(ODP_ROOT)/Makefile.inc
>  
> -CFLAGS  += -I$(ODP_TEST_ROOT)/packet
> +EXTRA_CFLAGS  += -I$(ODP_TEST_ROOT)/packet
>  
>  OBJS     =
>  OBJS    += $(OBJ_DIR)/odp_example_pktio.o
> @@ -32,7 +32,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>  #
>  $(OBJ_DIR)/%.o: %.c
>  	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>  
>  #
>  # Link rule
> diff --git a/test/packet_netmap/Makefile b/test/packet_netmap/Makefile
> index 5febb33..8d5e5e8 100644
> --- a/test/packet_netmap/Makefile
> +++ b/test/packet_netmap/Makefile
> @@ -6,8 +6,7 @@
>  ODP_ROOT = ../..
>  ODP_APP  = odp_packet
>  
> -CFLAGS  += -DODP_HAVE_NETMAP
> -CFLAGS  += -O0 -g
> +EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
>  
>  include ../Makefile.inc
>  include $(ODP_ROOT)/Makefile.inc
> @@ -33,7 +32,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>  #
>  $(OBJ_DIR)/%.o: %.c
>  	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>  
>  #
>  # Link rule
> -- 
> 1.8.3.2
> 
> -- 
> You received this message because you are subscribed to the Google Groups "LNG ODP Sub-team - lng-odp@linaro.org" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lng-odp+unsubscribe@linaro.org.
> To post to this group, send email to lng-odp@linaro.org.
> Visit this group at http://groups.google.com/a/linaro.org/group/lng-odp/.
> To view this discussion on the web visit https://groups.google.com/a/linaro.org/d/msgid/lng-odp/1392851698-31979-1-git-send-email-mike.holmes%40linaro.org.
> For more options, visit https://groups.google.com/a/linaro.org/groups/opt_out.
Maxim Uvarov Feb. 24, 2014, 8:48 a.m. UTC | #2
applied!

Maxim.
On 02/20/2014 03:14 AM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>
> clean up other minor issues seen in LDFLAGS
>
>   .checkpatch.conf                |  1 +
>   Makefile.inc                    | 15 +++++++--------
>   platform/linux-generic/Makefile | 10 +++++-----
>   test/Makefile.inc               |  4 ++--
>   test/api_test/Makefile          |  6 +++---
>   test/example/Makefile           |  2 +-
>   test/packet/Makefile            |  4 ++--
>   test/packet_netmap/Makefile     |  5 ++---
>   8 files changed, 23 insertions(+), 24 deletions(-)
>
> diff --git a/.checkpatch.conf b/.checkpatch.conf
> index e1a25c8..9076410 100644
> --- a/.checkpatch.conf
> +++ b/.checkpatch.conf
> @@ -1,3 +1,4 @@
>   --no-tree
>   --strict
>   --ignore=NEW_TYPEDEFS
> +--ignore=DEPRECATED_VARIABLE
> diff --git a/Makefile.inc b/Makefile.inc
> index 523385d..fd7d435 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -4,17 +4,16 @@
>   # SPDX-License-Identifier:	BSD-3-Clause
>   
>   PLATFORM ?= linux-generic
> -CFLAGS  += -DODP_DEBUG=1
> -CFLAGS  += -O3
> -#CFLAGS  += -O0 -g
> +EXTRA_CFLAGS  += -DODP_DEBUG=1
> +EXTRA_CFLAGS  += -O3
>   
>   OBJ_DIR  = ./obj
>   DESTDIR ?= $(ODP_ROOT)/build
>   
> -CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> -CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> -CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> -CFLAGS += -Wformat-security -Wundef -Wwrite-strings
> +EXTRA_CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
> +EXTRA_CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
> +EXTRA_CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
> +EXTRA_CFLAGS += -Wformat-security -Wundef -Wwrite-strings
>   
>   CC     ?= gcc
>   LD     ?= gcc
> @@ -26,5 +25,5 @@ RMDIR  := rm -rf
>   RM     := rm -f
>   COPY   := cp -r
>   
> -CFLAGS  += -pthread
> +EXTRA_CFLAGS  += -pthread
>   LDFLAGS += -pthread
> diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile
> index b640928..9284a0a 100644
> --- a/platform/linux-generic/Makefile
> +++ b/platform/linux-generic/Makefile
> @@ -32,12 +32,12 @@ ODP_ROOT = ../..
>   LIB_DIR  = ./lib
>   DOC_DIR  = ./doc
>   
> -CFLAGS  += -I$(ODP_ROOT)/include
> -CFLAGS  += -I./include
> -CFLAGS  += -I./include/api
> +EXTRA_CFLAGS  += -I$(ODP_ROOT)/include
> +EXTRA_CFLAGS  += -I./include
> +EXTRA_CFLAGS  += -I./include/api
>   
>   ifeq ($(ODP_HAVE_NETMAP),yes)
> -CFLAGS  += -DODP_HAVE_NETMAP
> +EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
>   endif
>   
>   include $(ODP_ROOT)/Makefile.inc
> @@ -93,7 +93,7 @@ $(DOC_DIR):
>   #
>   $(OBJ_DIR)/%.o: ./source/%.c
>   	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>   
>   #
>   # Lib rule
> diff --git a/test/Makefile.inc b/test/Makefile.inc
> index 72bbebd..63feecf 100644
> --- a/test/Makefile.inc
> +++ b/test/Makefile.inc
> @@ -5,8 +5,8 @@
>   
>   ODP_TEST_ROOT = $(ODP_ROOT)/test
>   
> -CFLAGS += -I$(DESTDIR)/include
> +EXTRA_CFLAGS += -I$(DESTDIR)/include
>   LIB = -L$(DESTDIR)/lib -lodp
>   
>   LDFLAGS += -lrt
> -LDFLAGS += $(EXTRA_CFLAGS)
> +#LDFLAGS += $(CFLAGS)
> diff --git a/test/api_test/Makefile b/test/api_test/Makefile
> index 15c18f4..741fbe4 100644
> --- a/test/api_test/Makefile
> +++ b/test/api_test/Makefile
> @@ -12,12 +12,12 @@ ODP_ATOMIC    = odp_atomic
>   ODP_SHM       = odp_shm
>   ODP_RING      = odp_ring
>   
> -CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
> +EXTRA_CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
>   
>   include ../Makefile.inc
>   include $(ODP_ROOT)/Makefile.inc
>   
> -CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
> +EXTRA_CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
>   
>   ATOMIC_OBJS  =
>   ATOMIC_OBJS += $(OBJ_DIR)/odp_common.o
> @@ -52,7 +52,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>   #
>   $(OBJ_DIR)/%.o: %.c
>   	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>   
>   #
>   # Link rule
> diff --git a/test/example/Makefile b/test/example/Makefile
> index d43e780..8064977 100644
> --- a/test/example/Makefile
> +++ b/test/example/Makefile
> @@ -30,7 +30,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>   #
>   $(OBJ_DIR)/%.o: %.c
>   	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>   
>   #
>   # Link rule
> diff --git a/test/packet/Makefile b/test/packet/Makefile
> index f1cb7d9..c66b37c 100644
> --- a/test/packet/Makefile
> +++ b/test/packet/Makefile
> @@ -9,7 +9,7 @@ ODP_APP  = odp_packet
>   include ../Makefile.inc
>   include $(ODP_ROOT)/Makefile.inc
>   
> -CFLAGS  += -I$(ODP_TEST_ROOT)/packet
> +EXTRA_CFLAGS  += -I$(ODP_TEST_ROOT)/packet
>   
>   OBJS     =
>   OBJS    += $(OBJ_DIR)/odp_example_pktio.o
> @@ -32,7 +32,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>   #
>   $(OBJ_DIR)/%.o: %.c
>   	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>   
>   #
>   # Link rule
> diff --git a/test/packet_netmap/Makefile b/test/packet_netmap/Makefile
> index 5febb33..8d5e5e8 100644
> --- a/test/packet_netmap/Makefile
> +++ b/test/packet_netmap/Makefile
> @@ -6,8 +6,7 @@
>   ODP_ROOT = ../..
>   ODP_APP  = odp_packet
>   
> -CFLAGS  += -DODP_HAVE_NETMAP
> -CFLAGS  += -O0 -g
> +EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
>   
>   include ../Makefile.inc
>   include $(ODP_ROOT)/Makefile.inc
> @@ -33,7 +32,7 @@ $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
>   #
>   $(OBJ_DIR)/%.o: %.c
>   	$(ECHO) Compiling $<
> -	$(CC) -c -MD $(CFLAGS) -o $@ $<
> +	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
>   
>   #
>   # Link rule
diff mbox

Patch

diff --git a/.checkpatch.conf b/.checkpatch.conf
index e1a25c8..9076410 100644
--- a/.checkpatch.conf
+++ b/.checkpatch.conf
@@ -1,3 +1,4 @@ 
 --no-tree
 --strict
 --ignore=NEW_TYPEDEFS
+--ignore=DEPRECATED_VARIABLE
diff --git a/Makefile.inc b/Makefile.inc
index 523385d..fd7d435 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -4,17 +4,16 @@ 
 # SPDX-License-Identifier:	BSD-3-Clause
 
 PLATFORM ?= linux-generic
-CFLAGS  += -DODP_DEBUG=1
-CFLAGS  += -O3
-#CFLAGS  += -O0 -g
+EXTRA_CFLAGS  += -DODP_DEBUG=1
+EXTRA_CFLAGS  += -O3
 
 OBJ_DIR  = ./obj
 DESTDIR ?= $(ODP_ROOT)/build
 
-CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
-CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
-CFLAGS += -Wformat-security -Wundef -Wwrite-strings
+EXTRA_CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
+EXTRA_CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
+EXTRA_CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
+EXTRA_CFLAGS += -Wformat-security -Wundef -Wwrite-strings
 
 CC     ?= gcc
 LD     ?= gcc
@@ -26,5 +25,5 @@  RMDIR  := rm -rf
 RM     := rm -f
 COPY   := cp -r
 
-CFLAGS  += -pthread
+EXTRA_CFLAGS  += -pthread
 LDFLAGS += -pthread
diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile
index b640928..9284a0a 100644
--- a/platform/linux-generic/Makefile
+++ b/platform/linux-generic/Makefile
@@ -32,12 +32,12 @@  ODP_ROOT = ../..
 LIB_DIR  = ./lib
 DOC_DIR  = ./doc
 
-CFLAGS  += -I$(ODP_ROOT)/include
-CFLAGS  += -I./include
-CFLAGS  += -I./include/api
+EXTRA_CFLAGS  += -I$(ODP_ROOT)/include
+EXTRA_CFLAGS  += -I./include
+EXTRA_CFLAGS  += -I./include/api
 
 ifeq ($(ODP_HAVE_NETMAP),yes)
-CFLAGS  += -DODP_HAVE_NETMAP
+EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
 endif
 
 include $(ODP_ROOT)/Makefile.inc
@@ -93,7 +93,7 @@  $(DOC_DIR):
 #
 $(OBJ_DIR)/%.o: ./source/%.c
 	$(ECHO) Compiling $<
-	$(CC) -c -MD $(CFLAGS) -o $@ $<
+	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
 
 #
 # Lib rule
diff --git a/test/Makefile.inc b/test/Makefile.inc
index 72bbebd..63feecf 100644
--- a/test/Makefile.inc
+++ b/test/Makefile.inc
@@ -5,8 +5,8 @@ 
 
 ODP_TEST_ROOT = $(ODP_ROOT)/test
 
-CFLAGS += -I$(DESTDIR)/include
+EXTRA_CFLAGS += -I$(DESTDIR)/include
 LIB = -L$(DESTDIR)/lib -lodp
 
 LDFLAGS += -lrt
-LDFLAGS += $(EXTRA_CFLAGS)
+#LDFLAGS += $(CFLAGS)
diff --git a/test/api_test/Makefile b/test/api_test/Makefile
index 15c18f4..741fbe4 100644
--- a/test/api_test/Makefile
+++ b/test/api_test/Makefile
@@ -12,12 +12,12 @@  ODP_ATOMIC    = odp_atomic
 ODP_SHM       = odp_shm
 ODP_RING      = odp_ring
 
-CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
+EXTRA_CFLAGS  += -I$(ODP_ROOT)/platform/linux-generic/include
 
 include ../Makefile.inc
 include $(ODP_ROOT)/Makefile.inc
 
-CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
+EXTRA_CFLAGS      += -I$(ODP_TEST_ROOT)/api_test
 
 ATOMIC_OBJS  =
 ATOMIC_OBJS += $(OBJ_DIR)/odp_common.o
@@ -52,7 +52,7 @@  $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
 #
 $(OBJ_DIR)/%.o: %.c
 	$(ECHO) Compiling $<
-	$(CC) -c -MD $(CFLAGS) -o $@ $<
+	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
 
 #
 # Link rule
diff --git a/test/example/Makefile b/test/example/Makefile
index d43e780..8064977 100644
--- a/test/example/Makefile
+++ b/test/example/Makefile
@@ -30,7 +30,7 @@  $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
 #
 $(OBJ_DIR)/%.o: %.c
 	$(ECHO) Compiling $<
-	$(CC) -c -MD $(CFLAGS) -o $@ $<
+	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
 
 #
 # Link rule
diff --git a/test/packet/Makefile b/test/packet/Makefile
index f1cb7d9..c66b37c 100644
--- a/test/packet/Makefile
+++ b/test/packet/Makefile
@@ -9,7 +9,7 @@  ODP_APP  = odp_packet
 include ../Makefile.inc
 include $(ODP_ROOT)/Makefile.inc
 
-CFLAGS  += -I$(ODP_TEST_ROOT)/packet
+EXTRA_CFLAGS  += -I$(ODP_TEST_ROOT)/packet
 
 OBJS     =
 OBJS    += $(OBJ_DIR)/odp_example_pktio.o
@@ -32,7 +32,7 @@  $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
 #
 $(OBJ_DIR)/%.o: %.c
 	$(ECHO) Compiling $<
-	$(CC) -c -MD $(CFLAGS) -o $@ $<
+	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
 
 #
 # Link rule
diff --git a/test/packet_netmap/Makefile b/test/packet_netmap/Makefile
index 5febb33..8d5e5e8 100644
--- a/test/packet_netmap/Makefile
+++ b/test/packet_netmap/Makefile
@@ -6,8 +6,7 @@ 
 ODP_ROOT = ../..
 ODP_APP  = odp_packet
 
-CFLAGS  += -DODP_HAVE_NETMAP
-CFLAGS  += -O0 -g
+EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
 
 include ../Makefile.inc
 include $(ODP_ROOT)/Makefile.inc
@@ -33,7 +32,7 @@  $(OBJ_DIR): $(DESTDIR)/lib/libodp.a
 #
 $(OBJ_DIR)/%.o: %.c
 	$(ECHO) Compiling $<
-	$(CC) -c -MD $(CFLAGS) -o $@ $<
+	$(CC) -c -MD $(EXTRA_CFLAGS) $(CFLAGS) -o $@ $<
 
 #
 # Link rule