forked from driskell/log-courier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (87 loc) · 3.13 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.PHONY: prepare fix_version setup_root all log-courier gem gem_plugins push_gems test test_go test_rspec doc profile benchmark jrprofile jrbenchmark clean
MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
GOPATH := $(patsubst %/,%,$(dir $(abspath $(MAKEFILE))))
export GOPATH := $(GOPATH)
TAGS :=
BINS := bin/log-courier bin/lc-tlscert bin/lc-admin
GOTESTS := log-courier lc-tlscert lc-admin lc-lib/...
TESTS := spec/courier_spec.rb spec/tcp_spec.rb spec/gem_spec.rb
ifneq (,$(findstring curvekey,$(MAKECMDGOALS)))
with := zmq4
endif
ifeq ($(with),zmq3)
TAGS := $(TAGS) zmq zmq_3_x
TESTS := $(TESTS) spec/plainzmq_spec.rb
endif
ifeq ($(with),zmq4)
TAGS := $(TAGS) zmq zmq_4_x
BINS := $(BINS) bin/lc-curvekey
GOTESTS := $(GOTESTS) lc-curvekey
TESTS := $(TESTS) spec/plainzmq_spec.rb spec/zmq_spec.rb
endif
ifneq ($(implyclean),yes)
LASTTAGS := $(shell cat .Makefile.tags 2>/dev/null)
ifneq ($(LASTTAGS),$(TAGS))
IMPLYCLEAN := $(shell $(MAKE) implyclean=yes clean)
SAVETAGS := $(shell echo "$(TAGS)" >.Makefile.tags)
endif
endif
all: | log-courier
log-courier: | $(BINS)
gem: | fix_version
gem build log-courier.gemspec
gem_plugins: | fix_version
gem build logstash-input-log-courier.gemspec
gem build logstash-output-log-courier.gemspec
push_gems: | gem gem_plugins
build/push_gems
test_go: | all
go get -d -tags "$(TAGS)" $(GOTESTS)
go test -tags "$(TAGS)" $(GOTESTS)
test_rspec: | all vendor/bundle/.GemfileModT
bundle exec rspec $(TESTS)
jrtest_rspec: | all vendor/bundle/.GemfileJRubyModT
jruby -G vendor/bundle/jruby/1.9/bin/rspec $(TESTS)
test: | test_go test_rspec
selfsigned: | bin/lc-tlscert
bin/lc-tlscert
curvekey: | bin/lc-curvekey
bin/lc-curvekey
doc:
@npm --version >/dev/null || (echo "'npm' not found. You need to install node.js.")
@npm install doctoc >/dev/null || (echo "Failed to perform local install of doctoc.")
@node_modules/.bin/doctoc README.md
@for F in docs/*.md docs/codecs/*.md; do node_modules/.bin/doctoc $$F; done
profile: | all vendor/bundle/.GemfileModT
bundle exec rspec spec/profile_spec.rb
benchmark: | all vendor/bundle/.GemfileModT
bundle exec rspec spec/benchmark_spec.rb
vendor/bundle/.GemfileModT: Gemfile
bundle install --path vendor/bundle
@touch $@
jrprofile: | all vendor/bundle/.GemfileJRubyModT
jruby --profile -G vendor/bundle/jruby/1.9/bin/rspec spec/benchmark_spec.rb
jrbenchmark: | all vendor/bundle/.GemfileJRubyModT
jruby -G vendor/bundle/jruby/1.9/bin/rspec spec/benchmark_spec.rb
vendor/bundle/.GemfileJRubyModT: Gemfile
jruby -S bundle install --path vendor/bundle
@touch $@
clean:
go clean -i ./...
ifneq ($(implyclean),yes)
rm -rf src/github.com
rm -rf vendor/bundle
rm -f Gemfile.lock
rm -f *.gem
endif
fix_version:
build/fix_version "${FIX_VERSION}"
setup_root:
build/setup_root
prepare: | fix_version setup_root
@go version >/dev/null || (echo "Go not found. You need to install Go version 1.2-1.4: http://golang.org/doc/install"; false)
@go version | grep -q 'go version go1.[234]' || (echo "Go version 1.2-1.4, you have a version of Go that is not supported."; false)
@echo "GOPATH: $${GOPATH}"
bin/%: prepare
go get -d -tags "$(TAGS)" $*
go install -tags "$(TAGS)" $*