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 (Build) 8.PHONY: all 9# Build 10.PHONY: build 11# Develop 12.PHONY: develop 13# Install 14.PHONY: install 15# Test 16.PHONY: test 17# Clean 18.PHONY: clean 19# Format 20.PHONY: fix 21 22 23PYTHON ?= python 24YAPF ?= yapf 25 26EXT_SUFFIX=$(shell $(PYTHON) -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))') 27EXT_SOURCES=$(shell find . -name '*.cc') 28EXTENSIONS=$(EXT_SOURCES:%.cc=%$(EXT_SUFFIX)) 29 30 31all: build 32 33build: $(EXTENSIONS) 34 35$(EXTENSIONS): $(EXT_SOURCES) 36 @cd .. && $(PYTHON) setup.py build_ext --inplace 37 38develop: 39 @cd .. && $(PYTHON) setup.py develop 40 41install: 42 @cd .. && $(PYTHON) setup.py install 43 44test: build 45 @echo 'running tests' 46 @$(PYTHON) -m unittest discover -v -p '*_test.py' 47 48clean: 49 @cd .. && $(PYTHON) setup.py clean 50 @find .. -name '*.pyc' | xargs rm -v 51 @find .. -name '*.so' | xargs rm -v 52 @find .. -type d -name '__pycache__' | xargs rm -v -r 53 @find .. -type d -name '*.egg-info' | xargs rm -v -r 54 55fix: 56 @echo 'formatting code' 57 -@$(YAPF) --in-place --recursive --verify . 58