-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (52 loc) · 1.72 KB
/
Makefile
File metadata and controls
61 lines (52 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# SyterKit Build System
# SPDX-License-Identifier: GPL-2.0+
# Set the default target
.DEFAULT_GOAL := all
# Set the RISCV compiler path
RISCV_ROOT_PATH ?= /home/yuzuki/sdk/Xuantie-900-gcc-elf-newlib-x86_64-V3.2.0/bin/
# Build DIR
BUILD_DIR_OUT := build
# Get list of board targets (without .cmake extension) and define build directories
BOARD_TARGETS:=$(shell find ./cmake/board/ -name "*.cmake" -type f -exec basename -s .cmake {} \;)
BUILD_DIRS:=$(addprefix $(BUILD_DIR_OUT)/,$(BOARD_TARGETS))
# Rule to build all targets
all: $(BUILD_DIRS)
# Rule to build each board configuration
$(BUILD_DIRS): $(BUILD_DIR_OUT)/%: cmake/board/%.cmake
@echo "Building for board: $*"
@echo "Build directory: $@"
@echo "RISCV_ROOT_PATH: $(RISCV_ROOT_PATH)"
@echo "CMAKE_BOARD_FILE: $*.cmake"
@echo "CMAKE_BOARD_FILE_PATH: $(CMAKE_BOARD_FILE_PATH)"
@echo "clean build directory..."
@if [ -d $(BUILD_DIR_OUT) ]; then \
if [ -d $@ ]; then \
rm -rf $@; \
fi; \
fi
@echo "create build directory..."
@mkdir -p $@
@echo "run cmake..."
@cd $@ && \
export RISCV_ROOT_PATH=$(RISCV_ROOT_PATH) && \
cmake -B . -DCMAKE_BUILD_TYPE=Release -DCMAKE_BOARD_FILE=$*.cmake ../.. && \
cmake --build . --config Release -j
# Clean all build directories
clean:
@echo "Cleaning all build directories..."
@rm -rf $(BUILD_DIRS)
# Help target
help:
@echo "SyterKit Build System"
@echo "Usage: make [TARGET]"
@echo ""
@echo "Targets:"
@echo " all - Build all board configurations (default)"
@echo " clean - Remove all build directories"
@echo " help - Show this help message"
@echo ""
@echo "Board configurations:"
@for target in $(BOARD_TARGETS); do \
echo " $(BUILD_DIR_OUT)/$$target - Build for $$target"; \
done
.PHONY: all clean help