summaryrefslogtreecommitdiffstatshomepage
path: root/unix-cpy
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2013-12-30 12:52:32 +0000
committerDamien George <damien.p.george@gmail.com>2013-12-30 12:52:32 +0000
commit212c296c0b24dddd19099f9188176a14ade42d86 (patch)
tree50bdcb156669c1e6c77f0ba37206314f104196c4 /unix-cpy
parentcd340c44c28e2b07513fbe4d921a7eccca2dcd7a (diff)
downloadmicropython-212c296c0b24dddd19099f9188176a14ade42d86.tar.gz
micropython-212c296c0b24dddd19099f9188176a14ade42d86.zip
Make unix-cpy cross platform; remove dependency of asmx64 on mpconfig.
Diffstat (limited to 'unix-cpy')
-rw-r--r--unix-cpy/Makefile7
-rw-r--r--unix-cpy/mpconfig.h18
2 files changed, 19 insertions, 6 deletions
diff --git a/unix-cpy/Makefile b/unix-cpy/Makefile
index 475b6bd9d4..29ccb32773 100644
--- a/unix-cpy/Makefile
+++ b/unix-cpy/Makefile
@@ -9,6 +9,7 @@ SRC_C = \
main.c \
PY_O = \
+ nlrx86.o \
nlrx64.o \
malloc.o \
qstr.o \
@@ -57,13 +58,13 @@ $(PROG): $(BUILD) $(OBJ)
$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
$(BUILD):
- mkdir $@
+ mkdir -p $@
$(BUILD)/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
-$(BUILD)/%.o: $(PYSRC)/%.s
- $(AS) -o $@ $<
+$(BUILD)/%.o: $(PYSRC)/%.S
+ $(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/%.o: $(PYSRC)/%.c mpconfig.h
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/unix-cpy/mpconfig.h b/unix-cpy/mpconfig.h
index 9fe8a7ac2e..db72b31455 100644
--- a/unix-cpy/mpconfig.h
+++ b/unix-cpy/mpconfig.h
@@ -8,10 +8,22 @@
// type definitions for the specific machine
-#define BYTES_PER_WORD (8)
+#ifdef __LP64__
+typedef long machine_int_t; // must be pointer size
+typedef unsigned long machine_uint_t; // must be pointer size
+#define UINT_FMT "%lu"
+#define INT_FMT "%ld"
+#else
+// These are definitions for machines where sizeof(int) == sizeof(void*),
+// regardless for actual size.
+typedef int machine_int_t; // must be pointer size
+typedef unsigned int machine_uint_t; // must be pointer size
+#define UINT_FMT "%u"
+#define INT_FMT "%d"
+#endif
+
+#define BYTES_PER_WORD sizeof(machine_int_t)
-typedef int64_t machine_int_t; // must be pointer size
-typedef uint64_t machine_uint_t; // must be pointer size
typedef void *machine_ptr_t; // must be of pointer size
typedef const void *machine_const_ptr_t; // must be of pointer size
typedef double machine_float_t;