git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Makefile cleanup and support for objc files
commit62ce7c9446a50455ac6555daabc48d54e4e6d890 authorAndy Arvanitis <andyarvanitis@gmail.com> dateSat 25 Aug 2018, 16:49 (8 years ago) parent5a39ab6
1 file changed+18−6
support/Makefile+18−6
support/Makefile+18−6
@@ -10,7 +10,7 @@
1010# command itself. For example: 'make BIN=myutil'
1111#
1212# 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'
1414#
1515# You can also edit the generated version of this file directly.
1616#
@@ -24,7 +24,7 @@ FFI_SRC := ffi
2424BIN := main
2525
2626override PURSFLAGS += compile --codegen corefn
27−override CFLAGS += --std=c++11
27+override CXXFLAGS += --std=c++11
2828
2929DEBUG := "-DDEBUG -g"
3030RELEASE := "-DNDEBUG -O3"
@@ -39,10 +39,10 @@ PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
3939rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
4040
4141release: codegen
42− @$(MAKE) $(BIN) CFLAGS+=$(RELEASE)
42+ @$(MAKE) $(BIN) CFLAGS+=$(RELEASE) CXXFLAGS+=$(RELEASE)
4343
4444debug: codegen
45− @$(MAKE) $(BIN) CFLAGS+=$(DEBUG)
45+ @$(MAKE) $(BIN) CFLAGS+=$(DEBUG) CXXFLAGS+=$(DEBUG)
4646
4747.PHONY: corefn
4848corefn: PURESCRIPT_PKG_SRCS=$(foreach d,$(PACKAGE_SOURCES),$(call rwildcard,$(firstword $(subst *, ,$(d))),*.purs))
@@ -61,10 +61,14 @@ $(PURESCRIPT_PKGS):
6161
6262SRCS := $(call rwildcard,$(CC_SRC)/,*.cpp)
6363SRCS += $(call rwildcard,$(FFI_SRC)/,*.cpp)
64+SRCS += $(call rwildcard,$(FFI_SRC)/,*.mm)
6465SRCS += $(call rwildcard,$(FFI_SRC)/,*.c)
66+SRCS += $(call rwildcard,$(FFI_SRC)/,*.m)
6567
6668OBJS1 = $(SRCS:.cpp=.o)
67−OBJS = $(OBJS1:.c=.o)
69+OBJS2 = $(OBJS1:.mm=.o)
70+OBJS3 = $(OBJS2:.c=.o)
71+OBJS = $(OBJS3:.m=.o)
6872DEPS = $(OBJS:.o=.d)
6973
7074$(BIN): $(OBJS)
@@ -76,12 +80,20 @@ $(BIN): $(OBJS)
7680
7781%.o: %.cpp
7882 @echo "Creating" $@
79− @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
83+ @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
84+
85+%.o: %.mm
86+ @echo "Creating" $@
87+ @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
8088
8189%.o: %.c
8290 @echo "Creating" $@
8391 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
8492
93+%.o: %.m
94+ @echo "Creating" $@
95+ @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
96+
8597.PHONY: all
8698all: release
8799