1# Copyright 2016 The Brotli Authors. All rights reserved. 2# 3# Distributed under MIT license. 4# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 5 6 7# Default 8.PHONY: all 9# Build 10.PHONY: build 11# Test 12.PHONY: test tests 13# Clean 14.PHONY: clean 15# Format 16.PHONY: fix 17 18 19PYTHON ?= python 20YAPF ?= yapf 21 22EXT_SUFFIX=$(shell $(PYTHON) -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))') 23EXT_SOURCES=$(shell find . -name '*.cc') 24EXTENSIONS=$(EXT_SOURCES:%.cc=%$(EXT_SUFFIX)) 25 26 27all: build 28 29build: $(EXTENSIONS) 30 31$(EXTENSIONS): $(EXT_SOURCES) 32 @cd .. && $(PYTHON) setup.py develop 33 34test: tests 35 36tests: build 37 @echo 'running tests' 38 @$(PYTHON) -m unittest discover -p '*_test.py' 39 40clean: 41 @cd .. && $(PYTHON) setup.py clean 42 @find .. -name '*.pyc' | xargs rm -v 43 @find .. -name '*.so' | xargs rm -v 44 @find .. -type d -name '__pycache__' | xargs rm -v -r 45 @find .. -type d -name '*.egg-info' | xargs rm -v -r 46 47fix: 48 @echo 'formatting code' 49 -@$(YAPF) --in-place --recursive --verify . 50