commit 517dc5a89fc3274dd6457b32653616e355369717
parent b8ea542ae6db4934ceb3d3a69a7884830604df31
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 23 Jan 2016 21:31:12 +0100
Add support for multi arch in the main Makefile
Diffstat:
6 files changed, 100 insertions(+), 11 deletions(-)
diff --git a/Makefile b/Makefile
@@ -3,18 +3,34 @@
include config.mk
-SUBDIRS = \
- lib \
- cc1 \
- cc2
+SUBDIRS = lib cc1 cc2
+
+ARCHS = z80 i386-sysv amd64-sysv
all clean:
- @echo scc build options:
- @echo "CFLAGS = ${CFLAGS}"
- @echo "LDFLAGS = ${LDFLAGS}"
- @echo "CC = ${CC}"
- @for i in ${SUBDIRS};\
+ for i in ${SUBDIRS};\
do \
- (cd $$i; ${MAKE} $(MAKEFLAGS) $@ || exit); \
- done;
+ (cd $$i; ${MAKE} -$(MAKEFLAGS) $@ || exit); \
+ done
+
+multi: $(ARCHS)
+
+lib/libcc.a:
+ cd lib && $(MAKE) -$(MAKEFLAGS) all
+
+$(ARCHS): lib/libcc.a
+ for i in cc1 cc2; \
+ do \
+ (cd $$i; ARCH=$@ ${MAKE} -e $(MAKEFLAGS) clean $$i || exit); \
+ done
+ ln -f cc1/cc1 bin/cc1-$@
+ ln -f cc2/cc2 bin/cc2-$@
+
+install:
+ mkdir -p $(DESTDIR)$(PREFIX)/libexec/scc/
+ cp -f bin/cc[12]-*
+ cd $(DESTDIR)$(PREFIX)/libexec/scc/ && chmod 755 cc[12]-*
+
+distclean: clean
+ rm -f bin/cc[12]-*
diff --git a/bin/README b/bin/README
@@ -0,0 +1 @@
+This is place holder for control version systems
diff --git a/cc1/arch/amd64-sysv/arch.h b/cc1/arch/amd64-sysv/arch.h
@@ -0,0 +1,33 @@
+
+#define RANK_BOOL 0
+#define RANK_SCHAR 1
+#define RANK_UCHAR 1
+#define RANK_CHAR 1
+#define RANK_SHORT 2
+#define RANK_USHORT 2
+#define RANK_INT 3
+#define RANK_UINT 3
+#define RANK_LONG 4
+#define RANK_ULONG 4
+#define RANK_LLONG 5
+#define RANK_ULLONG 5
+#define RANK_FLOAT 6
+#define RANK_DOUBLE 7
+#define RANK_LDOUBLE 8
+
+#define TINT long long
+#define TUINT unsigned long long
+#define TFLOAT double
+
+#define L_SCHAR L_INT8
+#define L_UCHAR L_UINT8
+#define L_CHAR L_INT8
+#define L_SHORT L_INT16
+#define L_USHORT L_UINT16
+#define L_INT L_INT32
+#define L_UINT L_UINT32
+#define L_LONG L_INT32
+#define L_ULONG L_UINT32
+#define L_LLONG L_INT64
+#define L_ULLONG L_UINT64
+#define L_ENUM L_INT
diff --git a/cc2/arch/amd64-sysv/cgen.c b/cc2/arch/amd64-sysv/cgen.c
@@ -0,0 +1,13 @@
+
+#include "arch.h"
+#include "../../cc2.h"
+
+void
+generate(void)
+{
+}
+
+void
+addable(void)
+{
+}
diff --git a/cc2/arch/amd64-sysv/code.c b/cc2/arch/amd64-sysv/code.c
@@ -0,0 +1,13 @@
+
+#include "arch.h"
+#include "../../cc2.h"
+
+void
+emit(Node *np)
+{
+}
+
+void
+writeout(void)
+{
+}
diff --git a/cc2/arch/i386-sysv/cgen.c b/cc2/arch/i386-sysv/cgen.c
@@ -0,0 +1,13 @@
+
+#include "arch.h"
+#include "../../cc2.h"
+
+void
+generate(void)
+{
+}
+
+void
+addable(void)
+{
+}