-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
91 lines (69 loc) · 2.22 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
PROJ = undermidi
PRIV = ./priv
PWD = $(shell pwd)
ARCH = $(shell uname -m)
OS = $(shell uname -s|tr '[:upper:]' '[:lower:]')
ifeq ($(OS),linux)
ifeq ($(ARCH),x86_64)
ARCH = amd64
endif
endif
MIDISERVER_VSN = 0.1.0
MIDISERVER_REPO = https://github.com/ut-proj/midiserver
BIN = midiserver
DOWNLOAD_BIN = $(BIN)-$(OS)-$(ARCH)
DOWNLOAD_LINK = $(MIDISERVER_REPO)/releases/download/$(MIDISERVER_VSN)/$(DOWNLOAD_BIN)
#############################################################################
### General Targets #####################################################
#############################################################################
default: build
build:
@rebar3 compile
rebuild: clean-all build
check:
-@rebar3 lfe clean
@rebar3 lfe compile
@rebar3 xref
-@rebar3 dialyzer
@rebar3 as test lfe ltest
recheck: rebuild check
show-arch-bin:
@echo $(DOWNLOAD_BIN)
clean-all: clean-go clean
@rm -rf _build rebar.lock
.PHONY: default run build build-go clean-go clean-all download
#############################################################################
### Erlang Targets ######################################################
#############################################################################
clean:
@rebar3 clean
run:
@rm -rf _build/default/lib/undermidi
@rebar3 undermidi
#############################################################################
### Go Targets ##########################################################
#############################################################################
GH_ORG = github.com/ut-proj
GO_PROJ = midiserver
GO_REPO = https://$(GH_ORG)/$(GO_PROJ).git
GO_BASE = $(PRIV)/go/src/$(GH_ORG)
GO_DIR = $(GO_BASE)/$(GO_PROJ)
GO_SRC = ~/lab/ut-proj/go/src/$(GH_ORG)/$(GO_PROJ)
$(GO_DIR):
@mkdir -p $(GO_BASE)
@cd $(GO_BASE) && \
git clone $(GO_REPO)
build-go: | $(GO_DIR)
@echo ">> Building Go examples ..."
@cd $(GO_DIR) && $(MAKE)
clean-go:
@cd $(GO_DIR) && $(MAKE) clean
rebuild-go: clean-go build-go
download: | bin/$(BIN)
bin/$(BIN):
@mkdir -p ./bin
@echo ">> Downloading $(DOWNLOAD_LINK) ..."
@curl -L --silent -O $(DOWNLOAD_LINK)
@chmod 755 $(DOWNLOAD_BIN)
@echo ">> Moving $(DOWNLOAD_BIN) to ./bin/$(BIN) ..."
@mv $(DOWNLOAD_BIN) ./bin/$(BIN)