-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (56 loc) · 1.77 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
65
66
67
68
69
70
71
72
73
74
75
76
PKG=bm
BUILD_DIR=build
PONYC=ponyc
PONY_SRC=$(wildcard **/*.pony) $(wildcard **/**/*.pony) $(wildcard **/**/**/*.pony)
BIN_DIR=$(BUILD_DIR)/release
BIN=$(BIN_DIR)/$(PKG)
DEBUG_DIR=$(BUILD_DIR)/debug
DEBUG=$(DEBUG_DIR)/$(PKG)
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)
install: ## Install binary in $(prefix). Default prefix=/usr/local
cp $(BIN) $(prefix)/bin
uninstall: ## Remove binary from prefix.
rm $(prefix)/bin/$(PKG)
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) $(PKG)
$(DEBUG_DIR):
mkdir -p $(DEBUG_DIR)
$(DEBUG): $(PONY_SRC)
$(PONYC) --debug -o $(DEBUG_DIR) $(PKG)
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 "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo
@echo "Install instructions:"
@echo " make"
@echo " sudo make install"
@echo "or, for your user only (assuming ~/bin is in your PATH)"
@echo " make"
@echo " make install prefix=$$HOME"