jw-pkg/make/py-rules.mk
Jan Lindemann fb2f57b7b9 py-mod.mk, py-rules.mk: Split up py-mod.mk in py-mod.mk and py-rules.mk
py-rules.mk is meant to be usable outside of a jw Python module
context, just for generating .pyc, for example

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-22 10:11:44 +00:00

30 lines
800 B
Makefile

all:
py.clean:
$(RM) -f *.done *.pyc
/bin/bash $(MOD_SCRIPT_DIR)/scm.sh clean -f __init__.py
$(RM) -rf __pycache__
install-dirs.done:
$(INSTALL) -d -m $(PYMODDIRMODE) -o $(PYMODDIROWNER) -g $(PYMODDIRGROUP) $(PY_INSTALL_DIRS)
touch $@
install-reg.done: install-dirs.done $(PY_INSTALLED_REG)
touch $@
$(PY_INSTALL_DIR_PY)/%.py: %.py
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
ifneq ($(PYTHON_VERSION),3)
%.pyc: %.py
else
__pycache__/%.cpython-37.pyc: %.py
endif
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
ifeq ($(PYTHON_VERSION),3)
$(PY_INSTALL_DIR_PY)/__pycache__/%.cpython-37.pyc: __pycache__/%.cpython-37.pyc
else
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
endif
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@