Browse Source

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>
Nigel Croxon 10 years ago
parent
commit
ce7098fb52
5 changed files with 21 additions and 16 deletions
  1. 5 0
      Make.defaults
  2. 6 6
      Makefile
  3. 5 5
      gnuefi/Makefile
  4. 4 4
      inc/Makefile
  5. 1 1
      lib/Makefile

+ 5 - 0
Make.defaults

@@ -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
 #

+ 6 - 6
Makefile

@@ -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
 

+ 5 - 5
gnuefi/Makefile

@@ -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

+ 4 - 4
inc/Makefile

@@ -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

+ 1 - 1
lib/Makefile

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