summaryrefslogtreecommitdiff
path: root/project/pycgen.mk
blob: c54d4f19c9d1b10d814228b9d138373731b10162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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