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