blob: 101251996f525854cdfea3621be439ad95e28553 [file] [log] [blame]
#
# arm common makefile
#
# Authors: Andrew Jones <drjones@redhat.com>
#
tests-common = $(TEST_DIR)/selftest.flat
tests-common += $(TEST_DIR)/spinlock-test.flat
tests-common += $(TEST_DIR)/pci-test.flat
tests-common += $(TEST_DIR)/pmu.flat
tests-common += $(TEST_DIR)/gic.flat
tests-common += $(TEST_DIR)/psci.flat
tests-common += $(TEST_DIR)/sieve.flat
tests-common += $(TEST_DIR)/pl031.flat
tests-all = $(tests-common) $(tests)
all: directories $(tests-all)
$(TEST_DIR)/sieve.elf: AUXFLAGS = 0x1
##################################################################
AUXFLAGS ?= 0x0
CFLAGS += -std=gnu99
CFLAGS += -ffreestanding
CFLAGS += -O2
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 $(SRCDIR)/scripts/asm-offsets.mak
cflatobjs += lib/util.o lib/getchar.o
cflatobjs += lib/alloc_phys.o
cflatobjs += lib/alloc_page.o
cflatobjs += lib/vmalloc.o
cflatobjs += lib/alloc.o
cflatobjs += lib/devicetree.o
cflatobjs += lib/pci.o
cflatobjs += lib/pci-host-generic.o
cflatobjs += lib/pci-testdev.o
cflatobjs += lib/virtio.o
cflatobjs += lib/virtio-mmio.o
cflatobjs += lib/chr-testdev.o
cflatobjs += lib/arm/io.o
cflatobjs += lib/arm/setup.o
cflatobjs += lib/arm/mmu.o
cflatobjs += lib/arm/bitops.o
cflatobjs += lib/arm/psci.o
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
libgcc := $(shell $(CC) $(machine) --print-libgcc-file-name)
FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
%.elf: LDFLAGS = -nostdlib $(arch_LDFLAGS)
%.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o)
$(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \
-DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
$(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/arm/flat.lds \
$(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o)
$(RM) $(@:.elf=.aux.o)
@chmod a-x $@
%.flat: %.elf
$(call arch_elf_check, $^)
$(OBJCOPY) -O binary $^ $@
@chmod a-x $@
$(libeabi): $(eabiobjs)
$(AR) rcs $@ $^
arm_clean: libfdt_clean asm_offsets_clean
$(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
$(TEST_DIR)/.*.d lib/arm/.*.d
generated-files = $(asm-offsets)
$(tests-all:.flat=.o) $(cstart.o) $(cflatobjs): $(generated-files)