From 99f1a3aed3ce9119110ab7db919b83625218bc15 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Fri, 12 Nov 2021 12:09:02 -0800 Subject: [PATCH 1/2] Separate the base SBT command from the --client addition This makes it easier to override just SBT_BIN and still use the ENABLE_SBT_THIN_CLIENT flag when using a downloaded SBT script --- common.mk | 2 +- variables.mk | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common.mk b/common.mk index ceddb765..157bb9a3 100644 --- a/common.mk +++ b/common.mk @@ -18,7 +18,7 @@ HELP_COMPILATION_VARIABLES += \ " EXTRA_SIM_LDFLAGS = additional LDFLAGS for building simulators" \ " EXTRA_SIM_SOURCES = additional simulation sources needed for simulator" \ " EXTRA_SIM_REQS = additional make requirements to build the simulator" \ -" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client (works best with sbtn or sbt script)" \ +" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client (works best when overridding SBT_BIN with sbt script)" \ " EXTRA_CHISEL_OPTIONS = additional options to pass to the Chisel compiler" \ " EXTRA_FIRRTL_OPTIONS = additional options to pass to the FIRRTL compiler" diff --git a/variables.mk b/variables.mk index 1279c28e..02b2c6be 100644 --- a/variables.mk +++ b/variables.mk @@ -175,7 +175,8 @@ override SCALA_BUILDTOOL_DEPS += $(SBT_THIN_CLIENT_TIMESTAMP) SBT_CLIENT_FLAG = --client endif -SBT ?= java $(JAVA_TOOL_OPTIONS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar $(SBT_OPTS) $(SBT_CLIENT_FLAG) +SBT_BIN ?= java $(JAVA_TOOL_OPTIONS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar $(SBT_OPTS) +SBT ?= $(SBT_BIN) $(SBT_CLIENT_FLAG) SBT_NON_THIN ?= $(subst $(SBT_CLIENT_FLAG),,$(SBT)) define run_scala_main From 32ffbd29df0045efb1d829732924d66003a8ad15 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 17 Nov 2021 00:38:01 -0800 Subject: [PATCH 2/2] Update make help | Small make cleanup --- common.mk | 20 +++++++++++--------- variables.mk | 17 ++++++++++++----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/common.mk b/common.mk index 157bb9a3..3b307317 100644 --- a/common.mk +++ b/common.mk @@ -18,7 +18,7 @@ HELP_COMPILATION_VARIABLES += \ " EXTRA_SIM_LDFLAGS = additional LDFLAGS for building simulators" \ " EXTRA_SIM_SOURCES = additional simulation sources needed for simulator" \ " EXTRA_SIM_REQS = additional make requirements to build the simulator" \ -" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client (works best when overridding SBT_BIN with sbt script)" \ +" ENABLE_SBT_THIN_CLIENT = if set, use sbt's experimental thin client (works best when overridding SBT_BIN with the mainline sbt script)" \ " EXTRA_CHISEL_OPTIONS = additional options to pass to the Chisel compiler" \ " EXTRA_FIRRTL_OPTIONS = additional options to pass to the FIRRTL compiler" @@ -41,13 +41,14 @@ NUMA_PREFIX = $(if $(filter $(NUMACTL),0),,$(shell $(base_dir)/scripts/numa_pref #---------------------------------------------------------------------------- HELP_COMMANDS += \ -" run-binary = run [./$(shell basename $(sim))] and log instructions to file" \ -" run-binary-fast = run [./$(shell basename $(sim))] and don't log instructions" \ -" run-binary-debug = run [./$(shell basename $(sim_debug))] and log instructions and waveform to files" \ -" verilog = generate intermediate verilog files from chisel elaboration and firrtl passes" \ -" firrtl = generate intermediate firrtl files from chisel elaboration" \ -" run-tests = run all assembly and benchmark tests" \ -" launch-sbt = start sbt terminal" +" run-binary = run [./$(shell basename $(sim))] and log instructions to file" \ +" run-binary-fast = run [./$(shell basename $(sim))] and don't log instructions" \ +" run-binary-debug = run [./$(shell basename $(sim_debug))] and log instructions and waveform to files" \ +" verilog = generate intermediate verilog files from chisel elaboration and firrtl passes" \ +" firrtl = generate intermediate firrtl files from chisel elaboration" \ +" run-tests = run all assembly and benchmark tests" \ +" launch-sbt = start sbt terminal" \ +" {shutdown,start}-sbt-server = shutdown or start sbt server if using ENABLE_SBT_THIN_CLIENT" \ ######################################################################################### # include additional subproject make fragments @@ -105,7 +106,7 @@ $(FIRRTL_FILE) $(ANNO_FILE): generator_temp @echo "" > /dev/null # AG: must re-elaborate if cva6 sources have changed... otherwise just run firrtl compile -generator_temp: $(SCALA_SOURCES) $(sim_files) $(EXTRA_GENERATOR_REQS) +generator_temp: $(SCALA_SOURCES) $(sim_files) $(SCALA_BUILDTOOL_DEPS) $(EXTRA_GENERATOR_REQS) mkdir -p $(build_dir) $(call run_scala_main,$(SBT_PROJECT),$(GENERATOR_PACKAGE).Generator,\ --target-dir $(build_dir) \ @@ -279,6 +280,7 @@ SBT_COMMAND ?= shell launch-sbt: cd $(base_dir) && $(SBT_NON_THIN) "$(SBT_COMMAND)" +.PHONY: check-thin-client check-thin-client: ifeq (,$(ENABLE_SBT_THIN_CLIENT)) $(error ENABLE_SBT_THIN_CLIENT not set.) diff --git a/variables.mk b/variables.mk index 02b2c6be..9ba9f4a3 100644 --- a/variables.mk +++ b/variables.mk @@ -3,7 +3,13 @@ # - to use the help text, your Makefile should have a 'help' target that just # prints all the HELP_LINES ######################################################################################### -HELP_COMPILATION_VARIABLES = +HELP_COMPILATION_VARIABLES = \ +" JAVA_HEAP_SIZE = if overridden, set the default java heap size (default is 8G)" \ +" JAVA_TOOL_OPTIONS = if overridden, set underlying java tool options (default sets misc. sizes and tmp dir)" \ +" SBT_OPTS = if overridden, set underlying sbt options (default uses options in .sbtopts)" \ +" SBT_BIN = if overridden, used to invoke sbt (default is to invoke sbt by sbt-launch.jar)" \ +" FIRRTL_LOGLEVEL = if overridden, set firrtl log level (default is error)" + HELP_PROJECT_VARIABLES = \ " SUB_PROJECT = use the specific subproject default variables [$(SUB_PROJECT)]" \ " SBT_PROJECT = the SBT project that you should find the classes/packages in [$(SBT_PROJECT)]" \ @@ -169,15 +175,16 @@ SCALA_BUILDTOOL_DEPS = $(SBT_SOURCES) SBT_THIN_CLIENT_TIMESTAMP = $(base_dir)/project/target/active.json ifdef ENABLE_SBT_THIN_CLIENT -override SCALA_BUILDTOOL_DEPS += $(SBT_THIN_CLIENT_TIMESTAMP) +SCALA_BUILDTOOL_DEPS += $(SBT_THIN_CLIENT_TIMESTAMP) # enabling speeds up sbt loading # use with sbt script or sbtn to bypass error code issues SBT_CLIENT_FLAG = --client endif -SBT_BIN ?= java $(JAVA_TOOL_OPTIONS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar $(SBT_OPTS) -SBT ?= $(SBT_BIN) $(SBT_CLIENT_FLAG) -SBT_NON_THIN ?= $(subst $(SBT_CLIENT_FLAG),,$(SBT)) +# passes $(JAVA_TOOL_OPTIONS) from env to java +SBT_BIN ?= java -jar $(ROCKETCHIP_DIR)/sbt-launch.jar $(SBT_OPTS) +SBT = $(SBT_BIN) $(SBT_CLIENT_FLAG) +SBT_NON_THIN = $(subst $(SBT_CLIENT_FLAG),,$(SBT)) define run_scala_main cd $(base_dir) && $(SBT) ";project $(1); runMain $(2) $(3)"