summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-16 19:25:55 -0500
committermidipix <writeonce@midipix.org>2018-12-18 20:38:41 -0500
commit9ef55b152c6b36e21a969b16477586a11eac87c5 (patch)
tree5063768d0bc4300e027e9fd403e8e8960cdbf1ef /project
parentf54c9decb77ce638eb440ccf7c27f2e8222f449d (diff)
downloadsbpython3-9ef55b152c6b36e21a969b16477586a11eac87c5.tar.bz2
sbpython3-9ef55b152c6b36e21a969b16477586a11eac87c5.tar.xz
project: imported pycgen.mk from sbpython2, revised for python-3.x.
Diffstat (limited to 'project')
-rw-r--r--project/extras.mk3
-rw-r--r--project/pycgen.mk91
2 files changed, 94 insertions, 0 deletions
diff --git a/project/extras.mk b/project/extras.mk
index fab4848..0a48a8a 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -57,3 +57,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..af02e96
--- /dev/null
+++ b/project/pycgen.mk
@@ -0,0 +1,91 @@
+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__$(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_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) $<
+
+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