2018-03-22 16:15:58 +00:00
|
|
|
####################################################################################
|
2021-09-13 20:50:01 +00:00
|
|
|
## Copyright (c) 2018 -2021 Analog Devices, Inc.
|
|
|
|
## SPDX short identifier: BSD-1-Clause
|
2018-03-22 16:15:58 +00:00
|
|
|
####################################################################################
|
|
|
|
|
|
|
|
# Assumes this file is in prpojects/scripts/project-xilinx.mk
|
|
|
|
HDL_PROJECT_PATH := $(subst scripts/project-xilinx.mk,,$(lastword $(MAKEFILE_LIST)))
|
|
|
|
HDL_LIBRARY_PATH := $(HDL_PROJECT_PATH)../library/
|
|
|
|
|
2018-03-25 07:21:37 +00:00
|
|
|
include $(HDL_PROJECT_PATH)../quiet.mk
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
# Parse the config file and convert it to environment variables
|
|
|
|
PARAMS_REPLACE_LIST := JESD LANE # list of words that should be removed from the parameter names
|
|
|
|
GEN_SED := '$(foreach name, $(PARAMS_REPLACE_LIST), s/$(name)//g;);s/_//g'
|
|
|
|
ifdef CFG
|
|
|
|
include $(CFG)
|
|
|
|
export $(shell sed 's/=.*//' $(CFG) | tr '\n' ' ')
|
|
|
|
PARAMS := $(shell cat $(CFG) | tr '\n' ' ')
|
|
|
|
DIR_NAME := $(basename $(notdir $(CFG)))
|
|
|
|
endif
|
|
|
|
|
2018-03-22 16:15:58 +00:00
|
|
|
VIVADO := vivado -mode batch -source
|
|
|
|
|
2022-09-23 09:28:22 +00:00
|
|
|
# Parse the variables passed to make and convert them to the filename format
|
|
|
|
CMD_VARIABLES := $(shell echo $(-*-command-variables-*-) | tac -s ' ')
|
|
|
|
ifneq ($(strip $(CMD_VARIABLES)), )
|
|
|
|
PARAMS := $(shell echo $(CMD_VARIABLES) | sed -e 's/[=]/_/g')
|
|
|
|
GEN_NAME := $(shell echo $(PARAMS) | sed -e $(GEN_SED) | sed -e 's/[ .]/_/g')
|
|
|
|
DIR_NAME := $(if $(strip $(DIR_NAME)),$(DIR_NAME)_$(GEN_NAME),$(GEN_NAME))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(DIR_NAME)), )
|
|
|
|
PROJECT_NAME := $(DIR_NAME)/$(PROJECT_NAME)
|
|
|
|
$(shell test -d $(DIR_NAME) || mkdir $(DIR_NAME))
|
|
|
|
ADI_PROJECT_DIR := $(DIR_NAME)/
|
|
|
|
export ADI_PROJECT_DIR
|
|
|
|
VIVADO := vivado -log $(DIR_NAME)/vivado.log -journal $(DIR_NAME)/vivado.jou -mode batch -source
|
|
|
|
endif
|
|
|
|
|
2018-03-22 16:15:58 +00:00
|
|
|
CLEAN_TARGET := *.cache
|
|
|
|
CLEAN_TARGET += *.data
|
|
|
|
CLEAN_TARGET += *.xpr
|
2022-09-23 09:28:22 +00:00
|
|
|
CLEAN_TARGET += xgui
|
2018-03-22 16:15:58 +00:00
|
|
|
CLEAN_TARGET += *.runs
|
|
|
|
CLEAN_TARGET += *.srcs
|
|
|
|
CLEAN_TARGET += *.sdk
|
|
|
|
CLEAN_TARGET += *.hw
|
|
|
|
CLEAN_TARGET += *.sim
|
|
|
|
CLEAN_TARGET += *.ip_user_files
|
2018-03-28 09:44:21 +00:00
|
|
|
CLEAN_TARGET += *.str
|
2019-09-25 07:49:51 +00:00
|
|
|
CLEAN_TARGET += mem_init_sys.txt
|
2019-10-04 11:40:12 +00:00
|
|
|
CLEAN_TARGET += *.csv
|
2020-12-16 15:41:19 +00:00
|
|
|
CLEAN_TARGET += *.hbs
|
2021-09-13 13:03:33 +00:00
|
|
|
CLEAN_TARGET += *.gen
|
2021-08-31 12:29:41 +00:00
|
|
|
CLEAN_TARGET += *.xpe
|
|
|
|
CLEAN_TARGET += *.xsa
|
2022-09-23 09:28:22 +00:00
|
|
|
CLEAN_TARGET += *.log
|
|
|
|
CLEAN_TARGET += *.jou
|
|
|
|
ifneq ($(strip $(DIR_NAME)), )
|
|
|
|
CLEAN_TARGET := $(addprefix $(DIR_NAME)/,$(CLEAN_TARGET))
|
|
|
|
endif
|
|
|
|
CLEAN_TARGET += .Xil
|
|
|
|
|
|
|
|
CLEAN_DIRS := $(dir $(wildcard */*_vivado.log))
|
2018-03-22 16:15:58 +00:00
|
|
|
|
|
|
|
# Common dependencies that all projects have
|
|
|
|
M_DEPS += system_project.tcl
|
|
|
|
M_DEPS += system_bd.tcl
|
|
|
|
M_DEPS += $(wildcard system_top*.v)
|
|
|
|
M_DEPS += $(wildcard system_constr.xdc) # Not all projects have this file
|
2018-08-14 08:43:32 +00:00
|
|
|
M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_project_xilinx.tcl
|
2022-07-12 11:06:15 +00:00
|
|
|
M_DEPS += $(HDL_PROJECT_PATH)../scripts/adi_env.tcl
|
2018-03-22 16:15:58 +00:00
|
|
|
M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_board.tcl
|
|
|
|
|
2018-03-26 08:57:03 +00:00
|
|
|
M_DEPS += $(foreach dep,$(LIB_DEPS),$(HDL_LIBRARY_PATH)$(dep)/component.xml)
|
2018-03-22 16:15:58 +00:00
|
|
|
|
2019-09-11 08:01:30 +00:00
|
|
|
.PHONY: all lib clean clean-all
|
2022-09-23 09:28:22 +00:00
|
|
|
|
2021-08-31 12:29:41 +00:00
|
|
|
all: lib $(PROJECT_NAME).sdk/system_top.xsa
|
2018-03-22 16:15:58 +00:00
|
|
|
|
|
|
|
clean:
|
2019-04-17 10:33:17 +00:00
|
|
|
-rm -f reference.dcp
|
2018-03-25 07:21:37 +00:00
|
|
|
$(call clean, \
|
|
|
|
$(CLEAN_TARGET), \
|
|
|
|
$(HL)$(PROJECT_NAME)$(NC) project)
|
2022-09-23 09:28:22 +00:00
|
|
|
-rm -Rf ${DIR_NAME}
|
2018-03-22 16:15:58 +00:00
|
|
|
|
|
|
|
clean-all: clean
|
|
|
|
@for lib in $(LIB_DEPS); do \
|
|
|
|
$(MAKE) -C $(HDL_LIBRARY_PATH)$${lib} clean; \
|
|
|
|
done
|
2022-09-23 09:28:22 +00:00
|
|
|
@for dir in ${CLEAN_DIRS}; do \
|
|
|
|
rm -Rf $${dir}; \
|
|
|
|
done
|
2018-03-22 16:15:58 +00:00
|
|
|
|
2019-04-17 10:33:17 +00:00
|
|
|
MODE ?= "default"
|
|
|
|
|
2021-08-31 12:29:41 +00:00
|
|
|
$(PROJECT_NAME).sdk/system_top.xsa: $(M_DEPS)
|
2019-04-17 10:33:17 +00:00
|
|
|
@if [ $(MODE) = incr ]; then \
|
|
|
|
if [ -f */impl_1/system_top_routed.dcp ]; then \
|
|
|
|
echo Found previous run result at `ls */impl_1/system_top_routed.dcp`; \
|
|
|
|
cp -u */impl_1/system_top_routed.dcp ./reference.dcp ; \
|
|
|
|
fi; \
|
|
|
|
if [ -f ./reference.dcp ]; then \
|
|
|
|
echo Using reference checkpoint for incremental compilation; \
|
|
|
|
fi; \
|
2019-04-22 15:15:44 +00:00
|
|
|
else \
|
|
|
|
rm -f reference.dcp; \
|
|
|
|
fi;
|
2018-03-22 16:15:58 +00:00
|
|
|
-rm -rf $(CLEAN_TARGET)
|
2018-03-25 07:21:37 +00:00
|
|
|
$(call build, \
|
|
|
|
$(VIVADO) system_project.tcl, \
|
|
|
|
$(PROJECT_NAME)_vivado.log, \
|
|
|
|
$(HL)$(PROJECT_NAME)$(NC) project)
|
2018-03-22 16:15:58 +00:00
|
|
|
|
|
|
|
lib:
|
|
|
|
@for lib in $(LIB_DEPS); do \
|
2021-10-05 13:40:39 +00:00
|
|
|
if [ -n "${REQUIRED_VIVADO_VERSION}" ]; then \
|
|
|
|
$(MAKE) -C $(HDL_LIBRARY_PATH)$${lib} xilinx REQUIRED_VIVADO_VERSION=${REQUIRED_VIVADO_VERSION} || exit $$?; \
|
|
|
|
else \
|
|
|
|
$(MAKE) -C $(HDL_LIBRARY_PATH)$${lib} xilinx || exit $$?; \
|
|
|
|
fi; \
|
2018-03-22 16:15:58 +00:00
|
|
|
done
|
2021-10-05 13:40:39 +00:00
|
|
|
|