1# PureScript to native binary (via C++) Makefile
3# Run 'make' or 'make release' to build an optimized release build
4# Run 'make debug' to build a non-optimized build suitable for debugging
6# You can also perform a parallel build with 'make -jN', where N is the
7# number of cores to use.
9# PURS, SRC, OUTPUT, and BIN can all be overridden with the
10# command itself. For example: 'make BIN=myutil'
12# Flags can be added to either the codegen or native build phases.
13# For example: 'make PURSFLAGS=--codegen,js CXXFLAGS=-DDEBUG LDFLAGS=lgmp'
15# You can also edit the generated version of this file directly.
18PSC_PACKAGE := psc-package
22CC_SRC := $(OUTPUT)/src
26override PURSFLAGS += compile --codegen corefn
27override CXXFLAGS += --std=c++11
29CXXVERSION = $(shell $(CXX) --version)
30ifneq (,$(findstring g++,$(CXXVERSION)))
31 PSCPPFLAGS += "--ucns"
35RELEASE := "-DNDEBUG -O3"
37INCLUDES := -I $(CC_SRC)
38BIN_DIR := $(OUTPUT)/bin
40PACKAGE_SOURCES = $(subst \,/,$(shell $(PSC_PACKAGE) sources))
41PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
43## Not all environments support globstar (** dir pattern)
44rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
48 @echo "Please specify the type of build you want: 'debug' or 'release'"
50 @echo " debug => not optimized (your app will run slower), good for"
51 @echo " running in a source-level debugger, more (descriptive)"
52 @echo " runtime exceptions"
54 @echo " release => optimized (your app will run faster), less helpful when debugging"
58 @$(MAKE) $(BIN) CFLAGS+=$(DEBUG) CXXFLAGS+=$(DEBUG)
61 @$(MAKE) $(BIN) CFLAGS+=$(RELEASE) CXXFLAGS+=$(RELEASE)
64corefn: PURESCRIPT_PKG_SRCS=$(foreach d,$(PACKAGE_SOURCES),$(call rwildcard,$(firstword $(subst *, ,$(d))),*.purs))
65corefn: PURESCRIPT_SRCS=$(call rwildcard,$(SRC)/,*.purs)
66corefn: $(PURESCRIPT_PKGS)
67 @$(PURS) $(PURSFLAGS) --output $(OUTPUT) $(PURESCRIPT_PKG_SRCS) $(PURESCRIPT_SRCS)
70codegen: COREFN_SRCS=$(call rwildcard,$(OUTPUT)/,corefn.json)
72 @$(PSCPP) $(PSCPPFLAGS) $(COREFN_SRCS)
75 @echo "Getting packages using" $(PSC_PACKAGE) "..."
76 @$(PSC_PACKAGE) update
78SRCS := $(call rwildcard,$(CC_SRC)/,*.cpp)
79SRCS += $(call rwildcard,$(FFI_SRC)/,*.cpp)
80SRCS += $(call rwildcard,$(FFI_SRC)/,*.cc)
81SRCS += $(call rwildcard,$(FFI_SRC)/,*.mm)
82SRCS += $(call rwildcard,$(FFI_SRC)/,*.c)
83SRCS += $(call rwildcard,$(FFI_SRC)/,*.m)
85OBJS1 = $(SRCS:.cpp=.o)
86OBJS2 = $(OBJS1:.cc=.o)
87OBJS3 = $(OBJS2:.mm=.o)
93 @echo "Linking" $(BIN_DIR)/$(BIN)
95 @$(CXX) $^ -o $(BIN_DIR)/$@ $(LDFLAGS)
100 @echo "Creating" $@ "(C++)"
101 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
104 @echo "Creating" $@ "(C++)"
105 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
108 @echo "Creating" $@ "(Objective-C++)"
109 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
112 @echo "Creating" $@ "(C)"
113 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
116 @echo "Creating" $@ "(Objective-C)"
117 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
124 @-rm -f $(OBJS) $(DEPS)
129 @$(BIN_DIR)/$(BIN) $(ARGS)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list