diff options
author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2018-04-23 17:32:06 +0100 |
---|---|---|
committer | Mark Rutland <mark.rutland@arm.com> | 2018-04-26 13:54:29 +0100 |
commit | c7904c2dee7af838ec08131ecdfe74d4e43a49f9 (patch) | |
tree | b44816279bd98a1ef45dc13aa9de6c2343b158c2 | |
parent | 7c2bc5495e556c9039f0d3e79d8d5af4ad35baf4 (diff) | |
download | boot-wrapper-aarch64-c7904c2dee7af838ec08131ecdfe74d4e43a49f9.tar.gz |
Fix out-of-tree build
Adding AArch32 support to the boot-wrapper changed the source layout and
broke out-of-tree build. This patch allows to put all generated files
into a separate directory again, and build multiple images in parallel:
mkdir build/ && cd build/
~/src/boot-wrapper-aarch64/configure ...
make
Make attempts to output object files into build/arch/aarchXX/, but fails
because that folder doesn't exist in the build directory. Add mkdir as
prerequisite for any *.o target in the arch folder.
So that Make doesn't confuse the destination folder with the source,
override VPATH to only affect .S and .c sources.
And set $(ARCH_SRC) as order-only-prerequisite (after a '|'). Otherwise
Make would rebuild all objects whenever the timestamp of $(ARCH_SRC)
changes, which is every time an object is rebuilt...
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r-- | Makefile.am | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 6940a99..af694b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -118,7 +118,7 @@ CHOSEN_NODE := chosen { \ }; CPPFLAGS += $(INITRD_FLAGS) -CFLAGS += -Iinclude/ -I$(ARCH_SRC)/include/ +CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ CFLAGS += -Wall -fomit-frame-pointer CFLAGS += -ffunction-sections -fdata-sections LDFLAGS += --gc-sections @@ -126,6 +126,12 @@ LDFLAGS += --gc-sections OFILES += boot_common.o bakery_lock.o platform.o $(GIC) cache.o lib.o OFILES += $(addprefix $(ARCH_SRC),boot.o stack.o $(BOOTMETHOD) utils.o) +# Don't lookup all prerequisites in $(top_srcdir), only the source files. When +# building outside the source tree $(ARCH_SRC) needs to be created. +VPATH = +vpath %.c $(top_srcdir) +vpath %.S $(top_srcdir) + all: $(IMAGE) CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dtb @@ -133,7 +139,10 @@ CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dt $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE) $(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds -%.o: %.S Makefile +$(ARCH_SRC): + $(MKDIR_P) $@ + +%.o: %.S Makefile | $(ARCH_SRC) $(CC) $(CPPFLAGS) -D__ASSEMBLY__ $(CFLAGS) $(DEFINES) -c -o $@ $< %.o: %.c Makefile |