git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
For FFI loaders, use type instead of const
commit3d969153cff018ff0744baaf40750aa1241ded98 authorAndy Arvanitis <andyarvanitis@gmail.com> dateTue 2 Jul 2019, 22:18 (7 years ago) parentbecdfd8
2 files changed+7−17
src/CodeGen/IL/Printer.hs+1−1 support/Makefile+6−16
src/CodeGen/IL/Printer.hs+1−1
@@ -409,7 +409,7 @@ implHeaderSource mn imports _ =
409409 "type IGNORE_UNUSED_IMPORTS = bool\n" <>
410410 "type _ = IGNORE_UNUSED_RUNTIME\n" <>
411411 (if mn == "Main"
412− then "\nconst _ = ffi.Loader\n\n"
412+ then "\ntype _ = ffi.Loader\n\n"
413413 else "\n")
414414
415415implFooterSource :: Text -> [Ident] -> Text
support/Makefile+6−16
@@ -1,4 +1,4 @@
1−# PureScript to native binary (via C++) Makefile
1+# PureScript to native binary (via Go) Makefile
22#
33# Run 'make' or 'make release' to build an optimized release build
44# Run 'make debug' to build a non-optimized build suitable for debugging
@@ -20,8 +20,8 @@ PSGO := psgo
2020SRC := src
2121OUTPUT := output
2222CC_SRC := $(OUTPUT)/src
23−FFI_SRC := ffi
24−BIN := main
23+FFI_SRC := purescript-go-ffi
24+BIN := Main
2525
2626override PURSFLAGS += compile --codegen corefn
2727override CXXFLAGS += --std=c++11
@@ -29,6 +29,8 @@ override CXXFLAGS += --std=c++11
2929DEBUG := "-DDEBUG -g"
3030RELEASE := "-DNDEBUG -O3"
3131
32+GOPATH := $(GOPATH):$(CURDIR)/$(OUTPUT):$(CURDIR)/$(FFI_SRC)
33+
3234INCLUDES := -I $(CC_SRC)
3335BIN_DIR := $(OUTPUT)/bin
3436
@@ -73,15 +75,11 @@ $(PURESCRIPT_PKGS):
7375SRCS := $(call rwildcard,$(CC_SRC)/,*.cpp)
7476SRCS += $(call rwildcard,$(FFI_SRC)/,*.cpp)
7577SRCS += $(call rwildcard,$(FFI_SRC)/,*.cc)
76−SRCS += $(call rwildcard,$(FFI_SRC)/,*.mm)
7778SRCS += $(call rwildcard,$(FFI_SRC)/,*.c)
78−SRCS += $(call rwildcard,$(FFI_SRC)/,*.m)
7979
8080OBJS1 = $(SRCS:.cpp=.o)
8181OBJS2 = $(OBJS1:.cc=.o)
82−OBJS3 = $(OBJS2:.mm=.o)
83−OBJS4 = $(OBJS3:.c=.o)
84−OBJS = $(OBJS4:.m=.o)
82+OBJS = $(OBJS2:.c=.o)
8583DEPS = $(OBJS:.o=.d)
8684
8785$(BIN): $(OBJS)
@@ -99,18 +97,10 @@ $(BIN): $(OBJS)
9997 @echo "Creating" $@ "(C++)"
10098 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
10199
102−%.o: %.mm
103− @echo "Creating" $@ "(Objective-C++)"
104− @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
105−
106100%.o: %.c
107101 @echo "Creating" $@ "(C)"
108102 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
109103
110−%.o: %.m
111− @echo "Creating" $@ "(Objective-C)"
112− @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
113−
114104.PHONY: all
115105all: release
116106