diff --git a/tools/make/diamond_preamble.mak b/tools/make/diamond_preamble.mak index 86aaf2f..24b0fe2 100644 --- a/tools/make/diamond_preamble.mak +++ b/tools/make/diamond_preamble.mak @@ -23,12 +23,12 @@ endif TOOLS_DIR = $(BASE_DIR)/../tools LIB_DIR = $(BASE_DIR)/../lib -O ?= . +BUILD_BASE_DIR ?= . ifdef NAME -BUILD_DIR = $(abspath $(O)/build-$(NAME)) +BUILD_DIR = $(abspath $(BUILD_BASE_DIR)/build-$(NAME)) else -BUILD_DIR = $(abspath $(O)/build) +BUILD_DIR = $(abspath $(BUILD_BASE_DIR)/build) endif IP_BUILD_DIR = $(abspath ./build-ip/$(subst /,,$(PART_ID))) diff --git a/tools/make/quartus_preamble.mak b/tools/make/quartus_preamble.mak index 2fe20e5..d577227 100644 --- a/tools/make/quartus_preamble.mak +++ b/tools/make/quartus_preamble.mak @@ -23,12 +23,12 @@ endif TOOLS_DIR = $(BASE_DIR)/../tools LIB_DIR = $(BASE_DIR)/../lib -O ?= . +BUILD_BASE_DIR ?= . ifdef NAME -BUILD_DIR = $(abspath $(O)/build-$(NAME)) +BUILD_DIR = $(abspath $(BUILD_BASE_DIR)/build-$(NAME)) else -BUILD_DIR = $(abspath $(O)/build) +BUILD_DIR = $(abspath $(BUILD_BASE_DIR)/build) endif IP_BUILD_DIR = $(abspath ./build-ip/$(subst /,,$(PART_ID))) diff --git a/tools/make/viv_preamble.mak b/tools/make/viv_preamble.mak index ab9e017..df0f271 100644 --- a/tools/make/viv_preamble.mak +++ b/tools/make/viv_preamble.mak @@ -24,12 +24,12 @@ SIMLIB_DIR = $(abspath $(BASE_DIR)/../sim) LIB_IP_DIR = $(abspath $(LIB_DIR)/ip) HLS_IP_DIR = $(abspath $(LIB_DIR)/hls) -O ?= . +BUILD_BASE_DIR ?= . ifdef NAME -BUILD_DIR = $(abspath $(O)/build-$(NAME)) +BUILD_DIR = $(abspath $(BUILD_BASE_DIR)/build-$(NAME)) else -BUILD_DIR = $(abspath $(O)/build) +BUILD_DIR = $(abspath $(BUILD_BASE_DIR)/build) endif IP_BUILD_DIR = $(abspath ./build-ip/$(subst /,,$(PART_ID))) diff --git a/top/e31x/Makefile b/top/e31x/Makefile index 45b8dae..8c0e32b 100644 --- a/top/e31x/Makefile +++ b/top/e31x/Makefile @@ -14,6 +14,9 @@ ## build/usrp__fpga_.dts: Device tree source file ## build/usrp__fpga_.rpt: Build report (includes utilization and timing summary) +# Base output directory for all builds +BUILD_BASE_DIR ?= . + # Initialize a build seed. This can be changed to randomly affect build results. BUILD_SEED ?= 0 DEFS += BUILD_SEED=$(BUILD_SEED) @@ -42,9 +45,9 @@ ifeq ($(TARGET),bin) post_build = @\ mkdir -p build; \ echo "Exporting bitstream file..."; \ - cp build-$(1)/e31x.bit build/usrp_`echo $(2) | tr A-Z a-z`_fpga.bit; \ + cp $(BUILD_BASE_DIR)/build-$(1)/e31x.bit build/usrp_`echo $(2) | tr A-Z a-z`_fpga.bit; \ echo "Exporting build report..."; \ - cp build-$(1)/build.rpt build/usrp_`echo $(2) | tr A-Z a-z`_fpga.rpt; \ + cp $(BUILD_BASE_DIR)/build-$(1)/build.rpt build/usrp_`echo $(2) | tr A-Z a-z`_fpga.rpt; \ echo "Build DONE ... $(1)"; else post_build = @echo "Skipping bitfile export." diff --git a/top/e320/Makefile b/top/e320/Makefile index ec555a4..e2e6e8a 100644 --- a/top/e320/Makefile +++ b/top/e320/Makefile @@ -14,6 +14,9 @@ ## build/usrp__fpga_.dts: Device tree source file ## build/usrp__fpga_.rpt: Build report (includes utilization and timing summary) +# Base output directory for all builds +BUILD_BASE_DIR ?= . + # Initialize a build seed. This can be changed to randomly affect build results. BUILD_SEED ?= 0 @@ -45,9 +48,9 @@ ifeq ($(TARGET),bin) post_build = @\ mkdir -p build; \ echo "Exporting bitstream file..."; \ - cp build-$(1)_$(2)/e320.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/e320.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ echo "Exporting build report..."; \ - cp build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ echo "Build DONE ... $(1)_$(2)"; else post_build = @echo "Skipping bitfile export." diff --git a/top/n3xx/Makefile b/top/n3xx/Makefile index 1041545..5abafb3 100644 --- a/top/n3xx/Makefile +++ b/top/n3xx/Makefile @@ -23,6 +23,9 @@ # Uncomment this line to add four example Aurora loopback lanes on the QSFP NPIO bus. # OPTIONS += QSFP_LANES=4 +# Base output directory for all builds +BUILD_BASE_DIR ?= . + # Initialize a build seed. This can be changed to randomly affect build results. BUILD_SEED ?= 0 @@ -68,9 +71,9 @@ ifeq ($(TARGET),bin) post_build = @\ mkdir -p build; \ echo "Exporting bitstream file..."; \ - cp build-$(1)_$(2)/n3xx.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/n3xx.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ echo "Exporting build report..."; \ - cp build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ echo "Build DONE ... $(1)_$(2)"; else post_build = @echo "Skipping bitfile export." diff --git a/top/x300/Makefile b/top/x300/Makefile index 10f347e..313dc7e 100644 --- a/top/x300/Makefile +++ b/top/x300/Makefile @@ -21,6 +21,9 @@ CREATE_LVBITX=python ../../lib/io_port2/create-lvbitx.py +# Base output directory for all builds +BUILD_BASE_DIR ?= . + # Initialize a build seed. This can be changed to randomly affect build results. BUILD_SEED ?= 0 @@ -56,13 +59,13 @@ ifeq ($(TARGET),bin) post_build = @\ mkdir -p build; \ echo "Exporting bitstream files..."; \ - cp build-$(1)_$(2)/x300.bin build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bin; \ - cp build-$(1)_$(2)/x300.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/x300.bin build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bin; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/x300.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ echo "Generating LVBITX..."; \ - $(CREATE_LVBITX) --input-bin=build-$(1)_$(2)/x300.bin --output-lvbitx=build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).lvbitx --device="USRP $(1)" x3x0_base.lvbitx; \ + $(CREATE_LVBITX) --input-bin=$(BUILD_BASE_DIR)/build-$(1)_$(2)/x300.bin --output-lvbitx=build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).lvbitx --device="USRP $(1)" x3x0_base.lvbitx; \ cp -f x3x0_base.lvbitx build/`echo $(1) | tr A-Z a-z`.lvbitx_base; \ echo "Exporting build report..."; \ - cp build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ echo "Build DONE ... $(1)_$(2)"; else post_build = @echo "Skipping bitfile export." diff --git a/top/x400/Makefile b/top/x400/Makefile index 6b3a078..9d458e7 100644 --- a/top/x400/Makefile +++ b/top/x400/Makefile @@ -16,7 +16,8 @@ ## build/usrp__fpga_.dts: Device tree source file ## build/usrp__fpga_.rpt: Build report (includes utilization and timing summary) - +# Base output directory for all builds +BUILD_BASE_DIR ?= . # Definitions # MGT Types from x4xx_mgt_type.vh @@ -97,9 +98,9 @@ ifeq ($(TARGET),bin) post_build = @\ mkdir -p build; \ echo "Exporting bitstream file..."; \ - cp build-$(1)_$(2)/x4xx.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/x4xx.bit build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).bit; \ echo "Exporting build report..."; \ - cp build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ + cp $(BUILD_BASE_DIR)/build-$(1)_$(2)/build.rpt build/usrp_`echo $(1) | tr A-Z a-z`_fpga_$(2).rpt; \ echo "Build DONE ... $(1)_$(2)"; else post_build = @echo "Skipping bitfile export."