vc4: fix traps, add ic source detection and dispatch, add proper handler for mbox...
[rpi-open-firmware.git] / arm_chainloader / Makefile
1
2 TARGET_ARM_CHAINLOADER = arm_chainloader.bin
3
4 SRCS = \
5 start.s \
6 lib/arm_bcopy.s \
7 lib/arm_bzero.s \
8 lib/arm_locore.s \
9 drivers/uart.c \
10 drivers/cprman.cc \
11 drivers/fatfs/ff.c \
12 drivers/sdhost_impl.cc \
13 drivers/mbr_disk.cc \
14 drivers/mailbox.cc \
15 ../lib/xprintf.c \
16 ../lib/panic.c \
17 ../lib/udelay.c \
18 ../lib/tlsf/tlsf.c \
19 firmware_rendezvous.c \
20 minicxx.cc \
21 loader.cc \
22 main.c
23
24 ARCH = armv6zk
25
26 BUILD_DIR = build
27 TARGET_BUILD_DIR = $(BUILD_DIR)/$(ARCH)-objects
28 PRODUCT_DIRECTORY = $(BUILD_DIR)
29
30 NO_COLOR=""
31 OK_COLOR=""
32 ERROR_COLOR=""
33 WARN_COLOR=""
34
35 .PHONY: default all clean create_build_directory device
36
37 default: $(TARGET_ARM_CHAINLOADER)
38
39 OBJ := $(addprefix $(TARGET_BUILD_DIR)/, $(addsuffix .o, $(basename $(SRCS))))
40
41 CROSS_COMPILE = arm-none-eabi-
42 CC = $(CROSS_COMPILE)gcc
43 CXX = $(CROSS_COMPILE)gcc
44 AS = $(CC)
45 OBJCOPY = $(CROSS_COMPILE)objcopy
46 LINKFLAGS = -nostdlib -march=$(ARCH) -Wl,--build-id=none -T linker.lds
47 COMMON_FLAGS = -c -nostdlib -nostartfiles -ffreestanding -march=$(ARCH) -I../ -I./ -mfpu=vfp -mfloat-abi=hard -mtune=arm1176jzf-s
48 CFLAGS = $(COMMON_FLAGS) -std=c11
49 CXXFLAGS = $(COMMON_FLAGS) -std=c++11 -fno-exceptions -fno-rtti
50 ASFLAGS = $(COMMON_FLAGS) -x assembler-with-cpp
51
52 HEADERS := \
53 $(shell find . -type f -name '*.h') \
54 $(shell find . -type f -name '*.hpp')
55
56 create_build_directory:
57 @mkdir -p $(TARGET_BUILD_DIR)
58 @mkdir -p $(PRODUCT_DIRECTORY)
59
60 CREATE_SUBDIR = \
61 @DIR="$(dir $@)"; \
62 if [ ! -d $$DIR ]; then mkdir -p $$DIR; fi
63
64 #
65 # rules to build c/asm files.
66 #
67 $(TARGET_BUILD_DIR)/%.o: %.c $(HEADERS)
68 $(CREATE_SUBDIR)
69 @echo $(WARN_COLOR)CC $(NO_COLOR) $@
70 @$(CC) $(CFLAGS) $< -o $@
71
72 $(TARGET_BUILD_DIR)/%.o: %.cc $(HEADERS)
73 $(CREATE_SUBDIR)
74 @echo $(WARN_COLOR)CXX $(NO_COLOR) $@
75 @$(CXX) $(CXXFLAGS) $< -o $@
76
77 $(TARGET_BUILD_DIR)/%.o: %.s $(HEADERS)
78 $(CREATE_SUBDIR)
79 @echo $(WARN_COLOR)AS $(NO_COLOR) $@
80 @$(AS) $(ASFLAGS) $< -o $@
81
82 .PRECIOUS: $(OBJ)
83
84 $(TARGET_ARM_CHAINLOADER): create_build_directory $(OBJ)
85 @echo $(WARN_COLOR)LD $(NO_COLOR) $@.elf
86 @$(CC) $(LINKFLAGS) $(OBJ) -o $(PRODUCT_DIRECTORY)/$@.elf -lgcc
87 @echo $(WARN_COLOR)OBJ$(NO_COLOR) $@
88 @$(OBJCOPY) -O binary $(PRODUCT_DIRECTORY)/$@.elf $(PRODUCT_DIRECTORY)/$@
89
90 clean:
91 @echo $(ERROR_COLOR)CLEAN$(NO_COLOR)
92 @-rm -rf ./$(BUILD_DIR)
This page took 0.069656 seconds and 4 git commands to generate.