1Use system libraries
2
3--- a/cc0/Makefile
4+++ b/cc0/Makefile
5@@ -22,12 +22,12 @@ MLTON_BASIC = mlton $(MLTON_FLAGS) -verbose $(MLTON_VERB) -output
6 MLTON_NATIVE := mlton -default-ann "redundantMatch error" -default-ann "sequenceNonUnit error"
7 MLTON_NATIVE += -link-opt "-lpthread -ldl -rdynamic" -cc-opt "-Iinclude" -default-ann "allowFFI true"
8 MLTON_NATIVE += -cc-opt "-I../externals/"
9-MLTON_NATIVE += -link-opt "../externals/readline/libreadline.a ../externals/readline/libhistory.a"
10+MLTON_NATIVE += -link-opt "$(shell pkg-config readline --libs)"
11 MLTON_NATIVE += -link-opt "$(shell pkg-config libpng --libs)"
12
13 # libreadline dependencies
14 ifeq ($(PLATFORM),osx)
15-MLTON_NATIVE += -link-opt "-ltermcap"
16+MLTON_NATIVE += -link-opt "-lncurses"
17 else
18 # (Assuming Linux)
19 MLTON_NATIVE += -link-opt "-ltinfo"
20@@ -122,9 +122,9 @@ endef
21
22 $(foreach rt,$(RUNTIMES),$(eval $(call runtime_template,$(rt))))
23
24-c0rt/$(call dllname,c0rt): gc libbacktrace
25+c0rt/$(call dllname,c0rt):
26
27-unsafe/$(call dllname,unsafe): gc
28+unsafe/$(call dllname,unsafe):
29
30
31 ### cc0 - the C0 compiler
32@@ -222,7 +222,6 @@ NATIVE_COIN = $(NATIVE_CYMBOL) $(NATIVE_CALLING)
33 NATIVE_COIN += coin/c0readline.c
34
35 COIN_DEPS = $(CC0_DEPS) $(NATIVE_COIN) cymbol/cymbol*.cm cymbol/*.sml cymbol/*.mlb coin/coin*.cm coin/*.sml coin/*.sml
36-COIN_DEPS += readline
37
38 .PHONY: coin
39 coin: bin/coin
40--- a/cc0/lib.mk
41+++ b/cc0/lib.mk
42@@ -15,9 +15,9 @@ TARGET = $(call dllname,$(LIBNAME))
43 endif
44
45 # These libs are handled specially by this file
46-NATIVELIBS = gc ncurses backtrace
47+NATIVELIBS =
48 C0LIBS = $(filter-out $(NATIVELIBS),$(REQUIRES))
49-LIBS = -L$(abspath $(DEPTH)/lib) $(patsubst %,$(DEPTH)/lib/$(call dllname,%),$(C0LIBS))
50+LIBS = -L$(abspath $(DEPTH)/lib)
51 LDFLAGS =
52
53 # -fPIC is not supported on Windows and is not necessary there because we link statically