Default build includes x86 disassembler

This commit is contained in:
pancake committed 2021-03-23 00:13:44 +01:00
1 parent 8897ce01e8
commit c3f761ff94
3 files changed
+34 -25

No files matched your search

+11 -5
View File
@@ -6,15 +6,24 @@ CFLAGS+=-O2 -Wall
PREFIX?=/usr/local
DESTDIR?=
ARCH=X32
# ARCH=ARM
# ARCH=NONE
all: r0 r0d
r0: r0.o
${CC} ${CFLAGS} r0.o -o r0
r0.o: calc.c cmd.c io.c util.c hexparse.c
$(CC) -c r0.c -DUSE_DISASM_$(ARCH)=1
r0d: r0d.o
${CC} ${CFLAGS} r0d.o -o r0d
r0.o: calc.c cmd.c io.c util.c hexparse.c
r0.js:
emcc -Os -o r0.js r0.c
emcc -DUSE_DISASM_X32=1 -Os -o r0.js r0.c
r0.arm:
$(CC) -DUSE_DISASM_ARM=1 r0.c -o r0.arm
@@ -35,9 +44,6 @@ r0.wasm:
r0.bc:
clang -emit-llvm -o r0.bc -c r0.c
r0: r0.o
${CC} ${CFLAGS} r0.o -o r0
dist:
@if [ -z "${VERSION}" ]; then echo "Try: make dist VERSION=0.5" ; exit 1 ; fi
git clone . r0-${VERSION}
+4 -4
View File
@@ -1,4 +1,4 @@
/* io.c - MIT - Copyleft 2009-2020 -- pancake */
/* io.c - MIT - Copyleft 2009-2021 -- pancake */
#ifndef HAVE_FTRUNCATE
#define HAVE_FTRUNCATE 1
@@ -8,7 +8,7 @@
#if DEMO
int bo = 0;
char b[4096];
static inline int io_open(char *file) {
static inline int io_open(const char *file) {
memset (b, 0, sizeof (b));
return 10;
}
@@ -29,7 +29,7 @@ static int io_seek (int x,int y) {
#include <windows.h>
static HANDLE _fd = NULL;
static inline int io_open(char *file) {
static inline int io_open(const char *file) {
_fd = CreateFile(file, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_ALWAYS, 0, NULL);
@@ -55,7 +55,7 @@ static inline int io_read(void *x, int y) {
#define _GNU_SOURCE
#include <fcntl.h>
static int _fd = -1;
static inline int io_open(char *file) {
static inline int io_open(const char *file) {
_fd = open(file, O_RDWR|O_CREAT, 0644);
if(_fd == -1) _fd = open(file, O_RDONLY);
return _fd;
+19 -16
View File
@@ -107,7 +107,7 @@ static int red_prompt() {
return red_cmd(at);
}
static int red_open(char *file) {
static int r0_open(const char *file) {
int ret = io_open(file);
if(ret != -1) {
oldseek = 0;
@@ -142,22 +142,25 @@ int main(int argc, char **argv) {
scriptn = 0;
scripts = malloc(sizeof(const char*)*argc);
cmds = malloc(sizeof(const char*)*argc);
if(argc>1 && argv[1])
for(i=1; i<argc; i++) {
if(argv[i] && argv[i][0]=='-')
switch(argv[i][1]) {
case 'q': earlyquit = 1; break;
case 'i': scripts[scriptn++] = argv[++i]; break;
case 'c': cmds[cmdn++] = argv[++i]; break;
case 'n': verbose = 0; break;
case 'v': puts(VERSION); ret = 0; break;
case 'h': ret = red_help(); break;
case 0x0: red_slurpin(); ret = 0; break;
} else {
if (!argv[i]) break;
ret = red_open(argv[i]);
if(argc>1 && argv[1]) {
for(i=1; i<argc; i++) {
if(argv[i] && argv[i][0]=='-')
switch(argv[i][1]) {
case 'q': earlyquit = 1; break;
case 'i': scripts[scriptn++] = argv[++i]; break;
case 'c': cmds[cmdn++] = argv[++i]; break;
case 'n': verbose = 0; break;
case 'v': puts(VERSION); ret = 0; break;
case 'h': ret = red_help(); break;
case 0x0: red_slurpin(); ret = 0; break;
} else {
if (!argv[i]) break;
ret = r0_open(argv[i]);
}
}
} else ret = red_help();
} else {
ret = red_help();
}
free(scripts);
return ret;
}