aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2013-02-23 08:23:47 +0000
committerJames Bottomley <JBottomley@Parallels.com>2013-02-23 08:23:47 +0000
commit61c0a4c78eeb00a8ab17e724194133e5e7c211de (patch)
tree3932ca03099044bd57fec0348a6380ccbbd3435d
parent45324fabe63290a78d6ba9815e64dc80b7933e18 (diff)
downloadefitools-61c0a4c78eeb00a8ab17e724194133e5e7c211de.tar.gz
Make.rules: add a finder for all the daft places gnu-efi installs on distros
-rw-r--r--Make.rules7
1 files changed, 5 insertions, 2 deletions
diff --git a/Make.rules b/Make.rules
index 000faa0..7fc3158 100644
--- a/Make.rules
+++ b/Make.rules
@@ -6,11 +6,14 @@ INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I
CPPFLAGS = -DCONFIG_$(ARCH)
CFLAGS = -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector
LDFLAGS = -nostdlib
-CRTOBJS = /usr/lib64/crt0-efi-$(ARCH).o
+CRTOBJ = crt0-efi-$(ARCH).o
+CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi
+CRTPATH = $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done)
+CRTOBJS = $(CRTPATH)/$(CRTOBJ)
# there's a bug in the gnu tools ... the .reloc section has to be
# aligned otherwise the file alignment gets screwed up
LDSCRIPT = $(TOPDIR)/elf_$(ARCH)_efi.lds
-LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic $(CRTOBJS) -L /usr/lib64
+LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH)
LOADLIBES = -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
FORMAT = efi-app-$(ARCH)
OBJCOPY = objcopy