shithub: scc

Download patch

ref: 517dc5a89fc3274dd6457b32653616e355369717
parent: b8ea542ae6db4934ceb3d3a69a7884830604df31
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Jan 23 16:31:12 EST 2016

Add support for multi arch in the main Makefile

diff: cannot open b/bin//null: file does not exist: 'b/bin//null' diff: cannot open b/cc1/arch/amd64-sysv//null: file does not exist: 'b/cc1/arch/amd64-sysv//null'
--- 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]-*
--- /dev/null
+++ b/bin/README
@@ -1,0 +1,1 @@
+This is place holder for control version systems
--- /dev/null
+++ b/cc1/arch/amd64-sysv/arch.h
@@ -1,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
--- /dev/null
+++ b/cc2/arch/amd64-sysv/cgen.c
@@ -1,0 +1,13 @@
+
+#include "arch.h"
+#include "../../cc2.h"
+
+void
+generate(void)
+{
+}
+
+void
+addable(void)
+{
+}
--- /dev/null
+++ b/cc2/arch/amd64-sysv/code.c
@@ -1,0 +1,13 @@
+
+#include "arch.h"
+#include "../../cc2.h"
+
+void
+emit(Node *np)
+{
+}
+
+void
+writeout(void)
+{
+}
--- /dev/null
+++ b/cc2/arch/i386-sysv/cgen.c
@@ -1,0 +1,13 @@
+
+#include "arch.h"
+#include "../../cc2.h"
+
+void
+generate(void)
+{
+}
+
+void
+addable(void)
+{
+}