@@ -10,7 +10,7 @@
10# command itself. For example: 'make BIN=myutil'
10# command itself. For example: 'make BIN=myutil'
12# Flags can be added to either the codegen or native build phases.
12# Flags can be added to either the codegen or native build phases.
13−# For example: 'make PURSFLAGS=--codegen,js CFLAGS=-DDEBUG LDFLAGS=lgmp'
13+# For example: 'make PURSFLAGS=--codegen,js CXXFLAGS=-DDEBUG LDFLAGS=lgmp'
15# You can also edit the generated version of this file directly.
15# You can also edit the generated version of this file directly.
@@ -24,7 +24,7 @@ FFI_SRC := ffi
24BIN := main
24BIN := main
26override PURSFLAGS += compile --codegen corefn
26override PURSFLAGS += compile --codegen corefn
27−override CFLAGS += --std=c++11
27+override CXXFLAGS += --std=c++11
29DEBUG := "-DDEBUG -g"
29DEBUG := "-DDEBUG -g"
30RELEASE := "-DNDEBUG -O3"
30RELEASE := "-DNDEBUG -O3"
@@ -39,10 +39,10 @@ PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
39rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
39rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
41release: codegen
41release: codegen
42− @$(MAKE) $(BIN) CFLAGS+=$(RELEASE)
42+ @$(MAKE) $(BIN) CFLAGS+=$(RELEASE) CXXFLAGS+=$(RELEASE)
44debug: codegen
44debug: codegen
45− @$(MAKE) $(BIN) CFLAGS+=$(DEBUG)
45+ @$(MAKE) $(BIN) CFLAGS+=$(DEBUG) CXXFLAGS+=$(DEBUG)
47.PHONY: corefn
47.PHONY: corefn
48corefn: PURESCRIPT_PKG_SRCS=$(foreach d,$(PACKAGE_SOURCES),$(call rwildcard,$(firstword $(subst *, ,$(d))),*.purs))
48corefn: PURESCRIPT_PKG_SRCS=$(foreach d,$(PACKAGE_SOURCES),$(call rwildcard,$(firstword $(subst *, ,$(d))),*.purs))
@@ -61,10 +61,14 @@ $(PURESCRIPT_PKGS):
62SRCS := $(call rwildcard,$(CC_SRC)/,*.cpp)
62SRCS := $(call rwildcard,$(CC_SRC)/,*.cpp)
63SRCS += $(call rwildcard,$(FFI_SRC)/,*.cpp)
63SRCS += $(call rwildcard,$(FFI_SRC)/,*.cpp)
64+SRCS += $(call rwildcard,$(FFI_SRC)/,*.mm)
64SRCS += $(call rwildcard,$(FFI_SRC)/,*.c)
65SRCS += $(call rwildcard,$(FFI_SRC)/,*.c)
66+SRCS += $(call rwildcard,$(FFI_SRC)/,*.m)
66OBJS1 = $(SRCS:.cpp=.o)
68OBJS1 = $(SRCS:.cpp=.o)
67−OBJS = $(OBJS1:.c=.o)
69+OBJS2 = $(OBJS1:.mm=.o)
70+OBJS3 = $(OBJS2:.c=.o)
68DEPS = $(OBJS:.o=.d)
72DEPS = $(OBJS:.o=.d)
70$(BIN): $(OBJS)
74$(BIN): $(OBJS)
@@ -76,12 +80,20 @@ $(BIN): $(OBJS)
78 @echo "Creating" $@
82 @echo "Creating" $@
83+ @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
79− @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
87+ @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
82 @echo "Creating" $@
90 @echo "Creating" $@
83 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
91 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
95+ @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
85.PHONY: all
97.PHONY: all
86all: release
98all: release