Files
prjxray/Makefile
T

78 lines
2.2 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:
2018-12-17 16:28:42 -08:00
virtualenv --python=python3 --system-site-packages env
2018-12-17 19:13:27 -08:00
$(IN_ENV) pip install -r requirements.txt
2019-01-10 18:51:47 -08:00
$(IN_ENV) pip install -r docs/requirements.txt
2018-10-11 20:12:48 +00:00
ln -sf $(PWD)/prjxray env/lib/python3.*/site-packages/
2019-01-10 17:57:20 -08:00
ln -sf $(PWD)/third_party/fasm/fasm.py env/lib/python3.*/site-packages/
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:
$(IN_ENV) py.test $(TEST_EXCLUDE) --doctest-modules --junitxml=build/py_test_results.xml
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
.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
# Project X-Ray database
# ------------------------
2018-02-05 17:51:33 -08:00
2018-12-19 17:07:59 -08:00
checkdb:
@for DB in database/*; do if [ -d $$DB ]; then \
echo ; \
echo "Checking $$DB"; \
echo "============================"; \
2018-12-23 21:09:53 -08:00
$(IN_ENV) python3 utils/checkdb.py --db-root $$DB; \
2018-12-19 17:07:59 -08:00
fi; done
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