Tested the engine on linux
This commit is contained in:
@@ -14,8 +14,8 @@ ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN)
|
|||||||
LIBLINE =-Wl,--out-implib=$(CORE_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
LIBLINE =-Wl,--out-implib=$(CORE_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
||||||
OUT=$(CORE_OUTDIR)/$(OUTNAME).dll
|
OUT=$(CORE_OUTDIR)/$(OUTNAME).dll
|
||||||
else ifeq ($(shell uname),Linux)
|
else ifeq ($(shell uname),Linux)
|
||||||
LIBLINE=-Wl,--out-implib=../$(CORE_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
LIBLINE=-Wl,--out-implib=./$(CORE_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
||||||
OUT=../$(CORE_OUTDIR)/lib$(OUTNAME).so
|
OUT=./$(CORE_OUTDIR)/lib$(OUTNAME).so
|
||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
else ifeq ($(OS),Windows_NT)
|
else ifeq ($(OS),Windows_NT)
|
||||||
LIBLINE =-Wl,--out-implib=$(CORE_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
LIBLINE =-Wl,--out-implib=$(CORE_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
||||||
|
|||||||
6
makefile
6
makefile
@@ -5,7 +5,13 @@ export CORE_OUTDIR = ../$(LIBDIR)
|
|||||||
|
|
||||||
all: $(OUTDIR) $(LIBDIR) toy core
|
all: $(OUTDIR) $(LIBDIR) toy core
|
||||||
$(MAKE) -C source
|
$(MAKE) -C source
|
||||||
|
ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN)
|
||||||
cp $(LIBDIR)/*.dll $(OUTDIR)
|
cp $(LIBDIR)/*.dll $(OUTDIR)
|
||||||
|
else ifeq ($(shell uname),Linux)
|
||||||
|
cp $(LIBDIR)/*.so $(OUTDIR)
|
||||||
|
else ifeq ($(OS),Windows_NT)
|
||||||
|
cp $(LIBDIR)/*.dll $(OUTDIR)
|
||||||
|
endif
|
||||||
|
|
||||||
toy: $(LIBDIR)
|
toy: $(LIBDIR)
|
||||||
$(MAKE) -C Toy/source
|
$(MAKE) -C Toy/source
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o))
|
|||||||
OUT=../$(OUTDIR)/airport
|
OUT=../$(OUTDIR)/airport
|
||||||
|
|
||||||
all: $(OBJ)
|
all: $(OBJ)
|
||||||
$(CC) $(CFLAGS) -o $(OUT) $(OBJ) -L../$(LIBDIR) $(LIBS)
|
$(CC) $(CFLAGS) -o $(OUT) $(OBJ) -Wl,-rpath,. -L../$(LIBDIR) $(LIBS)
|
||||||
|
|
||||||
$(OBJ): | $(ODIR)
|
$(OBJ): | $(ODIR)
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ OBJ = $(addprefix $(ODIR)/,$(TARGETS:../core/%.c=%.o)) $(addprefix $(ODIR)/,$(TE
|
|||||||
all: $(OBJ) $(TESTS:%.c=../$(OUTDIR)/%.exe)
|
all: $(OBJ) $(TESTS:%.c=../$(OUTDIR)/%.exe)
|
||||||
|
|
||||||
../$(OUTDIR)/%.exe: $(ODIR)/%.o
|
../$(OUTDIR)/%.exe: $(ODIR)/%.o
|
||||||
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS)
|
|
||||||
cp ../$(LIBDIR)/*.dll ../$(OUTDIR)
|
|
||||||
ifeq ($(shell uname),Linux)
|
ifeq ($(shell uname),Linux)
|
||||||
|
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -Wl,-rpath,../out -L../$(LIBDIR) $(LIBS)
|
||||||
|
cp ../$(LIBDIR)/*.so ../$(OUTDIR)
|
||||||
valgrind --leak-check=full --track-origins=yes $@
|
valgrind --leak-check=full --track-origins=yes $@
|
||||||
else
|
else
|
||||||
|
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS)
|
||||||
|
cp ../$(LIBDIR)/*.dll ../$(OUTDIR)
|
||||||
$@
|
$@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
//suppress the print keyword
|
||||||
|
static void noPrintFn(const char* output) {
|
||||||
|
//NO OP
|
||||||
|
}
|
||||||
|
|
||||||
//compilation functions
|
//compilation functions
|
||||||
char* readFile(char* path, size_t* fileSize) {
|
char* readFile(char* path, size_t* fileSize) {
|
||||||
FILE* file = fopen(path, "rb");
|
FILE* file = fopen(path, "rb");
|
||||||
@@ -87,6 +92,7 @@ int main() {
|
|||||||
//setup interpreter
|
//setup interpreter
|
||||||
Interpreter interpreter;
|
Interpreter interpreter;
|
||||||
initInterpreter(&interpreter);
|
initInterpreter(&interpreter);
|
||||||
|
setInterpreterPrint(&interpreter, noPrintFn);
|
||||||
|
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
@@ -113,6 +119,7 @@ int main() {
|
|||||||
//setup interpreter
|
//setup interpreter
|
||||||
Interpreter interpreter;
|
Interpreter interpreter;
|
||||||
initInterpreter(&interpreter);
|
initInterpreter(&interpreter);
|
||||||
|
setInterpreterPrint(&interpreter, noPrintFn);
|
||||||
|
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
@@ -134,6 +141,8 @@ int main() {
|
|||||||
resetInterpreter(&interpreter);
|
resetInterpreter(&interpreter);
|
||||||
|
|
||||||
pushEngineNode(&node, &child);
|
pushEngineNode(&node, &child);
|
||||||
|
|
||||||
|
free((void*)source);
|
||||||
}
|
}
|
||||||
|
|
||||||
//test the calls
|
//test the calls
|
||||||
|
|||||||
Reference in New Issue
Block a user