From afcc5eaecd7b6878ce0399a8b7d6a113c4b004b9 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 23 Mar 2017 00:21:16 -0400 Subject: [PATCH] WIP --- Makefile | 3 ++- Makefile.config | 6 ++++-- cyclone.scm | 5 +++-- runtime.c | 5 +++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bb6235aa..29b4fa2c 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ include Makefile.config # Commands CYCLONE = cyclone -A . -CCOMP = $(CC) $(CFLAGS) +CCOMP = $(CC) $(LIB_CFLAGS) INDENT_CMD = indent -linux -l80 -i2 -nut # Directories @@ -162,6 +162,7 @@ runtime.o : runtime.c $(HEADERS) -DCYC_CC_PROG=\"$(CC_PROG)\" \ -DCYC_CC_EXEC=\"$(CC_EXEC)\" \ -DCYC_CC_LIB=\"$(CC_LIB)\" \ + -DCYC_CC_SO=\"$(CC_SO)\" \ $< -o $@ libcyclone.a : runtime.o gc.o dispatch.o mstreams.o diff --git a/Makefile.config b/Makefile.config index c0eb6c25..4de3fe88 100644 --- a/Makefile.config +++ b/Makefile.config @@ -5,8 +5,9 @@ # Configuration options for the makefile # Compiler options -CFLAGS ?= -O2 -Wall -Iinclude -L. -COMP_CFLAGS ?= -O2 -Wall -I$(PREFIX)/include -L$(PREFIX)/lib +CFLAGS ?= -O2 -fPIC -Wall -Iinclude -L. +LIB_CFLAGS ?= -O2 -Wall -Iinclude -L. +COMP_CFLAGS ?= -O2 -fPIC -Wall -I$(PREFIX)/include -L$(PREFIX)/lib # Use these lines instead for debugging or profiling #CFLAGS = -g -Wall #CFLAGS = -g -pg -Wall @@ -17,6 +18,7 @@ LIBS = -pthread -lcyclone -lck -lm -ltommath CC_PROG ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o" CC_EXEC ?= "$(CC) ~exec-file~.o ~obj-files~ $(LIBS) $(COMP_CFLAGS) -o ~exec-file~" CC_LIB ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o" +CC_SO ?= "$(CC) -shared -o ~exec-file~.so -o ~exec-file~.o" AR ?= ar #CD ?= cd diff --git a/cyclone.scm b/cyclone.scm index 6ee9e670..8e2a61f0 100644 --- a/cyclone.scm +++ b/cyclone.scm @@ -454,15 +454,16 @@ (let ((comp-lib-cmd (string-replace-all (string-replace-all - ;(Cyc-compilation-environment 'cc-lib) (get-comp-env 'cc-lib cc-lib) "~src-file~" src-file) "~exec-file~" exec-file))) (cond (cc? - (system comp-lib-cmd)) + (system comp-lib-cmd) + ) (else (display comp-lib-cmd) + (newline) (newline)))))))) ;; Collect values for the given command line arguments and option. diff --git a/runtime.c b/runtime.c index a45d33e6..3e8600e9 100644 --- a/runtime.c +++ b/runtime.c @@ -2156,6 +2156,11 @@ object Cyc_compilation_environment(void *data, object cont, object var) snprintf(buf, sizeof(buf), "%s", CYC_CC_LIB); make_string(str, buf); _return_closcall1(data, cont, &str); + } else if (strncmp(((symbol) var)->desc, "cc-so", 6) == 0) { + char buf[1024]; + snprintf(buf, sizeof(buf), "%s", CYC_CC_SO); + make_string(str, buf); + _return_closcall1(data, cont, &str); } } Cyc_rt_raise2(data,