--- /dev/null
+#ifndef _RTYPES_H_
+#define _RTYPES_H_
+
+/*
+ * Architecture dependent types. These types have to be redefined
+ * 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 rint64;
+typedef unsigned long ruint64;
+typedef unsigned long ruword;
+typedef long rword;
+typedef unsigned int ratomic_t;
+
+
+/*
+ * Common types. These types should be the same for most of the architectures.
+ */
+typedef int 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, res) \
+ do { res = __sync_val_compare_and_swap(ptr, oldval, newval); } while (0)
+
+#define R_ATOMIC_XCHG(ptr, val) \
+ do { val = __sync_lock_test_and_set(ptr, val); } while (0)
+
+#define R_ATOMIC_ADD(ptr, val, res) \
+ do { res = __sync_fetch_and_add(ptr, val); } while (0)
+
+#define R_ATOMIC_SUB(ptr, val, res) \
+ do { res = __sync_fetch_and_sub(ptr, val); } while (0)
+
+#define R_ATOMIC_GET(ptr, res) \
+ do { __sync_synchronize (); res = *ptr; } while (0)
+
+#define R_ATOMIC_SET(ptr, val) \
+ do { *ptr = val; __sync_synchronize (); } 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
+
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+SO_VERSION = 2.0
+BASENAME = librex
+LIB_NAME = $(BASENAME).a
+SO_NAME = $(BASENAME).so
+SO_NAME_VERSION = $(SO_NAME).$(SO_VERSION)
+LIB_TARGET = $(OUTDIR)/$(LIB_NAME)
+SO_TARGET = $(OUTDIR)/$(SO_NAME_VERSION)
+
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I$(ROOT_DIR)/arch/unix/$(ARCH)
+LIBS += -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+ifeq ($(OS), linux)
+all: $(LIB_TARGET) $(SO_TARGET)
+else
+all: $(LIB_TARGET)
+endif
+
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(LIB_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(AR) -cr $@ $^
+
+$(SO_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$(SO_NAME) -o $@ $^
+
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+REX_SRCDIR = $(ROOT_DIR)/rex
+EXE_NAME = rexcc
+EXE_TARGET = $(OUTDIR)/$(EXE_NAME)
+
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(REX_SRCDIR)
+LIBS = -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -L$(REX_SRCDIR)/unix/bin
+LIBS += -lrex -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+all: $(EXE_TARGET)
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(EXE_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+REX_SRCDIR = $(ROOT_DIR)/rex
+EXE_NAME = rexgrep
+EXE_TARGET = $(OUTDIR)/$(EXE_NAME)
+
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(REX_SRCDIR)
+
+LIBS = -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -L$(REX_SRCDIR)/unix/bin
+LIBS += -lrex -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+all: $(EXE_TARGET)
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(EXE_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
--- /dev/null
+/*
+ * Regular Pattern Analyzer Toolkit (RPA/Tk)
+ * Copyright (c) 2009-2012 Martin Stoilov
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Martin Stoilov <martin@rpasearch.com>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "rlib/rmem.h"
+#include "rjs/rjs.h"
+#include "rjs/rjsfile.h"
+#include "rpa/rparecord.h"
+
+
+static int debuginfo = 0;
+static int parseinfo = 0;
+static int compileonly = 0;
+static int debugcompileonly = 0;
+static int statinfo = 0;
+
+
+static char *errormsg[] = {
+ "OK",
+ "Undefined identifier",
+ "Syntax error",
+ "Not a function",
+ "Not a function call",
+ "Not a loop",
+ "Not a if statement",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+ "Unknown",
+};
+
+
+static void rjs_exec_ltrim(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+ const char *ptr, *list;
+ unsigned long size;
+ rvmreg_t *r = NULL, *l = NULL;
+ rstring_t *src, *dest;
+
+ if (RJS_SWI_PARAMS(cpu) == 0)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ r = (rvmreg_t *) RJS_SWI_PARAM(cpu, 1);
+ if (RJS_SWI_PARAMS(cpu) > 1) {
+ l = (rvmreg_t *) RJS_SWI_PARAM(cpu, 2);
+ if (rvm_reg_gettype(l) != RVM_DTYPE_STRING)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ }
+ if (rvm_reg_gettype(r) != RVM_DTYPE_STRING)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ if (l)
+ list = ((rstring_t *)RVM_REG_GETP(l))->s.str;
+ else
+ list = " \t\n\r\0";
+ src = (rstring_t *)RVM_REG_GETP(r);
+ ptr = src->s.str;
+ size = src->s.size;
+ while (size > 0) {
+ if (!r_strchr(list, *ptr))
+ break;
+ size--;
+ ptr++;
+ }
+ dest = r_string_create_strsize(ptr, size);
+ r_gc_add(cpu->gc, (robject_t*)dest);
+ rvm_reg_setstring(RVM_CPUREG_PTR(cpu, R0), dest);
+}
+
+
+static void rjs_exec_rtrim(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+ const char *ptr, *list;
+ unsigned long size;
+ rvmreg_t *r = NULL, *l = NULL;
+ rstring_t *src, *dest;
+
+ if (RJS_SWI_PARAMS(cpu) == 0)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ r = (rvmreg_t *) RJS_SWI_PARAM(cpu, 1);
+ if (RJS_SWI_PARAMS(cpu) > 1) {
+ l = (rvmreg_t *) RJS_SWI_PARAM(cpu, 2);
+ if (rvm_reg_gettype(l) != RVM_DTYPE_STRING)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ }
+ if (rvm_reg_gettype(r) != RVM_DTYPE_STRING)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ if (l)
+ list = ((rstring_t *)RVM_REG_GETP(l))->s.str;
+ else
+ list = " \t\n\r\0";
+ src = (rstring_t *)RVM_REG_GETP(r);
+ size = src->s.size;
+ ptr = src->s.str + size - 1;
+ while (size > 0) {
+ if (!r_strchr(list, *ptr))
+ break;
+ size--;
+ ptr--;
+ }
+ dest = r_string_create_strsize(src->s.str, size);
+ r_gc_add(cpu->gc, (robject_t*)dest);
+ rvm_reg_setstring(RVM_CPUREG_PTR(cpu, R0), dest);
+}
+
+
+static void rjs_exec_trim(rvmcpu_t *cpu, rvm_asmins_t *ins)
+{
+ const char *start, *ptr, *list;
+ unsigned long size;
+ rvmreg_t *r = NULL, *l = NULL;
+ rstring_t *src, *dest;
+
+ if (RJS_SWI_PARAMS(cpu) == 0)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+
+ r = (rvmreg_t *) RJS_SWI_PARAM(cpu, 1);
+ if (RJS_SWI_PARAMS(cpu) > 1) {
+ l = (rvmreg_t *) RJS_SWI_PARAM(cpu, 2);
+ if (rvm_reg_gettype(l) != RVM_DTYPE_STRING)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ }
+ if (rvm_reg_gettype(r) != RVM_DTYPE_STRING)
+ RJS_SWI_ABORT(rjs_engine_get(cpu), NULL);
+ if (l)
+ list = ((rstring_t *)RVM_REG_GETP(l))->s.str;
+ else
+ list = " \t\n\r\0";
+ src = (rstring_t *)RVM_REG_GETP(r);
+ ptr = src->s.str;
+ size = src->s.size;
+ while (size > 0) {
+ if (!r_strchr(list, *ptr))
+ break;
+ size--;
+ ptr++;
+ }
+ start = ptr;
+ ptr = start + size - 1;
+ while (size > 0) {
+ if (!r_strchr(list, *ptr))
+ break;
+ size--;
+ ptr--;
+ }
+ dest = r_string_create_strsize(start, size);
+ r_gc_add(cpu->gc, (robject_t*)dest);
+ rvm_reg_setstring(RVM_CPUREG_PTR(cpu, R0), dest);
+}
+
+
+static rvm_switable_t swistring[] = {
+ {"ltrim", rjs_exec_ltrim},
+ {"rtrim", rjs_exec_rtrim},
+ {"trim", rjs_exec_trim},
+ {NULL, NULL},
+};
+
+
+int rjs_exec_script(rjs_engine_t *jse, rstr_t *script)
+{
+ if (!script)
+ return -1;
+ if (parseinfo) {
+ rjs_engine_dumpast(jse, script->str, script->size);
+ } else if (debugcompileonly) {
+ int res = 0;
+ jse->debugcompile = 1;
+ res = rjs_engine_compile(jse, script->str, script->size);
+ jse->debugcompile = 0;
+ if (res < 0)
+ return -1;
+ } else if (compileonly) {
+ if (rjs_engine_compile(jse, script->str, script->size) < 0)
+ return -1;
+ } else {
+ if (rjs_engine_compile(jse, script->str, script->size) < 0)
+ return -1;
+ if (rjs_engine_run(jse) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
+
+long jrs_offset2line(const char *script, long offset)
+{
+ long line = 0;
+ const char *ptr;
+
+ for (line = 1, ptr = script + offset; ptr >= script; --ptr) {
+ if (*ptr == '\n')
+ line += 1;
+ }
+
+ return line;
+}
+
+
+void rjs_display_errors(rjs_engine_t *jse, rstr_t *script)
+{
+ unsigned long i;
+ rjs_error_t *err;
+
+ for (i = 0; i < r_array_length(jse->errors); i++) {
+ err = (rjs_error_t *)r_array_slot(jse->errors, i);
+ fprintf(stdout, "Line: %ld (%ld, %ld), Error Code: %ld, ", (long)err->line, err->offset, err->lineoffset, err->error);
+ fprintf(stdout, "%s: ", errormsg[err->error]);
+ if (err->size) {
+ fwrite(script->str + err->offset, sizeof(char), err->size, stdout);
+ } else {
+ fwrite(script->str + err->lineoffset, sizeof(char), err->offset - err->lineoffset, stdout);
+ }
+ fprintf(stdout, "\n");
+ }
+}
+
+
+int usage(int argc, char *argv[])
+{
+ fprintf(stderr, "RJS with RPA Engine: %s \n", rpa_dbex_version());
+ fprintf(stderr, "Copyright (C) 2010 Martin Stoilov\n\n");
+
+ fprintf(stderr, "\t-e <script_expression> Run the script supplied on the command line. Example: -e \"print('hello');\"\n");
+ fprintf(stderr, "\t-f <script_file> Run the script file.\n");
+ fprintf(stderr, "\t-p Display rules parsing records.\n");
+ fprintf(stderr, "\t-d Execute in debug mode.\n");
+ fprintf(stderr, "\t-c Compile the script, without running it.\n");
+ fprintf(stderr, "\t-C Compile the script, showing the compile info, without running it.\n");
+ fprintf(stderr, "\t-h, --help Display this help.\n");
+ return 0;
+}
+
+
+int main(int argc, char *argv[])
+{
+ int i;
+ rstr_t *script = NULL, *unmapscript = NULL;
+ rstr_t line;
+ rjs_engine_t *jse;
+
+ if (argc == 1) {
+ usage(argc, argv);
+ return 1;
+ }
+
+ for (i = 1; i < argc; i++) {
+ if (r_strcmp(argv[i], "--help") == 0 || r_strcmp(argv[i], "-help") == 0 || r_strcmp(argv[i], "/?") == 0 || r_strcmp(argv[i], "-h") == 0) {
+ usage(argc, argv);
+ return 1;
+ }
+ }
+
+ jse = rjs_engine_create();
+ if (!jse)
+ return 1;
+ if (rjs_engine_addswitable(jse, "string", swistring) < 0) {
+ return 2;
+ }
+ for (i = 1; i < argc; i++) {
+ if (r_strcmp(argv[i], "-L") == 0) {
+
+ } else if (r_strcmp(argv[i], "-d") == 0) {
+ debuginfo = 1;
+ jse->debugexec = 1;
+ } else if (r_strcmp(argv[i], "-p") == 0) {
+ parseinfo = 1;
+ } else if (r_strcmp(argv[i], "-C") == 0) {
+ debugcompileonly = 1;
+ } else if (r_strcmp(argv[i], "-c") == 0) {
+ compileonly = 1;
+ } else if (r_strcmp(argv[i], "-t") == 0) {
+ statinfo = 1;
+ }
+ }
+
+ for (i = 1; i < argc; i++) {
+ if (r_strcmp(argv[i], "-e") == 0) {
+ if (++i < argc) {
+ line.str = argv[i];
+ line.size = r_strlen(argv[i]);
+ script = &line;
+ }
+ if (rjs_exec_script(jse, script) < 0)
+ goto end;
+ }
+ }
+
+ for (i = 1; i < argc; i++) {
+ if (r_strcmp(argv[i], "-f") == 0) {
+ if (++i < argc) {
+ script = rjs_file_map(argv[i]);
+ if (script) {
+ unmapscript = script;
+ }
+ }
+ if (rjs_exec_script(jse, script) < 0)
+ goto end;
+ }
+ }
+
+end:
+ if (jse && r_array_length(jse->errors))
+ rjs_display_errors(jse, script);
+ rjs_engine_destroy(jse);
+ if (unmapscript)
+ rjs_file_unmap(unmapscript);
+ if (statinfo)
+ fprintf(stdout, "\nRJS Version: %s, memory: %ld Bytes (leaked %ld Bytes)\n", rjs_version(), (long)r_debug_get_maxmem(), (long)r_debug_get_allocmem());
+ return 0;
+}
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+SO_VERSION = 2.0
+BASENAME = librjs
+LIB_NAME = $(BASENAME).a
+SO_NAME = $(BASENAME).so
+SO_NAME_VERSION = $(SO_NAME).$(SO_VERSION)
+LIB_TARGET = $(OUTDIR)/$(LIB_NAME)
+SO_TARGET = $(OUTDIR)/$(SO_NAME_VERSION)
+EXE_TARGET = $(OUTDIR)/rjsexec
+
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+RVM_SRCDIR = $(ROOT_DIR)/rvm
+RPA_SRCDIR = $(ROOT_DIR)/rpa
+RJS_SRCDIR = $(ROOT_DIR)/rjs
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RVM_SRCDIR) -I$(RLIB_SRCDIR)
+LIBS += -L$(RLIB_SRCDIR)/unix/bin -L$(RVM_SRCDIR)/unix/bin -L$(RLIB_SRCDIR)/unix/bin -L$(RPA_SRCDIR)/unix/bin -L$(RJS_SRCDIR)/unix/bin -lrjs -lrpa -lrvm -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+ELFARCH = elf64-x86-64
+BINARCH = i386:x86-64
+OCFLAGS_TXT = --input binary --output $(ELFARCH) --binary-architecture $(BINARCH)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+OBJECTS += $(OUTDIR)/ecma262.o
+RJSEXEC_OBJECTS = $(OUTDIR)/rjsexec.o \
+
+
+ifeq ($(OS), linux)
+all: $(LIB_TARGET) $(SO_TARGET) $(EXE_TARGET)
+else
+all: $(LIB_TARGET)
+endif
+
+$(EXE_TARGET) : $(RJSEXEC_OBJECTS)
+ $(CC) -o $@ $^ $(LDFLAGS) -static
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(OUTDIR)/%.o: ../exec/%.c | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(LIB_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(AR) -cr $@ $^
+
+$(OUTDIR)/%.o: ../%.rpa
+ $(OBJCOPY) $(OCFLAGS_TXT) $< $(OUTDIR)/$*.o
+
+$(SO_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) -o $@ $^ -shared -Wl,-soname,$(SO_NAME)
+
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+SO_VERSION = 2.0
+BASENAME = rlib
+LIB_NAME = lib$(BASENAME).a
+SO_NAME = lib$(BASENAME).so
+SO_NAME_VERSION = $(SO_NAME).$(SO_VERSION)
+LIB_TARGET = $(OUTDIR)/$(LIB_NAME)
+SO_TARGET = $(OUTDIR)/$(SO_NAME_VERSION)
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I$(ROOT_DIR)/arch/unix/$(ARCH)
+
+LIBS += -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+
+ifeq ($(OS), linux)
+all: $(LIB_TARGET) $(SO_TARGET)
+else
+all: $(LIB_TARGET)
+endif
+
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(LIB_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(AR) -cr $@ $^
+
+$(SO_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$(SO_NAME) -o $@ $^
+
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+RVM_SRCDIR = $(ROOT_DIR)/rvm
+SO_VERSION = 2.0
+BASENAME = librpa
+LIB_NAME = $(BASENAME).a
+SO_NAME = $(BASENAME).so
+SO_NAME_VERSION = $(SO_NAME).$(SO_VERSION)
+LIB_TARGET = $(OUTDIR)/$(LIB_NAME)
+SO_TARGET = $(OUTDIR)/$(SO_NAME_VERSION)
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RVM_SRCDIR) -I$(RLIB_SRCDIR)
+
+LIBS += -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+
+ifeq ($(OS), linux)
+all: $(LIB_TARGET) $(SO_TARGET)
+else
+all: $(LIB_TARGET)
+endif
+
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(LIB_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(AR) -cr $@ $^
+
+$(SO_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$(SO_NAME) -o $@ $^
+
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+RVM_SRCDIR = $(ROOT_DIR)/rvm
+RPA_SRCDIR = $(ROOT_DIR)/rpa
+
+EXE_NAME = rpagrep
+EXE_TARGET = $(OUTDIR)/$(EXE_NAME)
+
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(RVM_SRCDIR) -I$(RPA_SRCDIR)
+
+LIBS = -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -L$(RVM_SRCDIR)/unix/bin
+LIBS += -L$(RPA_SRCDIR)/unix/bin
+LIBS += -lrpa -lrvm -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+all: $(EXE_TARGET)
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(EXE_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+SO_VERSION = 2.0
+BASENAME = rvm
+LIB_NAME = lib$(BASENAME).a
+SO_NAME = lib$(BASENAME).so
+SO_NAME_VERSION = $(SO_NAME).$(SO_VERSION)
+LIB_TARGET = $(OUTDIR)/$(LIB_NAME)
+SO_TARGET = $(OUTDIR)/$(SO_NAME_VERSION)
+CFLAGS += -fPIC
+CFLAGS += -I$(ROOT_DIR) -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR)
+
+LIBS += -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+
+ifeq ($(OS), linux)
+all: $(LIB_TARGET) $(SO_TARGET)
+else
+all: $(LIB_TARGET)
+endif
+
+
+$(OUTDIR)/%.o: %.c Makefile | $(OUTDIR)
+ $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(OUTDIR)/$(notdir $(<:.c=.lst)) $< -o $@
+
+$(LIB_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(AR) -cr $@ $^
+
+$(SO_TARGET): $(OBJECTS) | $(OUTDIR)
+ $(CC) $(LDFLAGS) -shared -Wl,-soname,$(SO_NAME) -o $@ $^
+
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
--- /dev/null
+ROOT_DIR = ../../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+TESTS_SRCDIR = ..
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+RVM_SRCDIR = $(ROOT_DIR)/rvm
+RPA_SRCDIR = $(ROOT_DIR)/rpa
+
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(RVM_SRCDIR) -I$(RPA_SRCDIR)
+
+LIBS = -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -L$(RVM_SRCDIR)/unix/bin
+LIBS += -L$(RPA_SRCDIR)/unix/bin
+LIBS += -lrpa -lrvm -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+TESTS += $(OUTDIR)/funcarg-test
+TESTS += $(OUTDIR)/codegen-test
+TESTS += $(OUTDIR)/codemap-test
+TESTS += $(OUTDIR)/rlock-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-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
+
+ETESTS += $(OUTDIR)/asm-ecmp
+ETESTS += $(OUTDIR)/asm-esub
+ETESTS += $(OUTDIR)/asm-eadd
+ETESTS += $(OUTDIR)/rarray-test
+ETESTS += $(OUTDIR)/rcarray-test
+ETESTS += $(OUTDIR)/rharray-test
+ETESTS += $(OUTDIR)/rmap-test
+ETESTS += $(OUTDIR)/string-test
+ETESTS += $(OUTDIR)/opmap-test
+ETESTS += $(OUTDIR)/asm-cast
+
+all: $(TESTS)
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c Makefile | bin
+ + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LIBS) $(LDFLAGS) $(INCLUDE)
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ../../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+TESTS_SRCDIR = ..
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+REX_SRCDIR = $(ROOT_DIR)/rex
+EXE_NAME = rpagrep
+EXE_TARGET = $(OUTDIR)/$(EXE_NAME)
+
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(REX_SRCDIR)
+
+LIBS = -L$(REX_SRCDIR)/unix/bin
+LIBS += -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -lrex -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+ifeq ($(OS), linux)
+LDFLAGS += --static
+endif
+
+
+TESTS += $(OUTDIR)/main
+TESTS += $(OUTDIR)/rexregex
+
+all: $(TESTS)
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c Makefile | bin
+ + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LDFLAGS) $(INCLUDE)
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ../../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+TESTS_SRCDIR = ..
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+RVM_SRCDIR = $(ROOT_DIR)/rvm
+RPA_SRCDIR = $(ROOT_DIR)/rpa
+RJS_SRCDIR = $(ROOT_DIR)/rjs
+
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(RVM_SRCDIR) -I$(RPA_SRCDIR) -I$(RJS_SRCDIR)
+
+
+ifeq ($(DEBUG), no)
+CFLAGS += -O2
+else
+CFLAGS += -O0 -g
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+LIBS = -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -L$(RVM_SRCDIR)/unix/bin
+LIBS += -L$(RPA_SRCDIR)/unix/bin
+LIBS += -L$(RJS_SRCDIR)/unix/bin
+LIBS += -lrjs -lrpa -lrvm -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+TESTS += $(OUTDIR)/rjs-simple
+TESTS += $(OUTDIR)/rjs-args
+
+
+all: $(TESTS)
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c Makefile | bin
+ + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LIBS) $(LDFLAGS) $(INCLUDE)
+
+$(OUTDIR)/%.o: $(TESTS_SRCDIR)/%.rpa
+ $(LD) -r -b binary -o $(OUTDIR)/$*.o $(TESTS_SRCDIR)/$*.rpa
+
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ../../..
+include $(ROOT_DIR)/unix/config.mk
+
+OUTDIR = bin
+TESTS_SRCDIR = ..
+RLIB_SRCDIR = $(ROOT_DIR)/rlib
+RVM_SRCDIR = $(ROOT_DIR)/rvm
+RPA_SRCDIR = $(ROOT_DIR)/rpa
+
+CFLAGS += -I$(ROOT_DIR) -I.. -I../unix -I$(ROOT_DIR)/arch/unix/$(ARCH) -I$(RLIB_SRCDIR) -I$(RVM_SRCDIR) -I$(RPA_SRCDIR)
+
+
+ifeq ($(DEBUG), no)
+CFLAGS += -O2
+else
+CFLAGS += -O0 -g
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+LIBS = -L$(RLIB_SRCDIR)/unix/bin
+LIBS += -L$(RVM_SRCDIR)/unix/bin
+LIBS += -L$(RPA_SRCDIR)/unix/bin
+LIBS += -lrpa -lrvm -lrlib -lpthread -lm
+LDFLAGS += $(LIBS)
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard ../*.c))))
+vpath %.c ../
+
+OBJECTS += $(addprefix $(OUTDIR)/, $(patsubst %.c,%.o,$(notdir $(wildcard *.c))))
+vpath %.c .
+
+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
+TESTS += $(OUTDIR)/postfix
+
+
+all: $(TESTS)
+
+$(OUTDIR)/%: $(TESTS_SRCDIR)/%.c Makefile | bin
+ + $(CC) $(CFLAGS) -o $(OUTDIR)/$* $(TESTS_SRCDIR)/$*.c $(LIBS) $(LDFLAGS) $(INCLUDE)
+
+$(OUTDIR):
+ mkdir $@
+
+
+clean:
+ -rm -f *~
+ -rm -rf $(OUTDIR)
+
--- /dev/null
+ROOT_DIR = ..
+include $(ROOT_DIR)/unix/config.mk
+
+all:
+ +make -C $(ROOT_DIR)/rlib/unix all
+ +make -C $(ROOT_DIR)/rpa/unix all
+ +make -C $(ROOT_DIR)/rvm/unix all
+ +make -C $(ROOT_DIR)/rex/unix all
+ +make -C $(ROOT_DIR)/rpagrep/unix all
+ +make -C $(ROOT_DIR)/rexgrep/unix all
+ +make -C $(ROOT_DIR)/rexcc/unix all
+ +make -C $(ROOT_DIR)/tests/testmisc/unix all
+ +make -C $(ROOT_DIR)/tests/testrex/unix all
+ +make -C $(ROOT_DIR)/tests/testrpa/unix all
+
+clean:
+ +make -C $(ROOT_DIR)/rlib/unix clean
+ +make -C $(ROOT_DIR)/rpa/unix clean
+ +make -C $(ROOT_DIR)/rvm/unix clean
+ +make -C $(ROOT_DIR)/rex/unix clean
+ +make -C $(ROOT_DIR)/tests/testmisc/unix clean
+ +make -C $(ROOT_DIR)/tests/testrpa/unix clean
+ +make -C $(ROOT_DIR)/tests/testrex/unix clean
+ +make -C $(ROOT_DIR)/tests/testrjs/unix clean
+ +make -C $(ROOT_DIR)/rpagrep/unix clean
+ +make -C $(ROOT_DIR)/rexgrep/unix clean
+ +make -C $(ROOT_DIR)/rexcc/unix clean
+ +make -C $(ROOT_DIR)/rexcc/unix clean
+ +make -C $(ROOT_DIR)/rjs/unix clean
+
+
+$(RPATK_BIN_INSTALL) :
+ mkdir -p $(RPATK_BIN_INSTALL)
+
+$(RPATK_LIB_INSTALL) :
+ mkdir -p $(RPATK_LIB_INSTALL)
+
+$(RPATK_INC_INSTALL) :
+ mkdir -p $(RPATK_INC_INSTALL)
+
+$(RPATK_INC_INSTALL)/rlib :
+ mkdir -p $(RPATK_INC_INSTALL)/rlib
+
+$(RPATK_INC_INSTALL)/rvm :
+ mkdir -p $(RPATK_INC_INSTALL)/rvm
+
+$(RPATK_INC_INSTALL)/rpa :
+ mkdir -p $(RPATK_INC_INSTALL)/rpa
+
+$(RPATK_INC_INSTALL)/rex :
+ mkdir -p $(RPATK_INC_INSTALL)/rex
+
+install: $(RPATK_INC_INSTALL) $(RPATK_BIN_INSTALL) $(RPATK_LIB_INSTALL) $(RPATK_INC_INSTALL)/rlib $(RPATK_INC_INSTALL)/rvm $(RPATK_INC_INSTALL)/rpa $(RPATK_INC_INSTALL)/rex
+ cp $(ROOT_DIR)/arch/unix/rtypes.h $(RPATK_INC_INSTALL)
+ cp $(ROOT_DIR)/rlib/unix/bin/*.a $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rlib/unix/bin/*.so.* $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rlib/*.h $(RPATK_INC_INSTALL)/rlib
+ cp $(ROOT_DIR)/rvm/unix/bin/*.a $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rvm/unix/bin/*.so.* $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rvm/*.h $(RPATK_INC_INSTALL)/rvm
+ cp $(ROOT_DIR)/rpa/unix/bin/*.a $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rpa/unix/bin/*.so.* $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rpa/*.h $(RPATK_INC_INSTALL)/rpa
+ cp $(ROOT_DIR)/rex/unix/bin/*.a $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rex/unix/bin/*.so.* $(RPATK_LIB_INSTALL)
+ cp $(ROOT_DIR)/rex/*.h $(RPATK_INC_INSTALL)/rex
+ cp $(ROOT_DIR)/rpagrep/unix/bin/rpagrep $(RPATK_BIN_INSTALL)
+ cp $(ROOT_DIR)/rexgrep/unix/bin/rexgrep $(RPATK_BIN_INSTALL)
+ cp $(ROOT_DIR)/rexcc/unix/bin/rexcc $(RPATK_BIN_INSTALL)
+
+
+ifeq ($(RPATK_LDCONFIG), 1)
+ ldconfig -n $(RPATK_LIB_INSTALL)
+endif
+
+
+uninstall:
+ -rm -rf $(RPATK_BIN_INSTALL)/rpagrep
+ -rm -rf $(RPATK_BIN_INSTALL)/rexgrep
+ -rm -rf $(RPATK_BIN_INSTALL)/rexcc
+ -rm -rf $(RPATK_LIB_INSTALL)/librlib.*
+ -rm -rf $(RPATK_LIB_INSTALL)/librex.*
+ -rm -rf $(RPATK_LIB_INSTALL)/librvm.*
+ -rm -rf $(RPATK_LIB_INSTALL)/librpa.*
+ -rm -rf $(RPATK_LIB_INSTALL)/rlib
+ -rm -rf $(RPATK_LIB_INSTALL)/rvm
+ -rm -rf $(RPATK_LIB_INSTALL)/rpa
+ -rm -rf $(RPATK_LIB_INSTALL)/rex
+ -rm -rf $(RPATK_INC_INSTALL)/rlib
+ -rm -rf $(RPATK_INC_INSTALL)/rvm
+ -rm -rf $(RPATK_INC_INSTALL)/rpa
+ -rm -rf $(RPATK_INC_INSTALL)/rex
+ -rm -rf $(RPATK_INC_INSTALL)
--- /dev/null
+ifndef RPATK_BIN_INSTALL
+RPATK_BIN_INSTALL = ${RPATK_INSTALL_PREFIX}/usr/bin
+endif
+
+ifndef RPATK_LIB_INSTALL
+RPATK_LIB_INSTALL = ${RPATK_INSTALL_PREFIX}/usr/lib/rpatk
+endif
+
+ifndef RPATK_INC_INSTALL
+RPATK_INC_INSTALL = ${RPATK_INSTALL_PREFIX}/usr/include/rpatk
+endif
+
+DEBUG ?= yes
+ARCH ?= x86_64
+OS = $(shell uname | tr "[:upper:]" "[:lower:]")
+
+ifeq ($(DEBUG), no)
+CFLAGS += -O2
+else
+CFLAGS += -O0 -g
+endif
+
+ifeq ($(CCBLD), yes)
+CFLAGS += -fprofile-arcs -ftest-coverage
+endif
+
+
+# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
+# either it can be added to the PATH environment variable.
+ifdef GCC_PATH
+CPP = $(GCC_PATH)/$(PREFIX)g++
+CC = $(GCC_PATH)/$(PREFIX)gcc
+AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
+AR = $(GCC_PATH)/$(PREFIX)ar
+LD = $(GCC_PATH)/$(PREFIX)ld
+OBJCOPY = $(GCC_PATH)/$(PREFIX)objcopy
+else
+CPP = $(PREFIX)g++
+CC = $(PREFIX)gcc
+AS = $(PREFIX)gcc -x assembler-with-cpp
+AR = $(PREFIX)ar
+LD = $(PREFIX)ld
+OBJCOPY = $(PREFIX)objcopy
+endif
+