-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
108 lines (83 loc) · 2.66 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
# Makefile for the charm store.
ifndef GOPATH
$(warning You need to set up a GOPATH.)
endif
PROJECT := github.com/juju/charmstore
PROJECT_DIR := $(shell go list -e -f '{{.Dir}}' $(PROJECT))
ifeq ($(shell uname -p | sed -r 's/.*(x86|armel|armhf).*/golang/'), golang)
GO_C := golang
INSTALL_FLAGS :=
else
GO_C := gccgo-4.9 gccgo-go
INSTALL_FLAGS := -gccgoflags=-static-libgo
endif
define DEPENDENCIES
build-essential
bzr
juju-mongodb
$(GO_C)
endef
default: build
$(GOPATH)/bin/godeps:
go get -v launchpad.net/godeps
# Start of GOPATH-dependent targets. Some targets only make sense -
# and will only work - when this tree is found on the GOPATH.
ifeq ($(CURDIR),$(PROJECT_DIR))
build:
go build $(PROJECT)/...
check:
go test $(PROJECT)/...
install:
go install $(INSTALL_FLAGS) -v $(PROJECT)/...
clean:
go clean $(PROJECT)/...
else
build:
$(error Cannot $@; $(CURDIR) is not on GOPATH)
check:
$(error Cannot $@; $(CURDIR) is not on GOPATH)
install:
$(error Cannot $@; $(CURDIR) is not on GOPATH)
clean:
$(error Cannot $@; $(CURDIR) is not on GOPATH)
endif
# End of GOPATH-dependent targets.
# Reformat source files.
format:
gofmt -w -l .
# Reformat and simplify source files.
simplify:
gofmt -w -l -s .
# Run the charmd server.
server: install
charmd cmd/charmd/config.yaml
# Update the project Go dependencies to the required revision.
deps: $(GOPATH)/bin/godeps
godeps -u dependencies.tsv
# Generate the dependencies file.
create-deps: $(GOPATH)/bin/godeps
godeps -t $(shell go list $(PROJECT)/...) > dependencies.tsv || true
# Install packages required to develop the charm store and run tests.
sysdeps:
ifeq ($(shell lsb_release -cs|sed -r 's/precise|quantal|raring/old/'),old)
@echo Adding PPAs for golang and mongodb
@sudo apt-add-repository --yes ppa:juju/golang
@sudo apt-add-repository --yes ppa:juju/stable
@sudo apt-get update
endif
@echo Installing dependencies
@sudo apt-get --yes install $(strip $(DEPENDENCIES)) \
$(shell apt-cache madison juju-mongodb mongodb-server | head -1 | cut -d '|' -f1)
help:
@echo -e 'Charmstore - list of make targets:\n'
@echo 'make - Build the package.'
@echo 'make check - Run tests.'
@echo 'make install - Install the package.'
@echo 'make server - Start the charmd server.'
@echo 'make clean - Remove object files from package source directories.'
@echo 'make sysdeps - Install the development environment system packages.'
@echo 'make deps - Set up the project Go dependencies.'
@echo 'make create-deps - Generate the Go dependencies file.'
@echo 'make format - Format the source files.'
@echo 'make simplify - Format and simplify the source files.'
.PHONY: build check install clean format simplify sysdeps help