diff --git a/core/makefile b/core/makefile index 97835d8..a387513 100644 --- a/core/makefile +++ b/core/makefile @@ -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 OUT=$(CORE_OUTDIR)/$(OUTNAME).dll else ifeq ($(shell uname),Linux) - LIBLINE=-Wl,--out-implib=../$(CORE_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive - OUT=../$(CORE_OUTDIR)/lib$(OUTNAME).so + LIBLINE=-Wl,--out-implib=./$(CORE_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive + OUT=./$(CORE_OUTDIR)/lib$(OUTNAME).so CFLAGS += -fPIC 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 diff --git a/makefile b/makefile index 9c4df5c..be548f5 100644 --- a/makefile +++ b/makefile @@ -5,7 +5,13 @@ export CORE_OUTDIR = ../$(LIBDIR) all: $(OUTDIR) $(LIBDIR) toy core $(MAKE) -C source +ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN) 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) $(MAKE) -C Toy/source diff --git a/source/makefile b/source/makefile index afa9f4c..0f6882d 100644 --- a/source/makefile +++ b/source/makefile @@ -11,7 +11,7 @@ OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o)) OUT=../$(OUTDIR)/airport all: $(OBJ) - $(CC) $(CFLAGS) -o $(OUT) $(OBJ) -L../$(LIBDIR) $(LIBS) + $(CC) $(CFLAGS) -o $(OUT) $(OBJ) -Wl,-rpath,. -L../$(LIBDIR) $(LIBS) $(OBJ): | $(ODIR) diff --git a/test/makefile b/test/makefile index 851fc91..5721d57 100644 --- a/test/makefile +++ b/test/makefile @@ -14,11 +14,13 @@ OBJ = $(addprefix $(ODIR)/,$(TARGETS:../core/%.c=%.o)) $(addprefix $(ODIR)/,$(TE all: $(OBJ) $(TESTS:%.c=../$(OUTDIR)/%.exe) ../$(OUTDIR)/%.exe: $(ODIR)/%.o - @$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS) - cp ../$(LIBDIR)/*.dll ../$(OUTDIR) 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 $@ else + @$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS) + cp ../$(LIBDIR)/*.dll ../$(OUTDIR) $@ endif diff --git a/test/test_engine_node.c b/test/test_engine_node.c index fefaf60..59fe058 100644 --- a/test/test_engine_node.c +++ b/test/test_engine_node.c @@ -10,6 +10,11 @@ #include #include +//suppress the print keyword +static void noPrintFn(const char* output) { + //NO OP +} + //compilation functions char* readFile(char* path, size_t* fileSize) { FILE* file = fopen(path, "rb"); @@ -87,6 +92,7 @@ int main() { //setup interpreter Interpreter interpreter; initInterpreter(&interpreter); + setInterpreterPrint(&interpreter, noPrintFn); size_t size = 0; @@ -113,6 +119,7 @@ int main() { //setup interpreter Interpreter interpreter; initInterpreter(&interpreter); + setInterpreterPrint(&interpreter, noPrintFn); size_t size = 0; @@ -134,6 +141,8 @@ int main() { resetInterpreter(&interpreter); pushEngineNode(&node, &child); + + free((void*)source); } //test the calls