diff mbox

[v2,for-4.7,14/14] tools/python: corrently use LDFLAGS and CFLAGS

Message ID 1461682343-20597-15-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monne April 26, 2016, 2:52 p.m. UTC
It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will
error out if linker flags are passed when creating object files. Fix this by
properly passing CFLAGS and LDFLAGS, instead of putting everything in
CFLAGS.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/python/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Douglas Goldstein April 26, 2016, 3:04 p.m. UTC | #1
On 4/26/16 9:52 AM, Roger Pau Monne wrote:
> It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will
> error out if linker flags are passed when creating object files. Fix this by
> properly passing CFLAGS and LDFLAGS, instead of putting everything in
> CFLAGS.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---

Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Wei Liu April 26, 2016, 3:35 p.m. UTC | #2
On Tue, Apr 26, 2016 at 04:52:23PM +0200, Roger Pau Monne wrote:
> It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will
> error out if linker flags are passed when creating object files. Fix this by
> properly passing CFLAGS and LDFLAGS, instead of putting everything in
> CFLAGS.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

diff --git a/tools/python/Makefile b/tools/python/Makefile
index 2363537..da08f46 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -4,7 +4,8 @@  include $(XEN_ROOT)/tools/Rules.mk
 .PHONY: all
 all: build
 
-PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
+PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
 
 .PHONY: build
 build:
@@ -14,8 +15,9 @@  build:
 install:
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py install $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)"  \
+		--force
 
 	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)