Files
prjxray/Makefile
T

236 lines
7.1 KiB
Makefile
Raw Normal View History

2019-04-18 09:28:31 +02:00
SHELL = bash
2020-02-10 08:12:24 -08:00
ALL_EXCLUDE = third_party .git env build docs/env
2018-10-11 20:12:48 +00:00
2019-10-20 00:38:34 +01:00
# Check if root
ifeq ($(shell id -u),0)
$(error ERROR: Running as ID 0)
endif
2019-01-10 18:45:02 -08:00
# Tools + Environment
IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi; source utils/environment.python.sh;
2018-10-11 20:12:48 +00:00
env:
2019-02-07 21:41:13 +11:00
virtualenv --python=python3 env
2019-02-06 17:12:01 -08:00
# Install prjxray
ln -sf $(PWD)/prjxray env/lib/python3.*/site-packages/
$(IN_ENV) python -c "import prjxray"
# Install fasm from third_party
$(IN_ENV) pip install --upgrade -e third_party/fasm
# Install sdfparse form third party
$(IN_ENV) pip install --upgrade -e third_party/python-sdf-timing
2019-02-06 17:12:01 -08:00
# Install project dependencies
2018-12-17 19:13:27 -08:00
$(IN_ENV) pip install -r requirements.txt
2019-02-06 17:12:01 -08:00
# Install project's documentation dependencies
2019-01-10 18:51:47 -08:00
$(IN_ENV) pip install -r docs/requirements.txt
2019-02-06 17:12:01 -08:00
# Check fasm library was installed
$(IN_ENV) python -c "import fasm"
$(IN_ENV) python -c "import fasm.output"
# Check sdfparse lib was installed
$(IN_ENV) python -c "import sdf_timing"
$(IN_ENV) python -c "import sdf_timing.sdfparse"
2019-02-06 17:12:01 -08:00
# Check YAML is installed
2018-12-17 19:13:27 -08:00
$(IN_ENV) python -c "import yaml" || (echo "Unable to find python-yaml" && exit 1)
2018-02-05 17:51:33 -08:00
2018-02-05 17:51:32 -08:00
build:
2017-12-20 16:20:01 +01:00
git submodule update --init --recursive
mkdir -p build
2018-02-05 17:51:32 -08:00
cd build; cmake ..; $(MAKE)
2018-01-08 13:44:26 -08:00
2019-01-10 18:45:02 -08:00
.PHONY: env build
2019-01-10 17:58:32 -08:00
2019-01-10 18:45:02 -08:00
# Run tests of code.
# ------------------------
2019-09-02 17:45:45 +02:00
TEST_EXCLUDE = $(foreach x,$(ALL_EXCLUDE) docs fuzzers minitests experiments,--ignore $(x))
2019-01-10 18:45:02 -08:00
test: test-py test-cpp
@true
test-py:
2019-01-11 20:44:19 -08:00
$(IN_ENV) which py.test; py.test $(TEST_EXCLUDE) --doctest-modules --junitxml=build/py_test_results.xml
2019-01-10 18:45:02 -08:00
test-cpp:
mkdir -p build
cd build && cmake -DPRJXRAY_BUILD_TESTING=ON ..
cd build && $(MAKE) -s
cd build && ctest --no-compress-output -T Test -C RelWithDebInfo --output-on-failure
2019-01-10 18:47:50 -08:00
xsltproc .github/kokoro/ctest2junit.xsl build/Testing/*/Test.xml > build/cpp_test_results.xml
2019-01-10 18:45:02 -08:00
.PHONY: test test-py test-cpp
2020-04-01 19:35:55 +02:00
# Run HTML test
# ------------------------
test-htmlgen:
cd htmlgen && source htmlgen.sh
.PHONY: test-htmlgen
2019-01-10 18:45:02 -08:00
# Auto formatting of code.
# ------------------------
2019-10-24 21:51:47 +01:00
FORMAT_EXCLUDE = $(foreach x,$(ALL_EXCLUDE),-and -not -path './$(x)/*') -and -not -name *.bit
2019-01-10 18:45:02 -08:00
CLANG_FORMAT ?= clang-format-5.0
format-cpp:
find . -name \*.cc $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
find . -name \*.h $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
2019-01-10 19:56:11 -08:00
format-docs:
./.github/update-contributing.py
2019-01-10 18:45:02 -08:00
PYTHON_FORMAT ?= yapf
format-py:
$(IN_ENV) find . -name \*.py $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) yapf -p -i
TCL_FORMAT ?= utils//tcl-reformat.sh
format-tcl:
find . -name \*.tcl $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) -n 1 $(TCL_FORMAT)
2019-10-24 21:51:47 +01:00
# Command to find and replace trailing whitespace in-place using `sed` (This is
# placed inside quotes later so need to escape the "'")
WS_CMD = sed -i '\''s@\s\+$$@@g'\''
# File filter for files to fix trailing whitespace in, this is just a couple of
# chained bash conditionals ensuring that the file (indicated by {}, provided by
# xargs later) is a file, and not a directory or link. Also filters out .bit
# files as these are the only binary files currently tracked by Git and we don't
# want to inadvertently change these at all.
WS_FILTER = [ -f {} -a ! -L {} ] && [[ {} != *.bit ]]
# For every file piped to $(WS_FORMAT) apply the filter and perform the command,
# if a file does not match the filter, just returns true.
WS_FORMAT = xargs -P $$(nproc) -n 1 -I{} bash -c '$(WS_FILTER) && $(WS_CMD) {} || true'
format-trailing-ws:
# Use `git ls-files` to give us a complete list of tracked files to fix
# whitespace in; there is no point spending time processing anything that is
# not known to Git.
git ls-files | $(WS_FORMAT)
# Additionally fix untracked (but not ignored) files.
git ls-files -o --exclude-standard | $(WS_FORMAT)
format: format-cpp format-docs format-py format-tcl format-trailing-ws
2019-01-10 18:45:02 -08:00
@true
2019-10-24 21:51:47 +01:00
.PHONY: format format-cpp format-py format-tcl format-trailing-ws
2019-01-10 18:45:02 -08:00
# Targets related to Project X-Ray databases
2019-01-10 18:45:02 -08:00
# ------------------------
2018-02-05 17:51:33 -08:00
DATABASES=artix7 kintex7 zynq7
define database
# $(1) - Database name
db-$(1):
+source settings/$(1).sh && $$(MAKE) -C fuzzers
2019-03-22 15:15:12 -07:00
db-check-$(1):
@echo
@echo "Checking $(1) database"
@echo "============================"
@$(IN_ENV) python3 utils/checkdb.py
2019-03-22 15:15:12 -07:00
db-format-$(1):
@echo
@echo "Formatting $(1) database"
@echo "============================"
@$(IN_ENV) cd database/$(1); python3 ../../utils/sort_db.py
@if [ -e database/Info.md ]; then $(IN_ENV) ./utils/info_md.py --keep; fi
.PHONY: db-$(1) db-check-$(1) db-format-$(1) db-extras-$(1) db-extras-$(1)-parts db-extras-$(1)-harness
db-extras-$(1): db-extras-$(1)-parts db-extras-$(1)-harness
db-$(1)-all: db-$(1) db-extras-$(1)-parts
# Build harnesses after database is complete
$$(MAKE) db-extras-$(1)-harness
2019-03-22 15:15:12 -07:00
db-check: db-check-$(1)
db-format: db-format-$(1)
endef
$(foreach DB,$(DATABASES),$(eval $(call database,$(DB))))
# Targets related to Project X-Ray parts
# --------------------------------------
ARTIX_PARTS=artix7_200t artix7_100t
2020-01-27 11:05:19 +01:00
ZYNQ_PARTS=zynq7010
KINTEX_PARTS=kintex70t
XRAY_PARTS=${ARTIX_PARTS} ${ZYNQ_PARTS} ${KINTEX_PARTS}
define multiple-parts
# $(1): PART to be used
db-part-only-$(1):
2020-01-15 17:01:22 +01:00
+source settings/$(1).sh && $$(MAKE) -C fuzzers part_only
endef
$(foreach PART,$(XRAY_PARTS),$(eval $(call multiple-parts,$(PART))))
db-extras-artix7-parts: $(addprefix db-part-only-,$(ARTIX_PARTS))
2020-01-22 15:49:37 +01:00
db-extras-artix7-harness:
+XRAY_PIN_00=J13 XRAY_PIN_01=J14 XRAY_PIN_02=K15 XRAY_PIN_03=K16 \
XRAY_PART=xc7a35tftg256-1 XRAY_EQUIV_PART=xc7a50tfgg484-1 $(MAKE) -C fuzzers roi_only
+source settings/artix7_100t.sh && \
XRAY_PIN_00=N15 XRAY_PART=xc7a100tcsg324-1 XRAY_EQUIV_PART=xc7a100tfgg676-1 \
$(MAKE) -C fuzzers roi_only
2020-04-02 11:22:21 +02:00
+source settings/artix7_200t.sh && \
2020-02-19 16:28:32 -08:00
XRAY_PIN_00=V10 XRAY_PIN_01=W10 XRAY_PIN_02=Y11 XRAY_PIN_03=Y12 \
XRAY_PART=xc7a200tsbg484-1 XRAY_EQUIV_PART=xc7a200tffg1156-1 \
$(MAKE) -C fuzzers roi_only
+source minitests/roi_harness/basys3-swbut.sh && $(MAKE) -C fuzzers roi_only
+source minitests/roi_harness/arty-uart.sh && $(MAKE) -C fuzzers roi_only
2019-08-08 08:54:31 -07:00
+source minitests/roi_harness/basys3-swbut.sh && \
$(MAKE) -C minitests/roi_harness \
2020-02-18 18:47:17 -08:00
HARNESS_DIR=$(XRAY_DATABASE_DIR)/artix7/harness/basys3/swbut copy
2019-08-08 08:54:31 -07:00
+source minitests/roi_harness/basys3-swbut.sh && \
$(MAKE) -C minitests/roi_harness \
XRAY_ROIV=../roi_base_div2.v \
2020-02-18 18:47:17 -08:00
HARNESS_DIR=$(XRAY_DATABASE_DIR)/artix7/harness/basys3/swbut_50 copy
2019-08-08 08:54:31 -07:00
+source minitests/roi_harness/arty-uart.sh && \
$(MAKE) -C minitests/roi_harness \
2020-02-18 18:47:17 -08:00
HARNESS_DIR=$(XRAY_DATABASE_DIR)/artix7/harness/arty-a7/uart copy
2019-08-08 08:54:31 -07:00
+source minitests/roi_harness/arty-pmod.sh && \
$(MAKE) -C minitests/roi_harness \
2020-02-18 18:47:17 -08:00
HARNESS_DIR=$(XRAY_DATABASE_DIR)/artix7/harness/arty-a7/pmod copy
2019-08-08 08:54:31 -07:00
+source minitests/roi_harness/arty-swbut.sh && \
$(MAKE) -C minitests/roi_harness \
2020-02-18 18:47:17 -08:00
HARNESS_DIR=$(XRAY_DATABASE_DIR)/artix7/harness/arty-a7/swbut copy
2020-01-22 15:49:37 +01:00
db-extras-kintex7-parts:
@true
2020-01-22 15:49:37 +01:00
db-extras-kintex7-harness:
@true
2020-01-27 18:45:43 +01:00
db-extras-zynq7-parts: $(addprefix db-part-only-,$(ZYNQ_PARTS))
2020-01-22 15:49:37 +01:00
db-extras-zynq7-harness:
2019-12-18 17:58:35 +01:00
@true
2019-03-22 15:15:12 -07:00
db-check:
@true
2018-12-19 17:07:59 -08:00
2019-03-22 15:15:12 -07:00
db-format:
@true
2019-03-22 15:16:25 -07:00
db-info:
$(IN_ENV) ./utils/info_md.py
2019-03-22 15:15:12 -07:00
.PHONY: db-check db-format
2019-01-26 17:49:00 +13:00
2018-02-05 17:51:33 -08:00
clean:
$(MAKE) -C database clean
2018-02-05 17:51:33 -08:00
$(MAKE) -C fuzzers clean
rm -rf build
.PHONY: clean