-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (45 loc) · 1.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
PKG=pg
BUILD_DIR=build
PONYC=/usr/local/bin/ponyc
PONY_SRC=$(shell find . -name "*.pony")
BIN_DIR=$(BUILD_DIR)/release
BIN=$(BIN_DIR)/example
DEBUG_DIR=$(BUILD_DIR)/debug
DEBUG=$(DEBUG_DIR)/example
TEST_SRC=$(PKG)/test
TEST_BIN=$(BUILD_DIR)/test
BENCH_SRC=$(PKG)/bench
BENCH_BIN=$(BUILD_DIR)/bench
prefix=/usr/local
all: $(BIN_DIR) test $(BIN) ## Run tests and build the package
run: $(BIN) ## Build and run the package
$(BIN)
debug: $(DEBUG) ## Build a and run the package with --debug
$(DEBUG)
test: $(TEST_BIN) runtest ## Build and run tests
$(TEST_BIN): $(BUILD_DIR) $(PONY_SRC)
$(PONYC) -o $(BUILD_DIR) --path . $(TEST_SRC)
runtest: ## Run the tests
$(TEST_BIN)
bench: $(BENCH_BIN) runbench ## Build and run benchmarks
$(BENCH_BIN): $(BUILD_DIR) $(PONY_SRC)
$(PONYC) -o $(BUILD_DIR) --path . $(BENCH_SRC)
runbench: ## Run benchmarks
$(BENCH_BIN)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BIN_DIR):
mkdir -p $(BIN_DIR)
$(BIN): $(PONY_SRC)
$(PONYC) -o $(BIN_DIR) -p . example
$(DEBUG_DIR):
mkdir -p $(DEBUG_DIR)
$(DEBUG): $(PONY_SRC)
$(PONYC) --debug -p . -o $(DEBUG_DIR) example
doc: $(PONY_SRC) ## Build the documentation
$(PONYC) -o $(BUILD_DIR) --docs --path . --pass=docs $(PKG)
clean: ## Remove all artifacts
-rm -rf $(BUILD_DIR)
.PHONY: help
help: ## Show help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "[36m%-30s[0m %s\n", $$1, $$2}'