
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 23:56:24 up 4 days, 12:04, 3 users, load average: 0.75, 0.91, 0.64
55 lines
1.9 KiB
Makefile
55 lines
1.9 KiB
Makefile
#***************************************************************************************
|
|
# Copyright (c) 2014-2022 Zihao Yu, Nanjing University
|
|
#
|
|
# NEMU is licensed under Mulan PSL v2.
|
|
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
# You may obtain a copy of Mulan PSL v2 at:
|
|
# http://license.coscl.org.cn/MulanPSL2
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
#
|
|
# See the Mulan PSL v2 for more details.
|
|
#**************************************************************************************/
|
|
|
|
REPO_PATH = repo
|
|
ifeq ($(wildcard repo/spike_main),)
|
|
$(shell git clone --depth=1 https://www.github.com/NJU-ProjectN/riscv-isa-sim $(REPO_PATH))
|
|
endif
|
|
|
|
REPO_BUILD_PATH = $(REPO_PATH)/build
|
|
REPO_MAKEFILE = $(REPO_BUILD_PATH)/Makefile
|
|
$(REPO_MAKEFILE):
|
|
@mkdir -p $(@D)
|
|
cd $(@D) && $(abspath $(REPO_PATH))/configure
|
|
sed -i -e 's/-g -O2/-O2/' $@
|
|
|
|
SPIKE = $(REPO_BUILD_PATH)/spike
|
|
$(SPIKE): $(REPO_MAKEFILE)
|
|
CFLAGS="-fvisibility=hidden" CXXFLAGS="-fvisibility=hidden" $(MAKE) -C $(^D)
|
|
|
|
BUILD_DIR = ./build
|
|
$(shell mkdir -p $(BUILD_DIR))
|
|
|
|
inc_dependencies = fesvr riscv disasm customext fdt softfloat spike_main spike_dasm build
|
|
INC_PATH = -I$(REPO_PATH) $(addprefix -I$(REPO_PATH)/, $(inc_dependencies))
|
|
INC_PATH += -I$(NEMU_HOME)/include
|
|
lib_dependencies = libspike_main.a libriscv.a libdisasm.a libsoftfloat.a libfesvr.a libfdt.a
|
|
INC_LIBS = $(addprefix $(REPO_PATH)/build/, $(lib_dependencies))
|
|
|
|
NAME = $(GUEST_ISA)-spike-so
|
|
BINARY = $(BUILD_DIR)/$(NAME)
|
|
SRCS = difftest.cc
|
|
|
|
$(BINARY): $(SPIKE) $(SRCS)
|
|
g++ -std=c++17 -O2 -shared -fPIC -fvisibility=hidden $(INC_PATH) $(SRCS) $(INC_LIBS) -o $@
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
all: $(BINARY)
|
|
.DEFAULT_GOAL = all
|
|
|
|
.PHONY: all clean $(SPIKE)
|