~rogpeppe/juju-core/438-local-instance-Addresses

1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
1
#
1151.2.1 by Jeroen Vermeulen
Propose a simple Makefile.
2
# Makefile for juju-core.
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
3
#
4
1581.3.8 by Gavin Panella
Put the check for GOPATH right at the top.
5
ifndef GOPATH
6
$(warning You need to set up a GOPATH.  See the README file.)
7
endif
8
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
9
PROJECT := launchpad.net/juju-core
1581.3.13 by Gavin Panella
Fix typo.
10
PROJECT_DIR := $(shell go list -e -f '{{.Dir}}' $(PROJECT))
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
11
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
12
define DEPENDENCIES
13
  build-essential
14
  bzr
15
  distro-info-data
16
  git-core
1581.3.6 by Gavin Panella
Merge trunk, resolving conflicts in Makefile.
17
  golang
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
18
  mercurial
1581.3.6 by Gavin Panella
Merge trunk, resolving conflicts in Makefile.
19
  mongodb-server
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
20
  zip
21
endef
22
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
23
default: build
24
25
# Start of GOPATH-dependent targets. Some targets only make sense -
26
# and will only work - when this tree is found on the GOPATH.
27
ifeq ($(CURDIR),$(PROJECT_DIR))
28
29
build:
30
	go build $(PROJECT)/...
31
32
check:
33
	go test $(PROJECT)/...
34
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
35
install:
36
	go install -v $(PROJECT)/...
37
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
38
clean:
39
	go clean $(PROJECT)/...
40
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
41
else # --------------------------------
42
43
build:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
44
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
45
46
check:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
47
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
48
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
49
install:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
50
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
51
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
52
clean:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
53
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
54
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
55
endif
56
# End of GOPATH-dependent targets.
1151.2.1 by Jeroen Vermeulen
Propose a simple Makefile.
57
1581.3.17 by Gavin Panella
At the suggestion of Roger Peppe, don't treat format as an alias for simplify.
58
# Reformat source files.
59
format:
60
	gofmt -w -l .
1581.3.5 by Gavin Panella
Use gofmt for consistency, and move simplify next to format.
61
1581.3.15 by Gavin Panella
Always simplify; don't distinguish between formatting and simplifying.
62
# Reformat and simplify source files.
1581.3.5 by Gavin Panella
Use gofmt for consistency, and move simplify next to format.
63
simplify:
64
	gofmt -w -l -s .
65
1581.3.6 by Gavin Panella
Merge trunk, resolving conflicts in Makefile.
66
# Install packages required to develop Juju and run tests. The stable
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
67
# PPA includes the required mongodb-server binaries. However, neither
68
# PPA works on Saucy just yet.
1253.2.1 by Jeroen Vermeulen
Add 'make' target for installing required packages.
69
install-dependencies:
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
70
ifneq ($(shell lsb_release -cs),saucy)
1614.2.1 by Michael Nelson
Update and simplify README
71
	@echo Adding juju PPAs for golang and mongodb-server
1581.3.10 by Gavin Panella
Assume yes to all APT manipulations.
72
	@sudo apt-add-repository --yes ppa:juju/golang
73
	@sudo apt-add-repository --yes ppa:juju/stable
1614.2.1 by Michael Nelson
Update and simplify README
74
	@sudo apt-get update
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
75
endif
1614.2.1 by Michael Nelson
Update and simplify README
76
	@echo Installing dependencies
1581.3.10 by Gavin Panella
Assume yes to all APT manipulations.
77
	@sudo apt-get --yes install $(strip $(DEPENDENCIES))
1581.3.6 by Gavin Panella
Merge trunk, resolving conflicts in Makefile.
78
79
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
80
.PHONY: build check install
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
81
.PHONY: clean format simplify
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
82
.PHONY: install-dependencies