Blob Blame History Raw
PYCGEN        = $(PROJECT_DIR)/project/pycgen.sh
PYCGEN_PYTHON = $(CURDIR)/$(PYCOMPILE)

PYDIST_ENCDIR = $(PYDIST_PYCDIR)/./encodings
PYCGEN_ENCDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./encodings
PYCGEN_PYCDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/.

PYCGEN_CFGDAT = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./_sysconfigdata.py
PYCGEN_PYSRCS = $(PYDIST_SRCS:$(PYDIST_PYCDIR)/./%.py=$(PYCGEN_PYCDIR)/%.py)
PYCGEN_PYENCS = $(PYDIST_ENCODINGS_SRCS:$(PYDIST_ENCDIR)/%.py=$(PYCGEN_ENCDIR)/%.py)

$(PYDIST_PYCDIR)/./_sysconfigdata.py: tree.tag
		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) $<

%.pyc:	%.py $(PYCOMPILE) $(PYCGEN_PYSRCS) $(PYCGEN_PYENCS) $(PYCGEN_CFGDAT)
		PYCGEN_PYTHON=$(PYCGEN_PYTHON) \
		$(PYCGEN) $<

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

pycgen-deps:	$(PYCGEN_PYSRCS) $(PYCGEN_PYENCS)

pycgen-objs:	$(PYCGEN_OBJS)

all:		pycgen-objs

pycgen-objs-clean:
	rm -f $(PYCGEN_PYSRCS)
	rm -f $(PYCGEN_PYSRCS:%.py=%.pyc)
	rm -f $(PYCGEN_PYENCS)
	rm -f $(PYCGEN_PYENCS:%.py=%.pyc)
	rm -f $(PYCGEN_CFGDAT)
	rm -f $(PYCGEN_CFGDAT:%.py=%.pyc)
	rm -f $(PYCGEN_OBJS)

clean:	pycgen-objs-clean

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