[efi] Allow building with non-system libbfd
authorMichael Brown <mcb30@etherboot.org>
Tue, 31 Mar 2009 08:36:08 +0000 (09:36 +0100)
committerMichael Brown <mcb30@etherboot.org>
Tue, 31 Mar 2009 08:36:08 +0000 (09:36 +0100)
On Mac OS X, it is necessary to build binutils manually; the system
does not provide bfd.h or the libbfd or libiberty libraries.

Originally-fixed-by: Joshua Oreman <oremanj@rwcr.net>
src/Makefile
src/Makefile.housekeeping

index 1693b4a..099762c 100644 (file)
@@ -42,6 +42,8 @@ ELF2EFI64     := ./util/elf2efi64
 EFIROM         := ./util/efirom
 ICCFIX         := ./util/iccfix
 DOXYGEN                := doxygen
+BINUTILS_DIR   := /usr
+BFD_DIR                := $(BINUTILS_DIR)
 
 ###############################################################################
 #
index be36b36..4f0a8bb 100644 (file)
@@ -793,16 +793,18 @@ CLEANUP += $(ZBIN)
 #
 # The EFI image converter
 #
+ELF2EFI_CFLAGS := -I$(BINUTILS_DIR)/include -I$(BFD_DIR)/include \
+                  -idirafter include -L$(BINUTILS_DIR)/lib -L$(BFD_DIR)/lib \
+                  -lbfd -liberty -lz
+
 $(ELF2EFI32) : util/elf2efi.c $(MAKEDEPS)
        $(QM)$(ECHO) "  [HOSTCC] $@"
-       $(Q)$(HOST_CC) -DMDE_CPU_IA32 -idirafter include -O2 \
-               -o $@ $< -lbfd -liberty
+       $(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_IA32 -O2 -o $@ $<
 CLEANUP += $(ELF2EFI32)
 
 $(ELF2EFI64) : util/elf2efi.c $(MAKEDEPS)
        $(QM)$(ECHO) "  [HOSTCC] $@"
-       $(Q)$(HOST_CC) -DMDE_CPU_X64 -idirafter include -O2 \
-               -o $@ $< -lbfd -liberty
+       $(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_X64 -O2 -o $@ $<
 CLEANUP += $(ELF2EFI64)
 
 $(EFIROM) : util/efirom.c $(MAKEDEPS)