forked from mozilla/tls-observatory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (73 loc) · 2.87 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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
BUILDREF := $(shell git log --pretty=format:'%h' -n 1)
BUILDDATE := $(shell date +%Y%m%d)
BUILDENV := dev
BUILDREV := $(BUILDDATE)+$(BUILDREF).$(BUILDENV)
# Supported OSes: linux darwin windows
# Supported ARCHes: 386 amd64
OS := linux
ARCH := amd64
ifeq ($(ARCH),amd64)
FPMARCH := x86_64
endif
ifeq ($(ARCH),386)
FPMARCH := i386
endif
ifeq ($(OS),windows)
BINSUFFIX := ".exe"
else
BINSUFFIX := ""
endif
PREFIX := /usr/local/
DESTDIR := /
BINDIR := bin/$(OS)/$(ARCH)
GCC := gcc
CFLAGS :=
LDFLAGS :=
GOOPTS := -tags netgo
GO := GOOS=$(OS) GOARCH=$(ARCH) GO15VENDOREXPERIMENT=1 go
GOGETTER := GOPATH=$(shell pwd)/.tmpdeps go get -d
GOLDFLAGS := -ldflags "-X main.version=$(BUILDREV)"
GOCFLAGS :=
MKDIR := mkdir
INSTALL := install
all: test tlsobs-scanner tlsobs-api tlsobs tlsobs-runner
tlsobs-scanner:
echo building TLS Observatory Scanner for $(OS)/$(ARCH)
$(MKDIR) -p $(BINDIR)
$(GO) build $(GOOPTS) -o $(BINDIR)/tlsobs-scanner-$(BUILDREV)$(BINSUFFIX) $(GOLDFLAGS) github.com/mozilla/tls-observatory/tlsobs-scanner
[ -x "$(BINDIR)/tlsobs-scanner-$(BUILDREV)$(BINSUFFIX)" ] && echo SUCCESS && exit 0
tlsobs-api:
echo building tlsobs-api for $(OS)/$(ARCH)
$(MKDIR) -p $(BINDIR)
$(GO) build $(GOOPTS) -o $(BINDIR)/tlsobs-api-$(BUILDREV)$(BINSUFFIX) $(GOLDFLAGS) github.com/mozilla/tls-observatory/tlsobs-api
[ -x "$(BINDIR)/tlsobs-api-$(BUILDREV)$(BINSUFFIX)" ] && echo SUCCESS && exit 0
tlsobs:
echo building tlsobs client for $(OS)/$(ARCH)
$(MKDIR) -p $(BINDIR)
$(GO) build $(GOOPTS) -o $(BINDIR)/tlsobs-$(BUILDREV)$(BINSUFFIX) $(GOLDFLAGS) github.com/mozilla/tls-observatory/tlsobs
[ -x "$(BINDIR)/tlsobs-$(BUILDREV)$(BINSUFFIX)" ] && echo SUCCESS && exit 0
tlsobs-runner:
echo building tlsobs-runner for $(OS)/$(ARCH)
$(MKDIR) -p $(BINDIR)
$(GO) build $(GOOPTS) -o $(BINDIR)/tlsobs-runner-$(BUILDREV)$(BINSUFFIX) $(GOLDFLAGS) github.com/mozilla/tls-observatory/tlsobs-runner
[ -x "$(BINDIR)/tlsobs-runner-$(BUILDREV)$(BINSUFFIX)" ] && echo SUCCESS && exit 0
go_vendor_dependencies:
$(GOGETTER) github.com/Sirupsen/logrus
$(GOGETTER) gopkg.in/gcfg.v1
$(GOGETTER) github.com/jvehent/gozdef
$(GOGETTER) github.com/lib/pq
$(GOGETTER) github.com/gorilla/mux
$(GOGETTER) github.com/gorilla/context
$(GOGETTER) github.com/gorhill/cronexpr
$(GOGETTER) gopkg.in/yaml.v2
echo 'removing .git from vendored pkg and moving them to vendor'
find .tmpdeps/src -type d -name ".git" ! -name ".gitignore" -exec rm -rf {} \; || exit 0
cp -ar .tmpdeps/src/* vendor/
rm -rf .tmpdeps
test:
$(GO) test github.com/mozilla/tls-observatory/worker/mozillaEvaluationWorker/
$(GO) test github.com/mozilla/tls-observatory/tlsobs-runner
.PHONY: all test clean tlsobs-scanner tlsobs-api tlsobs-runner tlsobs