remove accidentally commited build products/objects
[rpi-open-firmware.git] / Makefile
1
2 TARGET_BOOTCODE = bootcode.bin
3
4 #
5 # when building bootcode.bin, always ensure start.s is at the top, providing
6 # the 0x200 byte long header and some init code.
7 #
8 SRCS = \
9 start.s \
10 romstage.c \
11 sdram.c \
12 arm_loader.c \
13 arm_monitor.cc \
14 trap.c \
15 lib/xprintf.c \
16 lib/panic.c \
17 lib/udelay.c \
18 lib/memcpy.c \
19 lib/cxx_runtime.c \
20 chainloader_inc.s
21
22 ARCH = vc4
23
24 BUILD_DIR = build
25 TARGET_BUILD_DIR = $(BUILD_DIR)/$(ARCH)-objects
26 PRODUCT_DIRECTORY = $(BUILD_DIR)
27
28 NO_COLOR=""
29 OK_COLOR=""
30 ERROR_COLOR=""
31 WARN_COLOR=""
32
33 .PHONY: default all clean create_build_directory device
34
35 default: $(TARGET_BOOTCODE)
36
37 OBJ := $(addprefix $(TARGET_BUILD_DIR)/, $(addsuffix .o, $(basename $(SRCS))))
38
39 # the cross compiler should already be in your path
40 CROSS_COMPILE = vc4-elf-
41 CC = $(CROSS_COMPILE)gcc
42 CXX = $(CROSS_COMPILE)g++
43 AS = $(CC)
44 OBJCOPY = $(CROSS_COMPILE)objcopy
45 LINKFLAGS = -nostdlib -nostartfiles -Wl,--build-id=none -T linker.lds
46
47 CFLAGS = -c -nostdlib -std=c11 -fsingle-precision-constant -Wdouble-promotion -D__VIDEOCORE4__ -I./vc4_include/ -I./
48 ASFLAGS = -c -nostdlib -x assembler-with-cpp -D__VIDEOCORE4__ -I./vc4_include/ -I./
49 CXXFLAGS = -c -nostdlib -std=c++11 -fno-exceptions -fno-rtti -D__VIDEOCORE4__ -I./vc4_include/ -I./
50
51 HEADERS := \
52 $(shell find . -type f -name '*.h') \
53 $(shell find . -type f -name '*.hpp')
54
55 create_build_directory:
56 @mkdir -p $(TARGET_BUILD_DIR)
57 @mkdir -p $(PRODUCT_DIRECTORY)
58
59 CREATE_SUBDIR = \
60 @DIR="$(dir $@)"; \
61 if [ ! -d $$DIR ]; then mkdir -p $$DIR; fi
62
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_BOOTCODE): create_build_directory $(OBJ)
85 @echo $(WARN_COLOR)LD $(NO_COLOR) $@.elf
86 @$(CC) $(LINKFLAGS) $(OBJ) -o $(PRODUCT_DIRECTORY)/$@.elf
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.07256 seconds and 4 git commands to generate.