diff options
author | Humberto Jimenez <humberto.jimenez@ni.com> | 2021-11-03 14:16:45 -0500 |
---|---|---|
committer | Wade Fife <wade.fife@ettus.com> | 2021-12-01 10:51:07 -0600 |
commit | 37feec8992afaffbea19428a029093ae7f6453e3 (patch) | |
tree | 184e283881cb7cd0194d619f52fda00e1748fd9a /fpga/usrp3/tools/make/quartus_preamble.mak | |
parent | f24d6561a842baffbce9ddcdc9802b98f5fa2af0 (diff) | |
download | uhd-37feec8992afaffbea19428a029093ae7f6453e3.tar.gz uhd-37feec8992afaffbea19428a029093ae7f6453e3.tar.bz2 uhd-37feec8992afaffbea19428a029093ae7f6453e3.zip |
fpga: tools: Add Quartus build utilities
Diffstat (limited to 'fpga/usrp3/tools/make/quartus_preamble.mak')
-rw-r--r-- | fpga/usrp3/tools/make/quartus_preamble.mak | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/fpga/usrp3/tools/make/quartus_preamble.mak b/fpga/usrp3/tools/make/quartus_preamble.mak new file mode 100644 index 000000000..2fe20e555 --- /dev/null +++ b/fpga/usrp3/tools/make/quartus_preamble.mak @@ -0,0 +1,67 @@ +# +# Copyright 2021 Ettus Research, a National Instruments Brand +# +# SPDX-License-Identifier: LGPL-3.0-or-later +# + +# ------------------------------------------------------------------- +# Environment Setup +# ------------------------------------------------------------------- +ifeq ($(VIV_PLATFORM),Cygwin) +RESOLVE_PATH = $(if $(1),$(subst \,/,$(shell cygpath -aw $(1)))) +RESOLVE_PATHS = "$(if $(1),$(foreach path,$(1),$(subst \,/,$(shell cygpath -aw $(abspath $(path))))))" +else +RESOLVE_PATH = $(1) +RESOLVE_PATHS = "$(1)" +endif + +# ------------------------------------------------------------------- +# Project Setup +# ------------------------------------------------------------------- +# Requirement: BASE_DIR must be defined + +TOOLS_DIR = $(BASE_DIR)/../tools +LIB_DIR = $(BASE_DIR)/../lib + +O ?= . + +ifdef NAME +BUILD_DIR = $(abspath $(O)/build-$(NAME)) +else +BUILD_DIR = $(abspath $(O)/build) +endif + +IP_BUILD_DIR = $(abspath ./build-ip/$(subst /,,$(PART_ID))) + +# ------------------------------------------------------------------- +# Git Hash Retrieval +# ------------------------------------------------------------------- +GIT_HASH = $(shell $(TOOLS_DIR)/scripts/git-hash.sh) +GIT_HASH_VERILOG_DEF = "GIT_HASH=32'h$(GIT_HASH)" + +# ------------------------------------------------------------------- +# Toolchain dependency target +# ------------------------------------------------------------------- +.check_tool: + @echo "BUILDER: Checking tools..." + @echo -n "* "; bash --version | grep bash || (echo "ERROR: Bash not found in environment. Please install it"; exit 1;) + @echo -n "* "; python3 --version || (echo "ERROR: Python not found in environment. Please install it"; exit 1;) + @echo -n "* "; quartus_sh --version 2>&1 | grep Quartus || (echo "ERROR: Quartus not found in environment. Please run setupenv.sh"; exit 1;) + +# ------------------------------------------------------------------- +# Intermediate build dirs +# ------------------------------------------------------------------- +.build_dirs: + @mkdir -p $(BUILD_DIR) + @mkdir -p $(IP_BUILD_DIR) + +.prereqs: .check_tool .build_dirs + +.PHONY: .check_tool .build_dirs .prereqs + +# ------------------------------------------------------------------- +# Validate prerequisites +# ------------------------------------------------------------------- +ifndef PART_ID + $(error PART_ID was empty or not set) +endif |