RPA Toolkit
Added build for MacOS X.
authorMartin Stoilov <martin@rpasearch.com>
Fri, 1 Jul 2011 03:14:35 +0000 (20:14 -0700)
committerMartin Stoilov <martin@rpasearch.com>
Fri, 1 Jul 2011 03:14:35 +0000 (20:14 -0700)
20 files changed:
arch/darwin/i386/rtypes.h [new file with mode: 0644]
build/darwin/build.mk [new file with mode: 0644]
build/darwin/i386/Makefile [new file with mode: 0644]
build/darwin/include.mk [new file with mode: 0644]
rgrep/build/darwin/i386/Makefile [new file with mode: 0644]
rgrep/build/darwin/rgrep.mk [new file with mode: 0644]
rjs/build/darwin/i386/Makefile [new file with mode: 0644]
rjs/build/darwin/rjs.mk [new file with mode: 0644]
rlib/build/darwin/i386/Makefile [new file with mode: 0644]
rlib/build/darwin/rlib.mk [new file with mode: 0644]
rpa/build/darwin/i386/Makefile [new file with mode: 0644]
rpa/build/darwin/rpa.mk [new file with mode: 0644]
rvm/build/darwin/i386/Makefile [new file with mode: 0644]
rvm/build/darwin/rvm.mk [new file with mode: 0644]
tests/testmisc/build/darwin/i386/Makefile [new file with mode: 0644]
tests/testmisc/build/darwin/misc-tests.mk [new file with mode: 0644]
tests/testrjs/build/darwin/i386/Makefile [new file with mode: 0644]
tests/testrjs/build/darwin/testrjs.mk [new file with mode: 0644]
tests/testrpa/build/darwin/i386/Makefile [new file with mode: 0644]
tests/testrpa/build/darwin/testrpa2.mk [new file with mode: 0644]

diff --git a/arch/darwin/i386/rtypes.h b/arch/darwin/i386/rtypes.h
new file mode 100644 (file)
index 0000000..c869477
--- /dev/null
@@ -0,0 +1,99 @@
+#ifndef _RTYPES_H_
+#define _RTYPES_H_
+
+/* 
+ * Architecture dependent types. These types have to be redifined 
+ * for every architecture
+ */
+typedef signed char rint8;
+typedef unsigned char ruint8;
+typedef signed short rint16;
+typedef unsigned short ruint16;
+typedef signed int rint32;
+typedef unsigned int ruint32;
+typedef signed long long rint64;
+typedef unsigned long long ruint64;
+typedef unsigned long rsize_t;
+typedef signed long rssize_t;
+typedef unsigned int ratomic_t;
+typedef unsigned long rword;
+typedef long rsword;
+
+
+/*
+ * Common types. These types should be the same for most of the architectures.
+ */
+typedef long rlong;
+typedef int rinteger;
+typedef short rshort;
+typedef char rchar;
+typedef unsigned long rulong;
+typedef unsigned int ruinteger;
+typedef unsigned short rushort;
+typedef unsigned char ruchar;
+typedef ruchar rbyte;
+typedef double rdouble;
+typedef float rfloat;
+typedef rinteger rboolean;
+typedef void *rpointer;
+typedef const void *rconstpointer;
+typedef struct {ruint32 p1; ruint32 p2;} rpair_t;
+
+/*
+ * Atomic operations (Architecture Dependent)
+ */
+#define R_ATOMIC_CMPXCHG(ptr, oldval, newval, resptr) \
+               do { __asm__ __volatile__ ("lock; cmpxchgl %2, %1" \
+                       : "=a" (*(resptr)), "=m" (*ptr) \
+                       : "r" (newval), "m" (*ptr), "0" (oldval)); } while (0)
+
+#define R_ATOMIC_XCHG(ptr, val) \
+               do { __asm__ __volatile__("lock; xchgl %0,%1" \
+                       :"=r" ((ruint32) val) \
+                       :"m" (*(volatile ruint32 *)ptr), "0" (val) \
+                       :"memory"); } while (0)
+
+#define R_ATOMIC_ADD(ptr, val) \
+               do { __asm__ __volatile__ ("addl %1,%0" \
+                       : "=m" (*ptr) \
+                       : "ir" (val), "m" (*ptr)); } while (0)
+
+#define R_ATOMIC_SUB(ptr, val) \
+               do { __asm__ __volatile__ ("subl %1,%0" \
+                       : "=m" (*ptr) \
+                       : "ir" (val), "m" (*ptr)); } while (0)
+
+
+#define R_DEBUG_BRAKE __asm__ ("int $3")
+#define R_ASSERT(__a__) do {if (!(__a__)) R_DEBUG_BRAKE; } while (0)
+#define R_SIZE_ALIGN(s, n) ((((s) + (n) - 1) / (n)) * (n))
+#define R_MIN(a, b) ((a) < (b) ? (a): (b))
+#define R_MAX(a, b) ((a) > (b) ? (a): (b))
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((rpointer)0)
+#endif
+#endif
+
+#ifndef TRUE
+#define TRUE ((rboolean)1)
+#endif
+
+#ifndef FALSE
+#define FALSE ((rboolean)0)
+#endif
+
+
+typedef enum {
+       RVALSET_NONE = 0,
+       RVALSET_OR,
+       RVALSET_XOR,
+       RVALSET_AND,
+} rvalset_t;
+
+
+#endif
+
diff --git a/build/darwin/build.mk b/build/darwin/build.mk
new file mode 100644 (file)
index 0000000..03492c2
--- /dev/null
@@ -0,0 +1,44 @@
+all:
+       +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) all
+       +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) all
+       +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) all
+       +make -C $(SRCDIR)/tests/testmisc/build/$(OS)/$(ARCHDIR) all
+       +make -C $(SRCDIR)/tests/testrpa/build/$(OS)/$(ARCHDIR) all
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) all
+
+distclean: clean
+       +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) distclean
+       +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) distclean
+       +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) distclean
+       +make -C $(SRCDIR)/tests/testmisc/build/$(OS)/$(ARCHDIR) distclean
+       +make -C $(SRCDIR)/tests/testrpa/build/$(OS)/$(ARCHDIR) distclean
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) distclean
+
+clean:
+       +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) clean
+       +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) clean
+       +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) clean
+       +make -C $(SRCDIR)/tests/testmisc/build/$(OS)/$(ARCHDIR) clean
+       +make -C $(SRCDIR)/tests/testrpa/build/$(OS)/$(ARCHDIR) clean
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) clean
+
+install:
+       mkdir $(RPATK_INC_INSTALL)
+       mkdir $(RPATK_INC_INSTALL)/rlib
+       mkdir $(RPATK_INC_INSTALL)/rvm
+       mkdir $(RPATK_INC_INSTALL)/rpa
+       cp $(SRCDIR)/arch/$(OS)/$(ARCHDIR)/rtypes.h $(RPATK_INC_INSTALL)
+       +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) install
+       +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) install
+       +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) install
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) install
+
+uninstall:
+       +make -C $(SRCDIR)/rlib/build/$(OS)/$(ARCHDIR) uninstall
+       +make -C $(SRCDIR)/rpa/build/$(OS)/$(ARCHDIR) uninstall
+       +make -C $(SRCDIR)/rvm/build/$(OS)/$(ARCHDIR) uninstall
+       +make -C $(SRCDIR)/rgrep/build/$(OS)/$(ARCHDIR) uninstall
+       rm -rf $(RPATK_INC_INSTALL)/rlib
+       rm -rf $(RPATK_INC_INSTALL)/rvm
+       rm -rf $(RPATK_INC_INSTALL)/rpa
+       rm -rf $(RPATK_INC_INSTALL)
diff --git a/build/darwin/i386/Makefile b/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..c72041e
--- /dev/null
@@ -0,0 +1,6 @@
+SRCDIR = ../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+
+include ../include.mk
+include ../build.mk
diff --git a/build/darwin/include.mk b/build/darwin/include.mk
new file mode 100644 (file)
index 0000000..b11c915
--- /dev/null
@@ -0,0 +1,2 @@
+RTK_LIB_INSTALL=/usr/lib
+RPATK_INC_INSTALL=/usr/include/rpatk
diff --git a/rgrep/build/darwin/i386/Makefile b/rgrep/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..978ea8d
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../rgrep.mk
diff --git a/rgrep/build/darwin/rgrep.mk b/rgrep/build/darwin/rgrep.mk
new file mode 100644 (file)
index 0000000..515ccd4
--- /dev/null
@@ -0,0 +1,50 @@
+RPAGREP_BIN_INSTALL = /usr/bin
+RLIB_SRCDIR = $(SRCDIR)/rlib
+RVM_SRCDIR = $(SRCDIR)/rvm
+RPA_SRCDIR = $(SRCDIR)/rpa
+RGREP_SRCDIR = $(SRCDIR)/rgrep
+INCLUDE = -I$(SRCDIR) -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR) -I$(RGREP_SRCDIR) -I$(RGREP_SRCDIR)/unix
+
+
+LIBS = -L$(RLIB_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RVM_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RPA_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -lrpa -lrvm -lrlib -lpthread -lm
+OBJECTS        = $(OUTDIR)/rpagrep.o $(OUTDIR)/main.o $(OUTDIR)/fsenum.o $(OUTDIR)/rpagrepdep.o $(OUTDIR)/rpagreputf.o
+RPAGREP        = rgrep
+
+
+all : $(OUTDIR) $(OUTDIR)/$(RPAGREP)
+
+$(OUTDIR)/$(RPAGREP) : $(OBJECTS)
+       $(CC) $(ARCH) -o $@ $^ $(LIBS)
+
+
+$(OUTDIR)/%.o: $(RGREP_SRCDIR)/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RGREP_SRCDIR)/$*.c $(INCLUDE)
+
+$(OUTDIR)/%.o: $(RGREP_SRCDIR)/unix/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RGREP_SRCDIR)/unix/$*.c $(INCLUDE)
+
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TESTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+       @rm -f $(OBJECTS)
+       @rm -f $(OUTDIR)/$(RPAGREP)
+
+install:
+       cp $(OUTDIR)/$(RPAGREP) $(RPAGREP_BIN_INSTALL)
+
+uninstall:
+       rm $(RPAGREP_BIN_INSTALL)/$(RPAGREP)
+
+
diff --git a/rjs/build/darwin/i386/Makefile b/rjs/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..91ff4e9
--- /dev/null
@@ -0,0 +1,25 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+
+include ../rjs.mk
diff --git a/rjs/build/darwin/rjs.mk b/rjs/build/darwin/rjs.mk
new file mode 100644 (file)
index 0000000..16de9b5
--- /dev/null
@@ -0,0 +1,60 @@
+RLIB_SRCDIR = $(SRCDIR)/rlib
+RVM_SRCDIR = $(SRCDIR)/rvm
+RPA_SRCDIR = $(SRCDIR)/rpa
+RJS_SRCDIR = $(SRCDIR)/rjs
+RJS_LIB = $(OUTDIR)/librjs.a
+RJS_EXEC = $(OUTDIR)/rjsexec
+
+CFLAGS += -I$(SRCDIR)
+
+LIBS = -L$(RLIB_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RVM_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RPA_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RJS_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -lrjs -lrpa -lrvm -lrlib -lpthread -lm --static
+
+RJS_OBJECTS =  \
+       $(OUTDIR)/rjs.o \
+       $(OUTDIR)/rjsparser.o \
+       $(OUTDIR)/rjscompiler.o \
+       $(OUTDIR)/rjsrules.o \
+       $(OUTDIR)/ecma262.o \
+
+
+RJSEXEC_OBJECTS =      \
+       $(OUTDIR)/rjsexec.o \
+
+all: $(OUTDIR) $(RJS_LIB)
+
+$(RJS_EXEC) : $(RJSEXEC_OBJECTS) $(RJS_LIB) $(RJS_OBJECTS)
+       $(CC) $(ARCH) -o $@ $< $(LIBS)
+
+$(OUTDIR)/%.o: $(RJS_SRCDIR)/%.c
+       $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RJS_SRCDIR)/$*.c
+
+$(OUTDIR)/%.o: $(RJS_SRCDIR)/linux/%.c
+       $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RJS_SRCDIR)/linux/$*.c
+
+$(RJS_LIB): $(RJS_OBJECTS)
+       $(AR) -cr $@ $^
+
+$(RJS_SO): $(RJS_OBJECTS)
+       $(CC) $(LDFLAGS) -shared -Wl,-soname,librjs.so -o $@ $^
+
+$(OUTDIR)/%.o: $(RJS_SRCDIR)/%.rpa
+       $(LD) -r -b binary -o $(OUTDIR)/$*.o $(RJS_SRCDIR)/$*.rpa
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(RJS_LIB)
+       @rm -f $(RJS_SO)
+       @rm -f $(RJS_OBJECTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+
diff --git a/rlib/build/darwin/i386/Makefile b/rlib/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..0bafae4
--- /dev/null
@@ -0,0 +1,31 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else 
+ifeq ($(BLDCFG), profile)
+CFLAGS := -fPIC -O0 -pg -Wall 
+CFLAGS += -DR_DEBUG_MEMALLOC
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+CFLAGS += -DR_DEBUG_MEMALLOC
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+include $(SRCDIR)/build/$(OS)/include.mk
+include ../rlib.mk
diff --git a/rlib/build/darwin/rlib.mk b/rlib/build/darwin/rlib.mk
new file mode 100644 (file)
index 0000000..4a0325c
--- /dev/null
@@ -0,0 +1,62 @@
+RPATK_LIB_INSTALL=/usr/lib
+RLIB_SRCDIR = $(SRCDIR)/rlib
+RLIB_SO_VERSION = 2.0
+RLIB_SO_NAME = librlib.so
+RLIB_LIB = librlib.a
+RLIB_SO = $(RLIB_SO_NAME).$(RLIB_SO_VERSION)
+RLIB_LIB = librlib.a
+TARGET_RLIB_LIB = $(OUTDIR)/$(RLIB_LIB)
+TARGET_RLIB_SO = $(OUTDIR)/$(RLIB_SO)
+
+CFLAGS += -I$(SRCDIR)
+
+RLIB_OBJECTS +=        $(OUTDIR)/rref.o
+RLIB_OBJECTS +=        $(OUTDIR)/rcharconv.o
+RLIB_OBJECTS +=        $(OUTDIR)/robject.o
+RLIB_OBJECTS +=        $(OUTDIR)/rgc.o
+RLIB_OBJECTS +=        $(OUTDIR)/rmem.o
+RLIB_OBJECTS +=        $(OUTDIR)/rmath.o
+RLIB_OBJECTS +=        $(OUTDIR)/ratomic.o
+RLIB_OBJECTS +=        $(OUTDIR)/rspinlock.o
+RLIB_OBJECTS +=        $(OUTDIR)/rharray.o
+RLIB_OBJECTS +=        $(OUTDIR)/rcarray.o
+RLIB_OBJECTS +=        $(OUTDIR)/rarray.o
+RLIB_OBJECTS +=        $(OUTDIR)/rhash.o
+RLIB_OBJECTS +=        $(OUTDIR)/rmap.o
+RLIB_OBJECTS +=        $(OUTDIR)/rstring.o
+RLIB_OBJECTS +=        $(OUTDIR)/rlist.o
+RLIB_OBJECTS +=        $(OUTDIR)/rutf.o
+
+
+all: $(OUTDIR) $(TARGET_RLIB_LIB)
+
+
+
+$(OUTDIR)/%.o: $(RLIB_SRCDIR)/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RLIB_SRCDIR)/$*.c
+
+$(TARGET_RLIB_LIB): $(RLIB_OBJECTS)
+       $(AR) -cr $@ $^
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TARGET_RLIB_LIB)
+       @rm -f $(TARGET_RLIB_SO)
+       @rm -f $(RLIB_OBJECTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+
+install:
+       cp $(TARGET_RLIB_LIB) $(RPATK_LIB_INSTALL)
+       cp $(RLIB_SRCDIR)/*.h $(RPATK_INC_INSTALL)/rlib
+
+
+uninstall:
+       rm $(RPATK_LIB_INSTALL)/$(RLIB_LIB)
+       rm $(RPATK_INC_INSTALL)/rlib/*
diff --git a/rpa/build/darwin/i386/Makefile b/rpa/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..68f3657
--- /dev/null
@@ -0,0 +1,25 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+include ../../../../build/$(OS)/include.mk
+include ../rpa.mk
diff --git a/rpa/build/darwin/rpa.mk b/rpa/build/darwin/rpa.mk
new file mode 100644 (file)
index 0000000..789debb
--- /dev/null
@@ -0,0 +1,49 @@
+RPA_SRCDIR = $(SRCDIR)/rpa
+RPA_LIB = librpa.a
+RPA_SO_VERSION = 2.0
+RPA_SO_NAME = librpa.so
+RPA_SO = $(RPA_SO_NAME).$(RPA_SO_VERSION)
+TARGET_RPA_LIB = $(OUTDIR)/$(RPA_LIB)
+TARGET_RPA_SO = $(OUTDIR)/$(RPA_SO)
+
+CFLAGS += -I$(SRCDIR)
+
+RPA_OBJECTS =  \
+       $(OUTDIR)/rpacache.o \
+       $(OUTDIR)/rpadbex.o \
+       $(OUTDIR)/rpastat.o \
+       $(OUTDIR)/rparecord.o \
+       $(OUTDIR)/rpavm.o \
+       $(OUTDIR)/rpacompiler.o \
+       $(OUTDIR)/rpaparser.o \
+       $(OUTDIR)/rpaoptimization.o \
+
+all: $(OUTDIR) $(TARGET_RPA_LIB)
+
+$(OUTDIR)/%.o: $(RPA_SRCDIR)/%.c
+       $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RPA_SRCDIR)/$*.c
+
+$(TARGET_RPA_LIB): $(RPA_OBJECTS)
+       $(AR) -cr $@ $^
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TARGET_RPA_LIB)
+       @rm -f $(TARGET_RPA_SO)
+       @rm -f $(RPA_OBJECTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+
+install:
+       cp $(TARGET_RPA_LIB) $(RTK_LIB_INSTALL)
+       cp $(RPA_SRCDIR)/*.h $(RPATK_INC_INSTALL)/rpa
+
+uninstall:
+       rm $(RTK_LIB_INSTALL)/$(RPA_LIB)
+       rm $(RPATK_INC_INSTALL)/rpa/*
diff --git a/rvm/build/darwin/i386/Makefile b/rvm/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..ace6ca2
--- /dev/null
@@ -0,0 +1,30 @@
+SRCDIR = ../../../..
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+INCLUDE = -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+CC = gcc
+AR = ar
+LD = ld
+
+ifeq ($(BLDCFG), release)
+CFLAGS := -fPIC -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS := -fPIC -O0 -pg -Wall 
+else
+CFLAGS := -fPIC -O0 -g -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+
+CFLAGS += $(MACH) $(INCLUDE)
+LDFLAGS := $(MACH)
+
+include $(SRCDIR)/build/$(OS)/include.mk
+include ../rvm.mk
diff --git a/rvm/build/darwin/rvm.mk b/rvm/build/darwin/rvm.mk
new file mode 100644 (file)
index 0000000..821b5db
--- /dev/null
@@ -0,0 +1,76 @@
+RTK_LIB_INSTALL=/usr/lib
+RVM_SRCDIR = $(SRCDIR)/rvm
+RVM_SO_VERSION = 2.0
+RVM_SO_NAME = librvm.so
+RVM_LIB = librvm.a
+RVM_SO = $(RVM_SO_NAME).$(RVM_SO_VERSION)
+TARGET_RVM_LIB = $(OUTDIR)/$(RVM_LIB)
+TARGET_RVM_SO = $(OUTDIR)/$(RVM_SO)
+
+CFLAGS += -I$(SRCDIR)
+
+RVM_OBJECTS += $(OUTDIR)/rvmcpu.o 
+RVM_OBJECTS += $(OUTDIR)/rvmoperator.o
+RVM_OBJECTS += $(OUTDIR)/rvmcodemap.o
+RVM_OBJECTS += $(OUTDIR)/rvmrelocmap.o
+RVM_OBJECTS += $(OUTDIR)/rvmcodegen.o
+RVM_OBJECTS += $(OUTDIR)/rvmreg.o
+RVM_OBJECTS += $(OUTDIR)/rvmscope.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorbin.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatoradd.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorand.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatoreq.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatornoteq.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlogicor.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlogicand.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlogicnot.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorless.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlesseq.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorgreater.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorgreatereq.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorxor.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatoror.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorcmp.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorcmn.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlsl.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlsr.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorlsru.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorcast.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorcat.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatorsub.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatormul.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatordiv.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatormod.o
+RVM_OBJECTS += $(OUTDIR)/rvmoperatornot.o
+
+
+all: $(OUTDIR) $(TARGET_RVM_LIB)
+
+
+$(OUTDIR)/%.o: $(RVM_SRCDIR)/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$*.o -c $(RVM_SRCDIR)/$*.c
+
+$(TARGET_RVM_LIB): $(RVM_OBJECTS)
+       $(AR) -cr $@ $^
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TARGET_RVM_LIB)
+       @rm -f $(TARGET_RVM_SO)
+       @rm -f $(RVM_OBJECTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+
+install:
+       cp $(TARGET_RVM_LIB) $(RTK_LIB_INSTALL)
+       cp $(RVM_SRCDIR)/*.h $(RPATK_INC_INSTALL)/rvm
+
+uninstall:
+       rm $(RTK_LIB_INSTALL)/$(RVM_LIB)
+       rm $(RPATK_INC_INSTALL)/rvm/*
diff --git a/tests/testmisc/build/darwin/i386/Makefile b/tests/testmisc/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..d1ea48f
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../misc-tests.mk
diff --git a/tests/testmisc/build/darwin/misc-tests.mk b/tests/testmisc/build/darwin/misc-tests.mk
new file mode 100644 (file)
index 0000000..82f3b4a
--- /dev/null
@@ -0,0 +1,71 @@
+RLIB_SRCDIR = $(SRCDIR)/rlib
+RVM_SRCDIR = $(SRCDIR)/rvm
+RPA_SRCDIR = $(SRCDIR)/rpa
+RAST_SRCDIR = $(SRCDIR)/rast
+TESTS_SRCDIR = $(SRCDIR)/tests/testmisc
+INCLUDE = -I$(SRCDIR) -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR) -I$(RPA_SRCDIR)
+
+LIBS += -L$(RLIB_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RVM_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RPA_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -lrpa -lrvm -lrlib -lpthread -lm
+
+
+TESTS  += $(OUTDIR)/funcarg-test
+TESTS   += $(OUTDIR)/codegen-test
+TESTS   += $(OUTDIR)/codemap-test
+TESTS   += $(OUTDIR)/opmap-test
+TESTS   += $(OUTDIR)/string-test
+TESTS   += $(OUTDIR)/rlock-test
+TESTS   += $(OUTDIR)/rarray-test
+TESTS   += $(OUTDIR)/rcarray-test
+TESTS   += $(OUTDIR)/rharray-test
+TESTS   += $(OUTDIR)/rmap-test
+TESTS   += $(OUTDIR)/scope-test
+TESTS   += $(OUTDIR)/rhash-test
+TESTS   += $(OUTDIR)/rvm-test
+TESTS   += $(OUTDIR)/loop-test
+TESTS   += $(OUTDIR)/speed-test
+TESTS   += $(OUTDIR)/memalloc-test
+TESTS   += $(OUTDIR)/asm-cast
+TESTS   += $(OUTDIR)/asm-add
+TESTS   += $(OUTDIR)/asm-adds
+TESTS   += $(OUTDIR)/asm-b
+TESTS   += $(OUTDIR)/asm-bitops
+TESTS   += $(OUTDIR)/asm-callback
+TESTS   += $(OUTDIR)/asm-clz
+TESTS   += $(OUTDIR)/asm-cmp
+TESTS   += $(OUTDIR)/asm-div
+TESTS   += $(OUTDIR)/asm-loadstore
+TESTS   += $(OUTDIR)/asm-mul
+TESTS   += $(OUTDIR)/asm-sbc
+TESTS   += $(OUTDIR)/asm-shiftops
+TESTS   += $(OUTDIR)/asm-stack
+TESTS   += $(OUTDIR)/asm-bl
+TESTS   += $(OUTDIR)/asm-ecmp
+TESTS   += $(OUTDIR)/asm-esub
+TESTS   += $(OUTDIR)/asm-eadd
+
+
+all : $(OUTDIR) $(TESTS)
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LIBS) $(INCLUDE)
+
+
+$(OUTDIR)/%.o: $(TESTS_SRCDIR)/%.rpa
+       $(LD) -r -b binary -o $(OUTDIR)/$*.o $(TESTS_SRCDIR)/$*.rpa
+
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TESTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+
diff --git a/tests/testrjs/build/darwin/i386/Makefile b/tests/testrjs/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..d629c1d
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrjs.mk
diff --git a/tests/testrjs/build/darwin/testrjs.mk b/tests/testrjs/build/darwin/testrjs.mk
new file mode 100644 (file)
index 0000000..972fd90
--- /dev/null
@@ -0,0 +1,43 @@
+ROBJECT_SRCDIR = $(SRCDIR)/robject
+RLIB_SRCDIR = $(SRCDIR)/rlib
+RVM_SRCDIR = $(SRCDIR)/rvm
+RPA_SRCDIR = $(SRCDIR)/rpa
+RJS_SRCDIR = $(SRCDIR)/rjs
+TESTS_SRCDIR = $(SRCDIR)/tests/testrjs
+INCLUDE = -I$(SRCDIR) -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+LIBS =  -L$(ROBJECT_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RLIB_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RVM_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RJS_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RPA_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -lrjs -lrpa -lrvm -lrlib -lpthread -lm
+
+
+TESTS   += $(OUTDIR)/rjs-simple
+TESTS   += $(OUTDIR)/rjs-args
+
+
+all : $(OUTDIR) $(TESTS)
+
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c  $(LIBS) $(INCLUDE)
+
+
+$(OUTDIR)/%.o: $(TESTS_SRCDIR)/%.rpa
+       $(LD) -r -b binary -o $(OUTDIR)/$*.o $(TESTS_SRCDIR)/$*.rpa
+
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TESTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+
diff --git a/tests/testrpa/build/darwin/i386/Makefile b/tests/testrpa/build/darwin/i386/Makefile
new file mode 100644 (file)
index 0000000..1598920
--- /dev/null
@@ -0,0 +1,29 @@
+ARCHDIR = $(shell basename $(shell pwd))
+OUTDIR = out
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+SRCDIR = ../../../../..
+
+
+CC = gcc
+AR = ar
+ifeq ($(BLDCFG), release)
+CFLAGS = -O3
+else
+ifeq ($(BLDCFG), profile)
+CFLAGS = -O0 -pg
+else
+CFLAGS = -g -O0 -Wall 
+endif
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+CFLAGS += $(MACH) $(INCLUDE)
+
+CFLAGS := $(CFLAGS)
+LDFLAGS = $(MACH)
+
+
+include ../testrpa2.mk
diff --git a/tests/testrpa/build/darwin/testrpa2.mk b/tests/testrpa/build/darwin/testrpa2.mk
new file mode 100644 (file)
index 0000000..56fb2d3
--- /dev/null
@@ -0,0 +1,53 @@
+RLIB_SRCDIR = $(SRCDIR)/rlib
+RVM_SRCDIR = $(SRCDIR)/rvm
+RPA_SRCDIR = $(SRCDIR)/rpa
+TESTS_SRCDIR = $(SRCDIR)/tests/testrpa
+INCLUDE = -I$(SRCDIR) -I$(SRCDIR)/arch/$(OS)/$(ARCHDIR)
+
+
+LIBS = -L$(RLIB_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RVM_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -L$(RPA_SRCDIR)/build/$(OS)/$(ARCHDIR)/out 
+LIBS += -lrpa -lrvm -lrlib -lpthread -lm
+
+
+TESTS  += $(OUTDIR)/rpavm-matchchr
+TESTS  += $(OUTDIR)/rpavm-matchrng
+TESTS  += $(OUTDIR)/rpavm-mnode
+TESTS  += $(OUTDIR)/rpavm-ref
+;TESTS += $(OUTDIR)/rpacompiler-ruleloop
+;TESTS += $(OUTDIR)/rpacompiler-ruleloopcls
+TESTS  += $(OUTDIR)/rpacompiler-rulerec
+TESTS  += $(OUTDIR)/rpacompiler-rulealtrec
+TESTS  += $(OUTDIR)/rpacompiler-rule
+TESTS  += $(OUTDIR)/rpacompiler-exp
+TESTS  += $(OUTDIR)/rpacompiler-notexp
+TESTS  += $(OUTDIR)/rpacompiler-class
+TESTS  += $(OUTDIR)/rpacompiler-altexp
+TESTS  += $(OUTDIR)/rpacompiler-minusexp
+TESTS  += $(OUTDIR)/rpaparser-test
+
+
+all : $(OUTDIR) $(TESTS)
+
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c
+       + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c  -lrpa $(LIBS) $(INCLUDE)
+
+
+$(OUTDIR)/%.o: $(TESTS_SRCDIR)/%.rpa
+       $(LD) -r -b binary -o $(OUTDIR)/$*.o $(TESTS_SRCDIR)/$*.rpa
+
+
+$(OUTDIR):
+       @mkdir $(OUTDIR)
+
+distclean: clean
+       @rm -f .depend
+       @rm -rf $(OUTDIR)
+
+clean:
+       @rm -f $(TESTS)
+       @rm -f *~
+       @rm -f $(SRCDIR)/*~
+