[efi] Allow building with non-system libbfd
[people/lynusvaz/gpxe.git] / src / Makefile.housekeeping
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)