-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (43 loc) · 1.3 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
GOLIBS:=bluetoo.co/otflib
GOAPPS:=bluetoo.co/otf-export bluetoo.co/otf-import
GORUN:=src/bluetoo.co/otf-export/ort-export.go
GOCLEAN:=otf-export otf-import
# -------------------------------------------------
all:test build
# `make ci` to continuously run tests
# requires entr(1) http://entrproject.org/
# `brew install entr` on OS X if you have homebrew
ci:
@echo Monitoring for source changes...
@find . -name '*.go' | entr -c make test
GO:=go
GO_ALL_TARGETS:=$(GOLIBS) $(GOAPPS)
GO_TESTS = $(foreach itr, $(GO_ALL_TARGETS), $(itr)_test)
GO_APPS = $(foreach itr, $(GOAPPS), $(itr)_apps)
GO_CLEAN = $(foreach itr, $(GO_ALL_TARGETS), $(itr)_clean)
GO_CLEAN_EXTRAS = $(foreach itr, $(GOCLEAN), $(itr)_extraclean)
.PHONY: $(GO_TESTS) $(GO_APPS) $(GO_RUN) $(GO_CLEAN) $(GO_CLEAN_EXTRAS)
test: export GOPATH = $(shell pwd)
test: $(GO_TESTS)
build: export GOPATH = $(shell pwd)
build: $(GO_APPS)
clean: export GOPATH = $(shell pwd)
clean: $(GO_CLEAN) $(GO_CLEAN_EXTRAS)
run: export GOPATH = $(shell pwd)
run:
$(GO) run $(GORUN)
ifdef VERBOSE_TESTS
TEST_ARGS:=-test.v
else
TEST_ARGS:=
endif
$(GO_TESTS): %_test:
@echo [TEST] $*
$(GO) test $* $(TEST_ARGS)
$(GO_APPS): %_apps:
$(GO) build $*
$(GO_CLEAN): %_clean:
$(GO) clean $*
$(GO_CLEAN_EXTRAS): %_extraclean:
@echo [CLEAN] $*
@if [ -f $* ]; then rm $*; fi;