Files
prjxray/Makefile
T

122 lines
3.1 KiB
Makefile
Raw Normal View History

2019-01-10 18:45:02 -08:00
ALL_EXCLUDE = third_party .git env build
2018-10-11 20:12:48 +00:00
2019-01-10 18:45:02 -08:00
# Tools + Environment
2018-12-13 17:27:44 -08:00
IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi;
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 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 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-01-10 17:58:32 -08:00
TEST_EXCLUDE = $(foreach x,$(ALL_EXCLUDE) 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
# Auto formatting of code.
# ------------------------
FORMAT_EXCLUDE = $(foreach x,$(ALL_EXCLUDE),-and -not -path './$(x)/*')
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-01-10 19:56:11 -08:00
format: format-cpp format-docs format-py format-tcl
2019-01-10 18:45:02 -08:00
@true
.PHONY: format format-cpp format-py format-tcl
# 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
2019-03-22 15:15:12 -07:00
db-check-$(1):
@echo
@echo "Checking $(1) database"
@echo "============================"
2019-03-26 15:23:12 -07:00
@$(IN_ENV) python3 utils/checkdb.py --db-root database/$(1)
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
2019-03-22 15:15:12 -07:00
.PHONY: db-check-$(1) db-format-$(1)
.NOTPARALLEL: db-check-$(1) db-format-$(1)
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))))
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