Commit 4a18bde1 authored by Alex Bennée's avatar Alex Bennée Committed by Radim Krčmář
Browse files

Makefiles: fix up the arm build dirs and include/link paths



We still need to tell the compiler the correct search path for finding
headers and the like. This is slightly complicated by the "dynamic"
asm search path which is in our build tree but (may be) symlinked to
the right architectures headers.

Also we explicitly include SRCDIR for the linking scripts as VPATH
doesn't seem to find them well enough.

Also we set OBJDIRS for the lib/arm, lib/arm64 and generated
asm-offset files.
Signed-off-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 241e1788
......@@ -11,6 +11,8 @@ cstart.o = $(TEST_DIR)/cstart64.o
cflatobjs += lib/arm64/processor.o
cflatobjs += lib/arm64/spinlock.o
OBJDIRS += lib/arm64
# arm64 specific tests
tests =
......
......@@ -17,7 +17,7 @@ tests-common += $(TEST_DIR)/gic.flat
tests-common += $(TEST_DIR)/psci.flat
tests-all = $(tests-common) $(tests)
all: $(tests-all)
all: directories $(tests-all)
##################################################################
phys_base = $(LOADADDR)
......@@ -26,13 +26,13 @@ CFLAGS += -std=gnu99
CFLAGS += -ffreestanding
CFLAGS += -Wextra
CFLAGS += -O2
CFLAGS += -I lib -I lib/libfdt
CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -I lib
# We want to keep intermediate files
.PRECIOUS: %.elf %.o
asm-offsets = lib/$(ARCH)/asm-offsets.h
include scripts/asm-offsets.mak
include $(SRCDIR)/scripts/asm-offsets.mak
cflatobjs += lib/util.o
cflatobjs += lib/alloc.o
......@@ -52,6 +52,8 @@ cflatobjs += lib/arm/smp.o
cflatobjs += lib/arm/delay.o
cflatobjs += lib/arm/gic.o lib/arm/gic-v2.o lib/arm/gic-v3.o
OBJDIRS += lib/arm
libeabi = lib/arm/libeabi.a
eabiobjs = lib/arm/eabi_compat.o
......@@ -60,11 +62,11 @@ start_addr := $(shell printf "%x\n" $$(( $(phys_base) + $(kernel_offset) )))
FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
%.elf: LDFLAGS = $(CFLAGS) -nostdlib
%.elf: %.o $(FLATLIBS) arm/flat.lds $(cstart.o)
%.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o)
$(CC) $(LDFLAGS) -o $@ \
-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
-Wl,-T,$(SRCDIR)/arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
$(filter %.o, $^) $(FLATLIBS) \
lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\"
$(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$(@:.elf=.flat)\"
%.flat: %.elf
$(OBJCOPY) -O binary $^ $@
......
......@@ -33,7 +33,9 @@ $(asm-offsets:.h=.s): $(asm-offsets:.h=.c)
$(asm-offsets): $(asm-offsets:.h=.s)
$(call make_asm_offsets)
cp -f $(asm-offsets) lib/generated
cp -f $(asm-offsets) lib/generated/
OBJDIRS += lib/generated
asm_offsets_clean:
$(RM) $(asm-offsets) $(asm-offsets:.h=.s) \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment