Updated Makefile for consistent build output paths and dynamic project references
Enhanced the Makefile to use a centralized `BUILD_DIR` variable for executable paths, increasing consistency across the build process. Adjusted the project reference generation to dynamically pair test files with their respective libraries, ensuring a more accurate and maintainable build configuration. This change streamlines the build workflow and mitigates potential errors due to path mismatches or hard-coded library links.
This commit is contained in:
17
Makefile
17
Makefile
@@ -12,7 +12,7 @@
|
|||||||
# Version
|
# Version
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
Makefile_Version := 1.1.1
|
Makefile_Version := 1.1.2
|
||||||
$(info ISE Makefile Version: $(Makefile_Version))
|
$(info ISE Makefile Version: $(Makefile_Version))
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
@@ -133,8 +133,7 @@ $(eval $(call process_sources,$(VTEST),V_TEST_LIBS,V_TEST_PATHS))
|
|||||||
# Get the test names..
|
# Get the test names..
|
||||||
TEST_PATHS = $(foreach file,$(V_TEST_PATHS) $(VHD_TEST_PATHS),$(basename $(file)))
|
TEST_PATHS = $(foreach file,$(V_TEST_PATHS) $(VHD_TEST_PATHS),$(basename $(file)))
|
||||||
TEST_NAMES = $(foreach path,$(TEST_PATHS),$(notdir $(path)))
|
TEST_NAMES = $(foreach path,$(TEST_PATHS),$(notdir $(path)))
|
||||||
TEST_EXES = $(foreach test,$(TEST_NAMES),build/isim_$(test)$(EXE))
|
TEST_EXES = $(foreach test,$(TEST_NAMES),$(BUILD_DIR)/isim_$(test)$(EXE))
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# Default build
|
# Default build
|
||||||
@@ -155,8 +154,8 @@ $(BUILD_DIR)/$(PROJECT).prj: ../project.cfg
|
|||||||
|
|
||||||
$(BUILD_DIR)/$(PROJECT)_sim.prj: $(BUILD_DIR)/$(PROJECT).prj
|
$(BUILD_DIR)/$(PROJECT)_sim.prj: $(BUILD_DIR)/$(PROJECT).prj
|
||||||
@cp $(BUILD_DIR)/$(PROJECT).prj $@
|
@cp $(BUILD_DIR)/$(PROJECT).prj $@
|
||||||
@$(foreach file,$(VTEST),echo "verilog work \"../../$(file)\"" >> $@;)
|
@$(foreach idx,$(shell seq 1 $(words $(V_TEST_PATHS))),echo "verilog $(word $(idx),$(V_TEST_LIBS)) \"../$(word $(idx),$(V_TEST_PATHS))\"" >> $@;)
|
||||||
@$(foreach file,$(VHDTEST),echo "vhdl work \"../../$(file)\"" >> $@;)
|
@$(foreach idx,$(shell seq 1 $(words $(VHD_TEST_PATHS))),echo "vhdl $(word $(idx),$(VHD_TEST_LIBS)) \"../$(word $(idx),$(VHD_TEST_PATHS))\"" >> $@;)
|
||||||
@echo "verilog work $(XILINX)/verilog/src/glbl.v" >> $@
|
@echo "verilog work $(XILINX)/verilog/src/glbl.v" >> $@
|
||||||
|
|
||||||
$(BUILD_DIR)/$(PROJECT).scr: ../project.cfg
|
$(BUILD_DIR)/$(PROJECT).scr: ../project.cfg
|
||||||
@@ -216,13 +215,13 @@ test: buildtest runtest
|
|||||||
runtest: ${TEST_NAMES}
|
runtest: ${TEST_NAMES}
|
||||||
|
|
||||||
${TEST_NAMES}:
|
${TEST_NAMES}:
|
||||||
@grep --no-filename --no-messages 'ISIM:' $@.{v,vhd} | cut -d: -f2 > build/isim_$@.cmd
|
@grep --no-filename --no-messages 'ISIM:' $@.{v,vhd} | cut -d: -f2 > $(BUILD_DIR)/isim_$@.cmd
|
||||||
@echo "$(ISIM_CMD)" >> build/isim_$@.cmd
|
@echo "$(ISIM_CMD)" >> $(BUILD_DIR)/isim_$@.cmd
|
||||||
cd build ; ./isim_$@$(EXE) $(ISIM_OPTS) -tclbatch isim_$@.cmd ;
|
cd $(BUILD_DIR) ; ./isim_$@$(EXE) $(ISIM_OPTS) -tclbatch isim_$@.cmd ;
|
||||||
|
|
||||||
buildtest: ${TEST_EXES}
|
buildtest: ${TEST_EXES}
|
||||||
|
|
||||||
$(BUILD_DIR)/isim_%$(EXE): build/$(PROJECT)_sim.prj $(VSOURCE) $(VHDSOURCE) ${V_TEST_PATHS} $(VHD_TEST_PATHS)
|
$(BUILD_DIR)/isim_%$(EXE): $(BUILD_DIR)/$(PROJECT)_sim.prj $(V_PATHS) $(VHD_PATHS) ${V_TEST_PATHS} $(VHD_TEST_PATHS)
|
||||||
$(call RUN,fuse) $(COMMON_OPTS) $(FUSE_OPTS) \
|
$(call RUN,fuse) $(COMMON_OPTS) $(FUSE_OPTS) \
|
||||||
-prj $(PROJECT)_sim.prj \
|
-prj $(PROJECT)_sim.prj \
|
||||||
-o isim_$*$(EXE) \
|
-o isim_$*$(EXE) \
|
||||||
|
Reference in New Issue
Block a user