summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-17 17:44:52 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-17 17:44:52 +0100
commit2d1f865d16c5a7e27f5e46c96d087a7ff8a49012 (patch)
treefbdabf6e17daaebabcc6ddb0e726565b52abdc28 /py
parenteeffbb694809d6ee1434842bc234eb44714c25ac (diff)
parent70a7d7a94397cbe01fd5457e34f3d3368300f2ac (diff)
downloadmicropython-2d1f865d16c5a7e27f5e46c96d087a7ff8a49012.tar.gz
micropython-2d1f865d16c5a7e27f5e46c96d087a7ff8a49012.zip
Merge branch 'relocatable-build-dir' of github.com:lurch/micropython into lurch-relocatable-build-dir
Diffstat (limited to 'py')
-rw-r--r--py/mkrules.mk8
-rw-r--r--py/py.mk20
-rw-r--r--py/qstr.c1
-rw-r--r--py/qstr.h1
4 files changed, 19 insertions, 11 deletions
diff --git a/py/mkrules.mk b/py/mkrules.mk
index 08ba8fc416..63a98a8ec6 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -59,10 +59,16 @@ $(BUILD)/%.pp: %.c
# object directories (but only for existance), and the object directories
# will be created if they don't exist.
OBJ_DIRS = $(sort $(dir $(OBJ)))
-$(OBJ): $(PY_BUILD)/qstrdefs.generated.h | $(OBJ_DIRS)
+$(OBJ): $(HEADER_PY_BUILD)/qstrdefs.generated.h | $(OBJ_DIRS)
$(OBJ_DIRS):
$(MKDIR) -p $@
+$(HEADER_BUILD):
+ $(MKDIR) -p $@
+
+$(HEADER_PY_BUILD):
+ $(MKDIR) -p $@
+
ifneq ($(PROG),)
# Build a standalone executable (unix and unix-cpy do this)
diff --git a/py/py.mk b/py/py.mk
index 1bd536718e..01a5fd1c2b 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -1,8 +1,13 @@
# where py object files go (they have a name prefix to prevent filename clashes)
PY_BUILD = $(BUILD)/py
-# file containing qstr defs for the core Python bit
+# where autogenerated header files go
+HEADER_BUILD = $(BUILD)/includes/build
+
+# where autogenerated py header files go
+HEADER_PY_BUILD = $(HEADER_BUILD)/py
+# file containing qstr defs for the core Python bit
PY_QSTR_DEFS = $(PY_SRC)/qstrdefs.h
# py object files
@@ -100,26 +105,25 @@ PY_O = $(addprefix $(PY_BUILD)/, $(PY_O_BASENAME))
FORCE:
.PHONY: FORCE
-$(PY_BUILD)/py-version.h: FORCE
+$(HEADER_PY_BUILD)/py-version.h: FORCE
$(Q)$(PY_SRC)/py-version.sh > $@.tmp
$(Q)if [ -f "$@" ] && cmp -s $@ $@.tmp; then rm $@.tmp; else echo "Generating $@"; mv $@.tmp $@; fi
# qstr data
-# Adding an order only dependency on $(PY_BUILD) causes $(PY_BUILD) to get
+# Adding an order only dependency on $(HEADER_PY_BUILD) causes $(HEADER_PY_BUILD) to get
# created before we run the script to generate the .h
-$(PY_BUILD)/qstrdefs.generated.h: | $(PY_BUILD)/
-$(PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py mpconfigport.h $(PY_SRC)/mpconfig.h
+$(HEADER_PY_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(PY_SRC)/makeqstrdata.py mpconfigport.h $(PY_SRC)/mpconfig.h | $(HEADER_PY_BUILD)
$(ECHO) "makeqstrdata $(PY_QSTR_DEFS) $(QSTR_DEFS)"
- $(CPP) $(CFLAGS) $(PY_QSTR_DEFS) -o $(PY_BUILD)/qstrdefs.preprocessed.h
- $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(PY_BUILD)/qstrdefs.preprocessed.h $(QSTR_DEFS) > $@
+ $(CPP) $(CFLAGS) $(PY_QSTR_DEFS) -o $(HEADER_PY_BUILD)/qstrdefs.preprocessed.h
+ $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(HEADER_PY_BUILD)/qstrdefs.preprocessed.h $(QSTR_DEFS) > $@
# We don't know which source files actually need the generated.h (since
# it is #included from str.h). The compiler generated dependencies will cause
# the right .o's to get recompiled if the generated.h file changes. Adding
# an order-only dependendency to all of the .o's will cause the generated .h
# to get built before we try to compile any of them.
-$(PY_O): | $(PY_BUILD)/qstrdefs.generated.h $(PY_BUILD)/py-version.h
+$(PY_O): | $(HEADER_PY_BUILD)/qstrdefs.generated.h $(HEADER_PY_BUILD)/py-version.h
# emitters
diff --git a/py/qstr.c b/py/qstr.c
index 990ff37727..2b14065fa6 100644
--- a/py/qstr.c
+++ b/py/qstr.c
@@ -60,7 +60,6 @@ const static qstr_pool_t const_pool = {
(const byte*) "\0\0\0\0", // invalid/no qstr has empty data
(const byte*) "\0\0\0\0", // empty qstr
#define Q(id, str) str,
-// TODO having 'build/' here is a bit of a hack, should take config variable from Makefile
#include "build/py/qstrdefs.generated.h"
#undef Q
},
diff --git a/py/qstr.h b/py/qstr.h
index 994c418088..6bcb1707fb 100644
--- a/py/qstr.h
+++ b/py/qstr.h
@@ -8,7 +8,6 @@ enum {
MP_QSTR_NULL = 0, // indicates invalid/no qstr
MP_QSTR_ = 1, // the empty qstr
#define Q(id, str) MP_QSTR_##id,
-// TODO having 'build/py.' here is a bit of a hack, should take config variable from Makefile
#include "build/py/qstrdefs.generated.h"
#undef Q
MP_QSTR_number_of,