From ebbe3f506cfd21753b207fcf489f5fc15654faac Mon Sep 17 00:00:00 2001
From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Date: Tue, 21 Jul 2015 11:33:17 +0100
Subject: [PATCH] malloc: fix combined lib build

Malloc was moved to the EAL and dummy malloc library was left
to not break apps that had a librte_malloc.so dependency.
Note that the dummy library will be removed in the next release.

When building a combined library, all objects are copied to the same
directory before creating the library itself.

There are a few issues:
 - CONFIG_RTE_LIBRTE_MALLOC is not a valid option anymore resulting
 in wrong syntax and a compilation failure. Fix it by replacing it
 with CONFIG_RTE_LIBRTE_EAL.
 - As we kept a dummy library, there are now two objects with the
 same name. This means that the proper rte_malloc.o object in eal gets
 overwritten by an empty rte_malloc.o object from the dummy malloc lib.
 Fix it by changing the name of rte_malloc.o object in the dummy
 library.
 - Update the copyright year.

Fixes: 2f9d47013e4dbb738 ("mem: move librte_malloc to eal/common")

Reported-by: Alin Rauta <alin.rauta@intel.com>
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
 lib/librte_malloc/Makefile                             | 4 ++--
 lib/librte_malloc/{rte_malloc.c => rte_malloc_empty.c} | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
 rename lib/librte_malloc/{rte_malloc.c => rte_malloc_empty.c} (96%)

diff --git a/lib/librte_malloc/Makefile b/lib/librte_malloc/Makefile
index 32d86b95c5..9558f3d9d8 100644
--- a/lib/librte_malloc/Makefile
+++ b/lib/librte_malloc/Makefile
@@ -40,9 +40,9 @@ CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
 EXPORT_MAP := rte_malloc_version.map
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_MALLOC) := rte_malloc.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL) := rte_malloc_empty.c
 
 # this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MALLOC) += lib/librte_eal
+DEPDIRS-$(CONFIG_RTE_LIBRTE_EAL) += lib/librte_eal
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_malloc/rte_malloc.c b/lib/librte_malloc/rte_malloc_empty.c
similarity index 96%
rename from lib/librte_malloc/rte_malloc.c
rename to lib/librte_malloc/rte_malloc_empty.c
index 4b9dc7f509..4892a61445 100644
--- a/lib/librte_malloc/rte_malloc.c
+++ b/lib/librte_malloc/rte_malloc_empty.c
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
  *   All rights reserved.
  *
  *   Redistribution and use in source and binary forms, with or without
-- 
2.39.5