[PATCH] Use target CC and LD to build kdump and kexec_test.

Jamey Sharp jamey at thetovacompany.com
Thu May 15 20:03:09 EDT 2008


Signed-off-by: Jamey Sharp <jamey at thetovacompany.com>
---
Another generic patch extracted from my Windows porting work.

I think this is correct, but review would be appreciated.

 Makefile.in         |    1 +
 configure.ac        |    2 ++
 kdump/Makefile      |    1 +
 kexec_test/Makefile |    4 ++--
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 037f9a4..b51c3a1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -37,6 +37,7 @@ AR		= @AR@
 BUILD_CC	= @BUILD_CC@
 BUILD_CFLAGS	= @BUILD_CFLAGS@
 TARGET_CC	= @TARGET_CC@
+TARGET_LD	= @TARGET_LD@
 TARGET_CFLAGS	= @TARGET_CFLAGS@
 
 
diff --git a/configure.ac b/configure.ac
index b2ad226..beb8b3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,7 @@ fi
 dnl Find compiler for target
 if test "${target}" != "${host}" ; then
 	AC_CHECK_PROGS(TARGET_CC, [${target_alias}-gcc ${target}-gcc gcc])
+	AC_CHECK_PROGS(TARGET_LD, [${target_alias}-ld ${target}-ld ld])
 else
 	TARGET_CC="$CC"
 fi
@@ -148,6 +149,7 @@ dnl ---Output variables...
 AC_SUBST([BUILD_CC])
 AC_SUBST([BUILD_CFLAGS])
 AC_SUBST([TARGET_CC])
+AC_SUBST([TARGET_LD])
 AC_SUBST([TARGET_CFLAGS])
 AC_SUBST([ASFLAGS])
 
diff --git a/kdump/Makefile b/kdump/Makefile
index 4a788f9..1e2b72c 100644
--- a/kdump/Makefile
+++ b/kdump/Makefile
@@ -15,6 +15,7 @@ clean += $(KDUMP_OBJS) $(KDUMP_DEPS) $(KDUMP) $(KDUMP_MANPAGE)
 
 -include $(KDUMP_DEPS)
 
+$(KDUMP): CC=$(TARGET_CC)
 $(KDUMP): $(KDUMP_OBJS)
 	@$(MKDIR) -p $(@D)
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $(KDUMP_OBJS)
diff --git a/kexec_test/Makefile b/kexec_test/Makefile
index 4848fc4..fec6210 100644
--- a/kexec_test/Makefile
+++ b/kexec_test/Makefile
@@ -26,6 +26,7 @@ clean += $(KEXEC_TEST_OBJS) $(KEXEC_TEST_DEPS) $(KEXEC_TEST)
 
 -include $(KEXEC_TEST_DEPS)
 
+$(KEXEC_TEST): CC=$(TARGET_CC)
 $(KEXEC_TEST): CPPFLAGS+=-DRELOC=$(RELOC)
 $(KEXEC_TEST): ASFLAGS+=-m32
 #$(KEXEC_TEST): LDFLAGS=-m32 -Wl,-e -Wl,_start -Wl,-Ttext -Wl,$(RELOC) \
@@ -34,7 +35,6 @@ $(KEXEC_TEST): LDFLAGS=-melf_i386 -e _start -Ttext $(RELOC)
 
 $(KEXEC_TEST): $(KEXEC_TEST_OBJS)
 	mkdir -p $(@D)
-	#$(LINK.o) -o $@ $^
-	$(LD) $(LDFLAGS) -o $@ $^
+	$(TARGET_LD) $(LDFLAGS) -o $@ $^
 
 endif
-- 
1.5.4.1




More information about the kexec mailing list