Files
prjxray/Makefile
T
Tim 'mithro' Ansell 23c435aa6e Improve make format.
* Use `yapf` from environment if it exists.
 * Better way to generate exclude.
 * Make TCL formatting work.

Signed-off-by: Tim 'mithro' Ansell <[email protected]>
2018-12-13 18:31:10 -08:00

33 lines
1.0 KiB
Makefile

CLANG_FORMAT ?= clang-format-5.0
PYTHON_FORMAT ?= yapf
TCL_FORMAT ?= utils//tcl-reformat.sh
.PHONY: database format clean env
IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi;
env:
virtualenv --python=python3 env
. env/bin/activate; pip install -r requirements.txt
ln -sf $(PWD)/prjxray env/lib/python3.*/site-packages/
build:
git submodule update --init --recursive
mkdir -p build
cd build; cmake ..; $(MAKE)
database: build
$(MAKE) -C $@
FORMAT_EXCLUDE = third_party git env build
FIND_EXCLUDE = $(foreach x,$(FORMAT_EXCLUDE),-and -not -path './$(x)/*')
format:
find . -name \*.cc $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
find . -name \*.h $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
$(IN_ENV) find . -name \*.py $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) yapf -p -i
find . -name \*.tcl $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) -n 1 $(TCL_FORMAT)
clean:
$(MAKE) -C database clean
$(MAKE) -C fuzzers clean
rm -rf build