-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (46 loc) · 1.52 KB
/
Makefile
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
.PHONY: image dev
USER=gem5
IMAGE=gem5-runahead:dev
CONTAINER_LABEL=gem5-devenv
MOUNT_HOST_DIR=${GEM5_DEV_DIR}
MOUNT_GUEST_DIR=/home/$(USER)/gem5-runahead
DEV_SHELL=/bin/bash
DOCKER_RUN_ARGS=-ia
DOCKER_RUN_CMD=start
DOCKER_CMD=
# reuse existing dev containers or create one if none exist
CONTAINER=$(shell docker ps -a -f label=$(CONTAINER_LABEL) --format "{{.ID}}")
ifeq ($(CONTAINER),)
DOCKER_RUN_CMD=run
DOCKER_RUN_ARGS=-it -v $(MOUNT_HOST_DIR):$(MOUNT_GUEST_DIR) -l $(CONTAINER_LABEL)
CONTAINER=$(IMAGE)
DOCKER_CMD=$(DEV_SHELL)
endif
# build the dev environment
image:
docker build -t $(IMAGE) .
# run the dev environment
dev:
docker $(DOCKER_RUN_CMD) $(DOCKER_RUN_ARGS) $(CONTAINER) $(DOCKER_CMD)
### for use inside a dev container ###
.PHONY: gem5 run
BUILD_THREADS=4
# ARM/NULL/MIPS/POWER/RISCV/SPARC/X86
# case sensitive
ISA=X86
# debug/opt/fast
BUILD_VARIANT=opt
GEM5_EXTRAS=$(HOME)/gem5-runahead/gem5-extensions/src
gem5:
cd gem5; scons EXTRAS=$(GEM5_EXTRAS) build/$(ISA)/gem5.$(BUILD_VARIANT) -j$(BUILD_THREADS)
gem5-opt:
cd gem5; scons EXTRAS=$(GEM5_EXTRAS) build/$(ISA)/gem5.opt -j$(BUILD_THREADS)
gem5-debug:
cd gem5; scons EXTRAS=$(GEM5_EXTRAS) build/$(ISA)/gem5.debug -j$(BUILD_THREADS)
gem5-fast:
cd gem5; scons EXTRAS=$(GEM5_EXTRAS) build/$(ISA)/gem5.fast -j$(BUILD_THREADS)
gem5-bare:
cd gem5; scons build/$(ISA)/gem5.$(BUILD_VARIANT) -j$(BUILD_THREADS)
# run with 'make run opts="--arg1 --arg2 --etc" script=gem5-extensions/configs/config.py
run:
./gem5/build/$(ISA)/gem5.$(BUILD_VARIANT) $(opts) $(script)