diff --git a/common.mk b/common.mk index 43340615..820b6d44 100644 --- a/common.mk +++ b/common.mk @@ -102,7 +102,6 @@ $(BOOTROM_TARGETS): $(build_dir)/bootrom.%.img: $(TESTCHIP_RSRCS_DIR)/testchipip ######################################################################################### # AG: must re-elaborate if cva6 sources have changed... otherwise just run firrtl compile $(FIRRTL_FILE) $(ANNO_FILE) &: $(SCALA_SOURCES) $(sim_files) $(SCALA_BUILDTOOL_DEPS) $(EXTRA_GENERATOR_REQS) - if [ -d $(OUT_DIR) ]; then rm -rf $(OUT_DIR); fi mkdir -p $(build_dir) $(call run_scala_main,$(SBT_PROJECT),$(GENERATOR_PACKAGE).Generator,\ --target-dir $(build_dir) \ diff --git a/fpga/Makefile b/fpga/Makefile index d037833b..4ae4bb0f 100644 --- a/fpga/Makefile +++ b/fpga/Makefile @@ -94,10 +94,11 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/vsrc/EICG_wrapper.v # copy files but ignore *.h files in *.f (match vcs) -$(sim_files): $(SIM_FILE_REQS) | $(OUT_DIR) - cp -f $^ $(OUT_DIR) +$(sim_files): $(SIM_FILE_REQS) $(OUT_DIR) + rm -rf $(OUT_DIR)/* + cp -f $(SIM_FILE_REQS) $(OUT_DIR) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ ,\ echo "$(addprefix $(OUT_DIR)/, $(notdir $(file)))" >> $@;)) diff --git a/sims/vcs/Makefile b/sims/vcs/Makefile index d407fe4f..3e78643d 100644 --- a/sims/vcs/Makefile +++ b/sims/vcs/Makefile @@ -38,10 +38,11 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/vsrc/TestDriver.v # copy files but ignore *.h files in *.f since vcs has +incdir+$(build_dir) -$(sim_files): $(SIM_FILE_REQS) | $(OUT_DIR) - cp -f $^ $(OUT_DIR) +$(sim_files): $(SIM_FILE_REQS) $(OUT_DIR) + rm -rf $(OUT_DIR)/* + cp -f $(SIM_FILE_REQS) $(OUT_DIR) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ ,\ echo "$(addprefix $(OUT_DIR)/, $(notdir $(file)))" >> $@;)) diff --git a/sims/verilator/Makefile b/sims/verilator/Makefile index 5c15973a..269915a9 100644 --- a/sims/verilator/Makefile +++ b/sims/verilator/Makefile @@ -66,10 +66,11 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/csrc/remote_bitbang.cc # copy files and add -FI for *.h files in *.f -$(sim_files): $(SIM_FILE_REQS) | $(OUT_DIR) - cp -f $^ $(OUT_DIR) +$(sim_files): $(SIM_FILE_REQS) $(OUT_DIR) + rm -rf $(OUT_DIR)/* + cp -f $(SIM_FILE_REQS) $(OUT_DIR) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ echo "-FI $(addprefix $(OUT_DIR)/, $(notdir $(file)))" >> $@;,\ echo "$(addprefix $(OUT_DIR)/, $(notdir $(file)))" >> $@;)) diff --git a/vlsi/Makefile b/vlsi/Makefile index 228401b2..e699a476 100644 --- a/vlsi/Makefile +++ b/vlsi/Makefile @@ -108,10 +108,11 @@ SIM_FILE_REQS += \ $(ROCKETCHIP_RSRCS_DIR)/vsrc/TestDriver.v # copy files but ignore *.h files in *.f since vcs has +incdir+$(build_dir) -$(sim_files): $(SIM_FILE_REQS) | $(build_dir) - cp -f $^ $(build_dir) +$(sim_files): $(SIM_FILE_REQS) $(build_dir) + rm -rf $(build_dir)/* + cp -f $(SIM_FILE_REQS) $(build_dir) $(foreach file,\ - $^,\ + $(SIM_FILE_REQS),\ $(if $(filter %.h,$(file)),\ ,\ echo "$(addprefix $(build_dir)/, $(notdir $(file)))" >> $@;))