aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2011-11-08 15:54:31 -0800
committerDarren Hart <dvhart@linux.intel.com>2011-11-10 20:52:04 -0800
commitca9b08518110583a49ae81019906b52b71bda1c9 (patch)
tree5592f0cc421caa042bafdb96c89bb9dfc98e2b3f
parent7dc8f7c2874b256f2532b111daca6b382f292bf9 (diff)
downloadefilinux-ca9b08518110583a49ae81019906b52b71bda1c9.tar.gz
Find crt0 and the LD script automatically
gnuefi doesn't install crt0 and the ld script to a gnuefi directory by default, but some distributions stick it there. Use find via a shell command to take the last matching file for each of CRT0 and LDSCRIPT. This avoids forcing the caller to duplicate the script generating the ARCH variable used throughout the Makefile. Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index dffc1c1..4c7e990 100644
--- a/Makefile
+++ b/Makefile
@@ -50,8 +50,9 @@ endif
INCDIR := /usr/include
-CRT0 := $(LIBDIR)/gnuefi/crt0-efi-$(ARCH).o
-LDSCRIPT := $(LIBDIR)/gnuefi/elf_$(ARCH)_efi.lds
+# gnuefi sometimes installs these under a gnuefi/ directory, and sometimes not
+CRT0 := $(shell find $(LIBDIR) -name crt0-efi-$(ARCH).o 2>/dev/null | tail -n1)
+LDSCRIPT := $(shell find $(LIBDIR) -name elf_$(ARCH)_efi.lds 2>/dev/null | tail -n1)
CFLAGS=-I. -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \
-DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \