~kvik/lu9-lua

791422c1058d4973a6cb98ba17a4d1e2b276a41a — kvik 2 years ago 8831876
luac: make it compile and run
3 files changed, 24 insertions(+), 2 deletions(-)

M mkfile
M shim.c
M shim/shim.h
M mkfile => mkfile +6 -2
@@ 3,6 3,7 @@
CFLAGS=-FTV -p -Ishim -DLUA_USE_PLAN9 -DLUA_UCID

LIB=liblua.a.$O
LUAC=$O.luac

SHIMOBJS=\
	shim.$O\


@@ 46,13 47,16 @@ LIBOBJS=\

ALLOBJS=$SHIMOBJS $COREOBJS $LIBOBJS

all:V: $LIB
all:V: $LIB $LUAC

clean:V:
	rm -f *.[$OS] *.a.[$OS]
	rm -f *.[$OS] *.a.[$OS] [$OS].*

$LIB: $ALLOBJS
	ar cr $target $prereq

$O.%: %.$O $LIB
	$LD -o $target $prereq

%.$O: %.c
	$CC $CFLAGS $stem.c

M shim.c => shim.c +15 -0
@@ 19,3 19,18 @@ strerror(int)
	rerrstr(err, sizeof err);
	return err;
}

void
exit(int code)
{
	char *status;
	
	switch(code){
	case EXIT_SUCCESS:
		status = nil; break;
	case EXIT_FAILURE:
	default:
		status = "failure"; break;
	}
	exits(status);
}

M shim/shim.h => shim/shim.h +3 -0
@@ 100,6 100,9 @@ typedef unsigned long long size_t;
#include "/sys/include/stdio.h"

/** stdlib.h **/
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
void exit(int);

/** string.h **/
char *strerror(int);