-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (47 loc) · 1.93 KB
/
Makefile
File metadata and controls
54 lines (47 loc) · 1.93 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
.PHONY: init build rebuild check clean purge
# Detect linked worktree: .git is a file with gitdir pointing to .git/worktrees/
IS_LINKED_WORKTREE := $(shell [ -f .git ] && grep -q '/.git/worktrees/' .git && echo 1 || echo 0)
init:
ifeq ($(IS_LINKED_WORKTREE),1)
@# Derive main worktree root from .git file (same logic as CMakeLists.txt)
@GITDIR_RAW=$$(sed 's/gitdir: //' .git | tr -d '\n\r'); \
GITDIR=$$(cd "$$GITDIR_RAW" 2>/dev/null && pwd); \
MAIN_ROOT=$$(dirname "$$(dirname "$$(dirname "$$GITDIR")")"); \
echo "Linked worktree detected. Main worktree: $$MAIN_ROOT"; \
\
if [ ! -f "$$MAIN_ROOT/build/RISCV/gem5.opt" ]; then \
echo "ERROR: main worktree has not built gem5."; \
echo " Expected: $$MAIN_ROOT/build/RISCV/gem5.opt"; \
echo " Run gem5 build in $$MAIN_ROOT first."; \
exit 1; \
fi; \
\
mkdir -p build; \
if [ -d build/RISCV ] && [ ! -L build/RISCV ]; then \
echo " build/RISCV is a real directory (local gem5 build exists), keeping it."; \
else \
ln -sfn "$$MAIN_ROOT/build/RISCV" build/RISCV; \
echo " Symlinked build/RISCV -> $$MAIN_ROOT/build/RISCV"; \
fi
git submodule update --init --depth 1 --filter=blob:none externals/gem5
git submodule update --init --depth 1 --filter=blob:none externals/or-tools
else
git submodule update --init --depth 1 --filter=blob:none externals/llvm
git submodule update --init --depth 1 --filter=blob:none externals/circt
git submodule update --init --depth 1 --filter=blob:none externals/gem5
git submodule update --init --depth 1 --filter=blob:none externals/or-tools
endif
build:
cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release $(CMAKE_EXTRA_ARGS)
ninja -C build loom
rebuild:
cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release $(CMAKE_EXTRA_ARGS)
ninja -C build
check:
ninja -C build check-loom
clean:
ninja -C build -t clean 2>/dev/null || true
rm -rf out node_modules
rm -f package-lock.json package.json screenshot.mjs
purge:
rm -rf build .cache