git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Makefile cleanup and support for objc files
62ce7c9Andy Arvanitis
support/Makefile+18−6
@@ -10,7 +10,7 @@
10# command itself. For example: 'make BIN=myutil'
10# command itself. For example: 'make BIN=myutil'
11#
11#
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'
14#
14#
15# You can also edit the generated version of this file directly.
15# You can also edit the generated version of this file directly.
16#
16#
@@ -24,7 +24,7 @@ FFI_SRC := ffi
24BIN := main
24BIN := main
25
25
26override PURSFLAGS += compile --codegen corefn
26override PURSFLAGS += compile --codegen corefn
27−override CFLAGS += --std=c++11
27+override CXXFLAGS += --std=c++11
28
28
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))
40
40
41release: codegen
41release: codegen
42− @$(MAKE) $(BIN) CFLAGS+=$(RELEASE)
42+ @$(MAKE) $(BIN) CFLAGS+=$(RELEASE) CXXFLAGS+=$(RELEASE)
43
43
44debug: codegen
44debug: codegen
45− @$(MAKE) $(BIN) CFLAGS+=$(DEBUG)
45+ @$(MAKE) $(BIN) CFLAGS+=$(DEBUG) CXXFLAGS+=$(DEBUG)
46
46
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):
61
61
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)
65
67
66OBJS1 = $(SRCS:.cpp=.o)
68OBJS1 = $(SRCS:.cpp=.o)
67−OBJS = $(OBJS1:.c=.o)
69+OBJS2 = $(OBJS1:.mm=.o)
70+OBJS3 = $(OBJS2:.c=.o)
71+OBJS = $(OBJS3:.m=.o)
68DEPS = $(OBJS:.o=.d)
72DEPS = $(OBJS:.o=.d)
69
73
70$(BIN): $(OBJS)
74$(BIN): $(OBJS)
@@ -76,12 +80,20 @@ $(BIN): $(OBJS)
76
80
77%.o: %.cpp
81%.o: %.cpp
78 @echo "Creating" $@
82 @echo "Creating" $@
83+ @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
84+
85+%.o: %.mm
86+ @echo "Creating" $@
79− @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
87+ @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
80
88
81%.o: %.c
89%.o: %.c
82 @echo "Creating" $@
90 @echo "Creating" $@
83 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
91 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
84
92
93+%.o: %.m
94+ @echo "Creating" $@
95+ @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
96+
85.PHONY: all
97.PHONY: all
86all: release
98all: release
87
99