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
30RELEASE := "-DNDEBUG -O3"
32INCLUDES := -I $(CC_SRC)
33BIN_DIR := $(OUTPUT)/bin
35PACKAGE_SOURCES = $(subst \,/,$(shell $(PSC_PACKAGE) sources))
36PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
38## Not all environments support globstar (** dir pattern)
39rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
43 @echo "Please specify the type of build you want: 'debug' or 'release'"
45 @echo " debug => not optimized (your app will run slower), good for"
46 @echo " running in a source-level debugger, more (descriptive)"
47 @echo " runtime exceptions"
49 @echo " release => optimized (your app will run faster), less helpful when debugging"
53 go build -o $(BIN_DIR)/$(BIN) $(BIN)
56 go build -o $(BIN_DIR)/$(BIN) $(BIN)
59corefn: PURESCRIPT_PKG_SRCS=$(foreach d,$(PACKAGE_SOURCES),$(call rwildcard,$(firstword $(subst *, ,$(d))),*.purs))
60corefn: PURESCRIPT_SRCS=$(call rwildcard,$(SRC)/,*.purs)
61corefn: $(PURESCRIPT_PKGS)
62 @$(PURS) $(PURSFLAGS) --output $(OUTPUT) $(PURESCRIPT_PKG_SRCS) $(PURESCRIPT_SRCS)
65codegen: COREFN_SRCS=$(call rwildcard,$(OUTPUT)/,corefn.json)
67 @$(PSGO) $(PSGOFLAGS) $(COREFN_SRCS)
70 @echo "Getting packages using" $(PSC_PACKAGE) "..."
71 @$(PSC_PACKAGE) update
73SRCS := $(call rwildcard,$(CC_SRC)/,*.cpp)
74SRCS += $(call rwildcard,$(FFI_SRC)/,*.cpp)
75SRCS += $(call rwildcard,$(FFI_SRC)/,*.cc)
76SRCS += $(call rwildcard,$(FFI_SRC)/,*.mm)
77SRCS += $(call rwildcard,$(FFI_SRC)/,*.c)
78SRCS += $(call rwildcard,$(FFI_SRC)/,*.m)
80OBJS1 = $(SRCS:.cpp=.o)
81OBJS2 = $(OBJS1:.cc=.o)
82OBJS3 = $(OBJS2:.mm=.o)
88 @echo "Linking" $(BIN_DIR)/$(BIN)
90 @$(CXX) $^ -o $(BIN_DIR)/$@ $(LDFLAGS)
95 @echo "Creating" $@ "(C++)"
96 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
99 @echo "Creating" $@ "(C++)"
100 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
103 @echo "Creating" $@ "(Objective-C++)"
104 @$(CXX) $(CXXFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
107 @echo "Creating" $@ "(C)"
108 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
111 @echo "Creating" $@ "(Objective-C)"
112 @$(CXX) $(CFLAGS) $(INCLUDES) -MMD -MP -c $< -o $@
119 @-rm -f $(OBJS) $(DEPS)
124 @$(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