summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-05 02:57:34 -0500
committermidipix <writeonce@midipix.org>2018-12-06 20:58:33 -0500
commit92c5a22468dadbd8c72b390dc938c1db3bad91dd (patch)
treeb9e952ab69d7a6446e2efacb581983f4e4fb1ec2 /project
parentec618c98e8afdf2e5083a8dd045953cdc43781e1 (diff)
downloadsbpython2-92c5a22468dadbd8c72b390dc938c1db3bad91dd.tar.bz2
sbpython2-92c5a22468dadbd8c72b390dc938c1db3bad91dd.tar.xz
project: added pycgen.mk (build rules for python's distributed .pyc objects).
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