Skip to content

Commit

Permalink
Add common project Makefile for Xilinx projects
Browse files Browse the repository at this point in the history
The project Makefiles for the Xilinx projects share most of their code. The
only difference is the list of project dependencies.

Create a file that has the common parts and can be included by the project
Makefiles.

This drastically reduces the size of the project Makefiles and also allows
to change the Makefile implementation without having to re-generate all
Makefiles.

Signed-off-by: Lars-Peter Clausen <[email protected]>
  • Loading branch information
larsclausen authored and Csomi committed Apr 11, 2018
1 parent ec6128d commit 5272ed4
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions projects/scripts/project-xilinx.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
####################################################################################
## Copyright 2018(c) Analog Devices, Inc.
####################################################################################

# 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/

VIVADO := vivado -mode batch -source

CLEAN_TARGET := *.cache
CLEAN_TARGET += *.data
CLEAN_TARGET += *.xpr
CLEAN_TARGET += *.log
CLEAN_TARGET += *.jou
CLEAN_TARGET += xgui
CLEAN_TARGET += *.runs
CLEAN_TARGET += *.srcs
CLEAN_TARGET += *.sdk
CLEAN_TARGET += *.hw
CLEAN_TARGET += *.sim
CLEAN_TARGET += .Xil
CLEAN_TARGET += *.ip_user_files

# 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
M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_project.tcl
M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_env.tcl
M_DEPS += $(HDL_PROJECT_PATH)scripts/adi_board.tcl

M_DEPS += $(foreach dep,$(LIB_DEPS),$(HDL_LIBRARY_PATH)$(dep)/$(notdir $(dep)).xpr)

.PHONY: all lib clean clean-all
all: lib $(PROJECT_NAME).sdk/system_top.hdf

clean:
rm -rf $(CLEAN_TARGET)

clean-all: clean
@for lib in $(LIB_DEPS); do \
$(MAKE) -C $(HDL_LIBRARY_PATH)$${lib} clean; \
done

$(PROJECT_NAME).sdk/system_top.hdf: $(M_DEPS)
-rm -rf $(CLEAN_TARGET)
$(VIVADO) system_project.tcl >> $(PROJECT_NAME)_vivado.log 2>&1

lib:
@for lib in $(LIB_DEPS); do \
$(MAKE) -C $(HDL_LIBRARY_PATH)$${lib} || exit $$?; \
done

0 comments on commit 5272ed4

Please sign in to comment.