git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'pure11/pure11' into native
commitac88a541fe2f746eb00c60f970dab191eada54fb authorAndy Arvanitis <andyarvanitis@gmail.com> dateFri 9 Dec 2016, 19:53 (10 years ago) parentc8467a3d727a36
1 file changed+26−16
pcc/support/Makefile+26−16
pcc/support/Makefile+26−16
@@ -6,30 +6,23 @@
66# You can also perform a parallel build with 'make -jN', where N is the
77# number of cores to use.
88#
9−# PCC, PURESCRIPT_PKGS, OUTPUT, and BIN can all be overridden with the
10−# command itself. For example: 'make PURESCRIPT_PKGS=../gitpackages BIN=myexe'
9+# PCC, SRC, OUTPUT, and BIN can all be overridden with the
10+# command itself. For example: 'make BIN=myutil'
1111#
1212# Flags can be added to either the codegen or native build phases.
1313# For example: 'make PCCFLAGS=--no-tco CXXFLAGS=-DDEBUG LDFLAGS=lobjc'
1414#
1515# You can also edit the generated version of this file directly.
1616#
17−PCC := {{path}}/pcc
18−PSC_PKG_BIN := psc-package
19−PSC_PACKAGE := {{path}}/$(PSC_PKG_BIN)
20−PURESCRIPT_PKGS := .psc-package
21−PURESCRIPT_SRC := src
22−OUTPUT := output
23−BIN := main
17+PCC := {{path}}/pcc
18+SRC := src
19+OUTPUT := output
20+BIN := main
2421
2522override PCCFLAGS += --comments
2623override CXXFLAGS += -std=c++11
2724override LDFLAGS +=
2825
29−ifeq ("$(wildcard $(PSC_PACKAGE))","")
30− PSC_PACKAGE := $(PSC_PKG_BIN)
31−endif
32−
3326ifeq ($(GC),yes)
3427 override CXXFLAGS += -DUSE_GC
3528 override LDFLAGS += -lgc
@@ -41,14 +34,27 @@ RELEASE := "-O3 -flto"
4134INCLUDES := -I $(OUTPUT)
4235BIN_DIR := $(OUTPUT)/bin
4336
37+PSC_PKG_BIN := psc-package
38+PSC_PACKAGE := {{path}}/$(PSC_PKG_BIN)
39+
40+ifeq ("$(wildcard $(PSC_PACKAGE))","")
41+ PSC_PACKAGE := $(PSC_PKG_BIN)
42+endif
43+
44+PACKAGE_SOURCES = $(shell $(PSC_PACKAGE) sources)
45+PURESCRIPT_PKGS := $(firstword $(subst /, ,$(PACKAGE_SOURCES)))
46+
47+## Not all environments support globstar (** dir pattern)
48+rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
49+
4450release: codegen
4551 @$(MAKE) $(BIN) CXXFLAGS+=$(RELEASE)
4652
4753debug: codegen
4854 @$(MAKE) $(BIN) CXXFLAGS+=$(DEBUG)
4955
50−codegen: PURESCRIPT_PKG_SRCS=$(shell find $(PURESCRIPT_PKGS) -name '*.purs' | grep -v \/test\/ | grep -v \/example\/ | grep -v \/examples\/)
51−codegen: PURESCRIPT_SRCS=$(shell find $(PURESCRIPT_SRC) -name '*.purs')
56+codegen: PURESCRIPT_PKG_SRCS=$(foreach d,$(PACKAGE_SOURCES),$(call rwildcard,$(firstword $(subst *, ,$(d))),*.purs))
57+codegen: PURESCRIPT_SRCS=$(call rwildcard,$(SRC)/,*.purs)
5258#
5359codegen: $(PURESCRIPT_PKGS)
5460 @$(PCC) $(PCCFLAGS) --output $(OUTPUT) $(PURESCRIPT_PKG_SRCS) $(PURESCRIPT_SRCS)
@@ -57,7 +63,7 @@ $(PURESCRIPT_PKGS):
5763 @echo "Getting packages using" $(PSC_PACKAGE) "..."
5864 @$(PSC_PACKAGE) update
5965
60−SRCS := $(shell find $(OUTPUT) 2>/dev/null -name '*.cc')
66+SRCS := $(call rwildcard,$(OUTPUT)/,*.cc)
6167
6268OBJS = $(SRCS:.cc=.o)
6369DEPS = $(SRCS:.cc=.d)
@@ -76,3 +82,7 @@ $(BIN): $(OBJS)
7682.PHONY: clean
7783clean:
7884 @-rm -rf $(OUTPUT)
85+
86+.PHONY: run
87+run:
88+ @$(BIN_DIR)/$(BIN)