-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
52 lines (38 loc) · 1.27 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
GO=go
GOBUILD=$(GO) build
GOINSTALL=$(GO) install
GOTEST=$(GO) test
FLAGS=
LDFLAGS=-w -s
CMDNAME=swaggerui-server
SOURCES=$(shell find . -type f -name "*.go") go.mod
TOOLS_MARKER=.tools_ok
TOOLS_SOURCE=go.mod tools.go
STATIC_PKGNAME=assets
STATIC_DIR=static
STATIC_GO=internal/assets/static.go
all: build
build: $(CMDNAME)
$(CMDNAME): $(SOURCES) $(STATIC_GO)
$(GOBUILD) -o $@ $(FLAGS) -ldflags '$(LDFLAGS)' ./cmd/$(CMDNAME)
check:
$(GOTEST) -coverprofile coverage.txt -covermode=atomic `go list | grep -v 'internal'`
tools: $(TOOLS_MARKER)
$(TOOLS_MARKER): $(TOOLS_SOURCE)
$(GOINSTALL) github.com/go-bindata/go-bindata/...
$(GOINSTALL) github.com/elazarl/go-bindata-assetfs/...
touch $@
# the only target we don't define correctly, because
# we want to treat this as if it was an 'action', instead of
# re-regenerating the static assets "when needed". This was done
# to avoid adding the swagger files to VCS and making the package
# 'go-gettable'
static: tools $(STATIC_DIR)/index.template
go-bindata -fs -pkg $(STATIC_PKGNAME) -prefix $(STATIC_DIR)/ -o $(STATIC_GO) $(STATIC_DIR)/
$(STATIC_DIR)/index.template:
patch $(STATIC_DIR)/index.html index.patch
mv $(STATIC_DIR)/index.html $@
rm -f $(STATIC_DIR)/*.map
clean:
rm -f $(CMDNAME)
.PHONY: all build tools clean static