Blame project/pycgen.mk

92c5a2
PYCGEN        = $(PROJECT_DIR)/project/pycgen.sh
92c5a2
PYCGEN_PYTHON = $(CURDIR)/$(PYCOMPILE)
92c5a2
92c5a2
PYDIST_ENCDIR = $(PYDIST_PYCDIR)/./encodings
92c5a2
PYCGEN_ENCDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./encodings
92c5a2
PYCGEN_PYCDIR = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/.
92c5a2
92c5a2
PYCGEN_CFGDAT = $(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./_sysconfigdata.py
92c5a2
PYCGEN_PYSRCS = $(PYDIST_SRCS:$(PYDIST_PYCDIR)/./%.py=$(PYCGEN_PYCDIR)/%.py)
92c5a2
PYCGEN_PYENCS = $(PYDIST_ENCODINGS_SRCS:$(PYDIST_ENCDIR)/%.py=$(PYCGEN_ENCDIR)/%.py)
92c5a2
8b9d90
$(PYDIST_PYCDIR)/./_sysconfigdata.py:
8b9d90
		mkdir -p $(PYDIST_PYCDIR)
83a88f
		printf 'build_time_vars = {\n\t%s: %s\n}\n' \
83a88f
			"'VERSION'" "'"$(PYTHON_MAJOR).$(PYTHON_MINOR)"'" > $@
92c5a2
92c5a2
$(PYCGEN_CFGDAT): $(PYCOMPILE_DIR)/tree.tag
83a88f
		printf 'build_time_vars = {\n\t%s: %s\n}\n' \
83a88f
			"'VERSION'" "'"$(PYTHON_MAJOR).$(PYTHON_MINOR)"'" > $@
92c5a2
92c5a2
$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./%.py: $(SOURCE_DIR)/Lib/%.py $(PYCOMPILE_DIR)/tree.tag
92c5a2
		PYCOPY_PYTHON=$(PYCOMPILE) \
92c5a2
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
92c5a2
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR) \
92c5a2
		$(PYCOPY) $<
92c5a2
92c5a2
$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/./encodings/%.py: $(SOURCE_DIR)/Lib/encodings/%.py $(PYCOMPILE_DIR)/tree.tag
92c5a2
		PYCOPY_PYTHON=$(PYCOMPILE) \
92c5a2
		PYCOPY_PREFIX=$(PYCOMPILE_PREFIX) \
92c5a2
		PYCOPY_DSTDIR=$(PYCOMPILE_DIR)/$(PYDIST_PYCDIR)/encodings \
92c5a2
		$(PYCOPY) $<
92c5a2
87d32e
%.pyc:		%.py $(PYCOMPILE) $(PYCGEN_PYSRCS) $(PYCGEN_PYENCS) $(PYCGEN_CFGDAT)
92c5a2
		PYCGEN_PYTHON=$(PYCGEN_PYTHON) \
92c5a2
		$(PYCGEN) $<
92c5a2
87d32e
%/ttk.pyc:	pydist.tag
87d32e
		touch $@
87d32e
92c5a2
PYCGEN_OBJS   = $(PYDIST_PY_SRCS:%.py=%.pyc)
92c5a2
92c5a2
pycgen-deps:	$(PYCGEN_PYSRCS) $(PYCGEN_PYENCS)
92c5a2
92c5a2
pycgen-objs:	$(PYCGEN_OBJS)
92c5a2
92c5a2
all:		pycgen-objs
92c5a2
92c5a2
pycgen-objs-clean:
92c5a2
	rm -f $(PYCGEN_PYSRCS)
92c5a2
	rm -f $(PYCGEN_PYSRCS:%.py=%.pyc)
92c5a2
	rm -f $(PYCGEN_PYENCS)
92c5a2
	rm -f $(PYCGEN_PYENCS:%.py=%.pyc)
92c5a2
	rm -f $(PYCGEN_CFGDAT)
92c5a2
	rm -f $(PYCGEN_CFGDAT:%.py=%.pyc)
92c5a2
	rm -f $(PYCGEN_OBJS)
92c5a2
92c5a2
clean:	pycgen-objs-clean
92c5a2
92c5a2
.PHONY:	pycgen-deps
92c5a2
.PHONY:	pycgen-objs
92c5a2
.PHONY:	pycgen-objs-clean