forked from driskell/log-courier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (37 loc) · 1.4 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
.PHONY: go-check all test clean selfsigned
export GOPATH := ${PWD}
TAGS :=
BINS := bin/log-courier
TESTS := spec/courier_spec.rb spec/gem_spec.rb spec/multiline_spec.rb
ifeq ($(with),zmq)
TAGS := $(TAGS) zmq zmq_4_x
BINS := $(BINS) bin/genkey
TESTS := $(TESTS) spec/zmq_spec.rb
endif
ifneq ($(skiptags),yes)
LASTTAGS := $(shell cat .Makefile.tags 2>/dev/null)
ifneq ($(LASTTAGS),$(TAGS))
IMPLYCLEAN := $(shell $(MAKE) skiptags=yes clean)
SAVETAGS := $(shell echo "$(TAGS)" >.Makefile.tags)
endif
endif
all: $(BINS)
test: all vendor/bundle/.GemfileModT
bundle exec rspec $(TESTS)
selfsigned:
openssl req -config spec/lib/openssl.cnf -new -keyout bin/selfsigned.key -out bin/selfsigned.csr
openssl x509 -extfile spec/lib/openssl.cnf -extensions extensions_section -req -days 365 -in bin/selfsigned.csr -signkey bin/selfsigned.key -out bin/selfsigned.crt
# Only update bundle if Gemfile changes
vendor/bundle/.GemfileModT: Gemfile
bundle install --path vendor/bundle
touch $@
go-check:
@go version > /dev/null || (echo "Go not found. You need to install go: http://golang.org/doc/install"; false)
@go version | grep -q 'go version go1.[123]' || (echo "Go version 1.1.x, 1.2.x or 1.3.x required, you have a version of go that is not supported."; false)
clean:
go clean -i ./...
rm -rf vendor/bundle
.SECONDEXPANSION:
bin/%: $$(wildcard src/%/*.go) | go-check
go get -d -tags "$(TAGS)" $*
go install -tags "$(TAGS)" $*