| 1 |
# If you want to build in MSYS2 on Windows |
| 2 |
# export CMAKE_OPTS=-G "MSYS Makefiles" |
| 3 |
|
| 4 |
VERSION_FILE = src/pillowfight/_version.h |
| 5 |
PYTHON = python3 |
| 6 |
|
| 7 |
build: build_c build_py |
| 8 |
|
| 9 |
install: install_py install_c |
| 10 |
|
| 11 |
uninstall: uninstall_py |
| 12 |
|
| 13 |
build_py: ${VERSION_FILE} |
| 14 |
${PYTHON} ./setup.py build |
| 15 |
|
| 16 |
build_c: ${VERSION_FILE} build/libpillowfight.so |
| 17 |
|
| 18 |
build/libpillowfight.so: ${VERSION_FILE} build/Makefile |
| 19 |
(cd build && make -j4) |
| 20 |
|
| 21 |
build/Makefile: |
| 22 |
mkdir -p build |
| 23 |
(cd build && cmake ${CMAKE_OPTS} ..) |
| 24 |
|
| 25 |
${VERSION_FILE}: |
| 26 |
echo -n "#define INTERNAL_PILLOWFIGHT_VERSION \"" >| $@ |
| 27 |
echo -n $(shell git describe --always) >> $@ |
| 28 |
echo "\"" >> $@ |
| 29 |
|
| 30 |
version: ${VERSION_FILE} |
| 31 |
|
| 32 |
doc: install_py |
| 33 |
(cd doc && make html) |
| 34 |
doxygen doc/doxygen.conf |
| 35 |
cp doc/index.html doc/build/index.html |
| 36 |
|
| 37 |
check: |
| 38 |
flake8 |
| 39 |
# pydocstyle src |
| 40 |
|
| 41 |
test: build_py |
| 42 |
pytest -xv tests |
| 43 |
|
| 44 |
linux_exe: |
| 45 |
|
| 46 |
windows_exe: |
| 47 |
|
| 48 |
release: |
| 49 |
ifeq (${RELEASE}, ) |
| 50 |
@echo "You must specify a release version (make release RELEASE=1.2.3)" |
| 51 |
else |
| 52 |
@echo "Will release: ${RELEASE}" |
| 53 |
@echo "Checking release is in ChangeLog ..." |
| 54 |
grep ${RELEASE} ChangeLog | grep -v "/xx" |
| 55 |
@echo "Releasing ..." |
| 56 |
git tag -a ${RELEASE} -m ${RELEASE} |
| 57 |
git push origin ${RELEASE} |
| 58 |
make clean |
| 59 |
make version |
| 60 |
${PYTHON} ./setup.py sdist upload |
| 61 |
@echo "All done" |
| 62 |
endif |
| 63 |
|
| 64 |
clean: |
| 65 |
rm -rf doc/build |
| 66 |
rm -rf build dist *.egg-info |
| 67 |
rm -f ${VERSION_FILE} |
| 68 |
|
| 69 |
install_py: ${VERSION_FILE} |
| 70 |
${PYTHON} ./setup.py install ${PIP_ARGS} |
| 71 |
|
| 72 |
install_c: build/Makefile ${VERSION_FILE} |
| 73 |
(cd build && make install) |
| 74 |
|
| 75 |
uninstall_py: |
| 76 |
pip3 uninstall -y pypillowfight |
| 77 |
|
| 78 |
uninstall_c: |
| 79 |
echo "Can't uninstall C library. Sorry" |
| 80 |
|
| 81 |
help: |
| 82 |
@echo "make build || make build_c || make build_py" |
| 83 |
@echo "make check" |
| 84 |
@echo "make doc" |
| 85 |
@echo "make help: display this message" |
| 86 |
@echo "make install || make install_c || make install_py" |
| 87 |
@echo "make release" |
| 88 |
@echo "make test" |
| 89 |
@echo "make uninstall || make uninstall_py" |
| 90 |
|
| 91 |
.PHONY: \ |
| 92 |
build \ |
| 93 |
build_c \ |
| 94 |
build_py \ |
| 95 |
check \ |
| 96 |
doc \ |
| 97 |
exe \ |
| 98 |
exe \ |
| 99 |
help \ |
| 100 |
install \ |
| 101 |
install_c \ |
| 102 |
install_py \ |
| 103 |
release \ |
| 104 |
test \ |
| 105 |
uninstall \ |
| 106 |
uninstall_c \ |
| 107 |
version |