summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/extras.mk3
-rw-r--r--project/pycgen.mk55
2 files changed, 58 insertions, 0 deletions
diff --git a/project/extras.mk b/project/extras.mk
index 5e6b102..b30e289 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -101,3 +101,6 @@ include $(PROJECT_DIR)/project/pycompile.mk
# pydist (python's distributed .py scripts)
include $(PROJECT_DIR)/project/pydist.mk
+
+# pycgen (python's distributed .pyc objects)
+include $(PROJECT_DIR)/project/pycgen.mk
diff --git a/project/pycgen.mk b/project/pycgen.mk
new file mode 100644
index 0000000..c54d4f1
--- /dev/null
+++ b/project/pycgen.mk
@@ -0,0 +1,55 @@
+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