Blob Blame History Raw
PYCGEN        = $(CURDIR)/$(PYCOMPILE)

PYDIST_ENCDIR = $(PYDIST_PYCDIR)/./encodings
PYDIST_IMPDIR = $(PYDIST_PYCDIR)/./importlib
PYDIST_COLDIR = $(PYDIST_PYCDIR)/./collections
PYDIST_URLDIR = $(PYDIST_PYCDIR)/./urllib

PYCGEN_PYCDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/.
PYCGEN_ENCDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./encodings
PYCGEN_IMPDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./importlib
PYCGEN_COLDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./collections
PYCGEN_URLDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./urllib

PYCGEN_CFGDAT = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./_sysconfigdata_$(PYTHON_ABIFL)_$(NATIVE_OS)_.py
PYCGEN_PYSRCS = $(PYDIST_SRCS:$(PYDIST_PYCDIR)/./%.py=$(PYCGEN_PYCDIR)/%.py)
PYCGEN_PYENCS = $(PYDIST_ENCODINGS_SRCS:$(PYDIST_ENCDIR)/%.py=$(PYCGEN_ENCDIR)/%.py)
PYCGEN_PYIMPS = $(PYDIST_IMPORTLIB_SRCS:$(PYDIST_IMPDIR)/%.py=$(PYCGEN_IMPDIR)/%.py)
PYCGEN_PYCOLS = $(PYDIST_COLLECTIONS_SRCS:$(PYDIST_COLDIR)/%.py=$(PYCGEN_COLDIR)/%.py)
PYCGEN_PYURLS = $(PYDIST_URLLIB_SRCS:$(PYDIST_URLDIR)/%.py=$(PYCGEN_URLDIR)/%.py)

$(PYDIST_PYCDIR)/./_sysconfigdata_$(PYTHON_ABIFL)_$(PYTHON_PLATFORM)_.py:
		mkdir -p $(PYDIST_PYCDIR)
		printf 'build_time_vars = {}\n' > $@

$(PYCGEN_CFGDAT): $(PYCOMPILE_DIR)/tree.tag
		printf 'build_time_vars = {}\n' > $@

$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./%.py: $(SOURCE_DIR)/Lib/%.py $(PYCOMPILE_DIR)/tree.tag
		PYCOPY_PYTHON=$(PYCOMPILE) \
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR) \
		$(PYCOPY) $<

$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./encodings/%.py: $(SOURCE_DIR)/Lib/encodings/%.py $(PYCOMPILE_DIR)/tree.tag
		PYCOPY_PYTHON=$(PYCOMPILE) \
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/encodings \
		$(PYCOPY) $<

$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./importlib/%.py: $(SOURCE_DIR)/Lib/importlib/%.py $(PYCOMPILE_DIR)/tree.tag
		PYCOPY_PYTHON=$(PYCOMPILE) \
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/importlib \
		$(PYCOPY) $<

$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./collections/%.py: $(SOURCE_DIR)/Lib/collections/%.py $(PYCOMPILE_DIR)/tree.tag
		PYCOPY_PYTHON=$(PYCOMPILE) \
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/collections \
		$(PYCOPY) $<

$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./urllib/%.py: $(SOURCE_DIR)/Lib/urllib/%.py $(PYCOMPILE_DIR)/tree.tag
		PYCOPY_PYTHON=$(PYCOMPILE) \
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/urllib \
		$(PYCOPY) $<

$(PYDIST_PYCDIR)/./lib2to3/tests/data/%.pyx: $(PYCOMPILE_DIR)/tree.tag
$(PYDIST_PYCDIR)/./lib2to3/tests/data/%.pyx: $(PYDIST_PYCDIR)/./lib2to3/tests/data/%.py
		touch $@

PYCGEN_SRCS = \
	$(PYCGEN_CFGDAT) \
	$(PYCGEN_PYSRCS) \
	$(PYCGEN_PYENCS) \
	$(PYCGEN_PYIMPS) \
	$(PYCGEN_PYCOLS) \
	$(PYCGEN_PYURLS) \

%.pyx: %.py	$(PYCOMPILE) $(PYCGEN_SRCS)
		PYCGEN_PYTHON=$(PYCGEN_PYTHON) \
		$(PYCGEN) -m py_compile $<
		touch $@

PYCGEN_OBJS   = $(PYDIST_PY_SRCS:%.py=%.pyx)

pycgen-deps:	$(PYCGEN_SRCS)

pycgen-objs:	$(PYCGEN_OBJS)

all:		pycgen-objs

pycgen-objs-clean:
	rm -f $(PYCGEN_PYSRCS)
	rm -f $(PYCGEN_PYENCS)
	rm -f $(PYCGEN_PYIMPS)
	rm -f $(PYCGEN_PYCOLS)
	rm -f $(PYCGEN_CFGDAT)
	rm -f $(PYCGEN_OBJS)

clean:	pycgen-objs-clean

.PHONY:	pycgen-deps
.PHONY:	pycgen-objs
.PHONY:	pycgen-objs-clean