Enable out-of-tree building

This patch enables building gnu-efi outside of the source tree.
That in turn enables building for multiple architectures in parallel.

The build directory is controlled by the OBJDIR make variable.  It
defaults to the value of ARCH, and can be overridden from the command
line.

This patch also cleans up some doubled slashes between INSTALLROOT
and PREFIX.

Signed-off-by: Jonathan Boeing <jonathan.n.boeing@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
This commit is contained in:
Nigel Croxon 2015-02-19 11:22:45 -05:00
parent f64cef2627
commit ce7098fb52
5 changed files with 21 additions and 16 deletions

View File

@ -75,6 +75,11 @@ ifeq ($(ARCH),amd64)
override ARCH := x86_64
endif
#
# Where to build the package
#
OBJDIR := $(TOPDIR)/$(ARCH)
#
# Variables below derived from variables above
#

View File

@ -75,21 +75,21 @@ mkvars:
@echo TOPDIR=$(TOPDIR)
$(SUBDIRS):
mkdir -p $@
$(MAKE) -C $@ -f $(SRCDIR)/$@/Makefile SRCDIR=$(SRCDIR)/$@ ARCH=$(ARCH)
mkdir -p $(OBJDIR)/$@
$(MAKE) -C $(OBJDIR)/$@ -f $(SRCDIR)/$@/Makefile SRCDIR=$(SRCDIR)/$@ ARCH=$(ARCH)
clean:
rm -f *~
@for d in $(SUBDIRS); do \
if [ -d $$d ]; then \
$(MAKE) -C $$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d clean; \
if [ -d $(OBJDIR)/$$d ]; then \
$(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d clean; \
fi; \
done
install:
@for d in $(SUBDIRS); do \
mkdir -p $$d; \
$(MAKE) -C $$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done
mkdir -p $(OBJDIR)/$$d; \
$(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done
.PHONY: $(SUBDIRS) clean depend

View File

@ -60,16 +60,16 @@ clean:
rm -f $(TARGETS) *~ *.o $(OBJS)
install:
mkdir -p $(INSTALLROOT)/$(LIBDIR)
$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)/$(LIBDIR)
mkdir -p $(INSTALLROOT)$(LIBDIR)
$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(LIBDIR)
ifneq (,$(findstring FreeBSD,$(OS)))
ifeq ($(ARCH),x86_64)
$(INSTALL) -m 644 elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)/$(LIBDIR)
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_fbsd_efi.lds $(INSTALLROOT)$(LIBDIR)
else
$(INSTALL) -m 644 elf_$(ARCH)_efi.lds $(INSTALLROOT)/$(LIBDIR)
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
endif
else
$(INSTALL) -m 644 elf_$(ARCH)_efi.lds $(INSTALLROOT)/$(LIBDIR)
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
endif
include $(SRCDIR)/../Make.rules

View File

@ -16,12 +16,12 @@ install:
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
$(INSTALL) -m 644 *.h $(INSTALLROOT)$(PREFIX)/include/efi
$(INSTALL) -m 644 protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol
$(INSTALL) -m 644 $(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
$(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(PREFIX)/include/efi
$(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol
$(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
ifeq ($(ARCH),ia64)
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
$(INSTALL) -m 644 protocol/ia64/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
$(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
endif
include $(SRCDIR)/../Make.rules

View File

@ -65,7 +65,7 @@ OBJS = $(FILES:%=%.o)
SUBDIRS = ia32 x86_64 ia64 runtime
LIBDIRINSTALL = $(INSTALLROOT)/$(LIBDIR)
LIBDIRINSTALL = $(INSTALLROOT)$(LIBDIR)
all: libsubdirs libefi.a