aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 17:44:35 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 17:44:35 -0400
commitaf7271de28b7a6e757944ffb763799b085135c1d (patch)
tree5e3ef69da15d7aef21aa050f2ef8069a44c62d9e
parente725f6b250a7e488e94ac8a5bc2d33bc9f2be001 (diff)
Fix for mac using -install_name
-rw-r--r--Makefile11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 2ff78da5..d7fda18c 100644
--- a/Makefile
+++ b/Makefile
@@ -43,11 +43,18 @@ O=-Og
CFLAGS=$(CCONFIG) $(EXTRA) $(CWARN) $(G) $(O) $(OSFLAGS) $(LTO)
CFLAGS_PLACEHOLDER="$$(printf '\033[2m<flags...>\033[m\n')"
LDLIBS=-lgc -lcord -lm -lunistring -lgmp
+LIBTOMO_FLAGS=-shared
ifeq ($(OS),OpenBSD)
LDLIBS += -lpthread -lexecinfo
endif
+ifeq ($(OS),Darwin)
+ LIBTOMO_FLAGS += -Wl,-install_name,libtomo.so
+else
+ LIBTOMO_FLAGS += -Wl,-soname,libtomo.so
+endif
+
COMPILER_OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c))
STDLIB_OBJS=$(patsubst %.c,%.o,$(wildcard src/stdlib/*.c))
TESTS=$(patsubst test/%.tm,test/results/%.tm.testresult,$(wildcard test/*.tm))
@@ -61,8 +68,8 @@ build/tomo: $(STDLIB_OBJS) $(COMPILER_OBJS)
build/libtomo.so: $(STDLIB_OBJS)
@mkdir -p build
- @echo $(CC) $^ $(CFLAGS_PLACEHOLDER) $(OSFLAGS) $(LDFLAGS) $(LDLIBS) -Wl,-soname,libtomo.so -shared -o $@
- @$(CC) $^ $(CFLAGS) $(OSFLAGS) $(LDFLAGS) $(LDLIBS) -Wl,-soname,libtomo.so -shared -o $@
+ @echo $(CC) $^ $(CFLAGS_PLACEHOLDER) $(OSFLAGS) $(LDFLAGS) $(LDLIBS) $(LIBTOMO_FLAGS) -o $@
+ @$(CC) $^ $(CFLAGS) $(OSFLAGS) $(LDFLAGS) $(LDLIBS) $(LIBTOMO_FLAGS) -o $@
tags:
ctags src/*.[ch] src/stdlib/*.[ch]