~jameinel/juju-core/api-registry-tracks-type

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
2378.1.1 by Curtis Hovey
Use the uname arch to select the go compiler; don't assume if golang package is present
12
ifeq ($(shell uname -p | sed -r 's/.*(x86|armel|armhf).*/golang/'), golang)
2375.1.1 by Curtis Hovey
Update Makefile to support juju-mongodb and gccgo depenendencies.
13
	GO_C := golang
2432.1.1 by Tim Penhey
Add install flags to statically link libgo with gccgo.
14
	INSTALL_FLAGS := 
2375.1.1 by Curtis Hovey
Update Makefile to support juju-mongodb and gccgo depenendencies.
15
else
16
	GO_C := gccgo-4.9  gccgo-go
2432.1.1 by Tim Penhey
Add install flags to statically link libgo with gccgo.
17
	INSTALL_FLAGS := -gccgoflags=-static-libgo
2375.1.1 by Curtis Hovey
Update Makefile to support juju-mongodb and gccgo depenendencies.
18
endif
19
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
20
define DEPENDENCIES
21
  build-essential
22
  bzr
23
  distro-info-data
24
  git-core
25
  mercurial
2559.3.1 by Jesse Meek
Don't check for rsyslog-gnutls. Do check for juju-local. Add juju-local to makefile deps
26
  juju-local
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
27
  zip
2375.1.1 by Curtis Hovey
Update Makefile to support juju-mongodb and gccgo depenendencies.
28
  $(GO_C)
1581.3.1 by Gavin Panella
Remove stuff with PROJECT in Makefile; it seems it's not necessary.
29
endef
30
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
31
default: build
32
33
# Start of GOPATH-dependent targets. Some targets only make sense -
34
# and will only work - when this tree is found on the GOPATH.
35
ifeq ($(CURDIR),$(PROJECT_DIR))
36
37
build:
38
	go build $(PROJECT)/...
39
40
check:
41
	go test $(PROJECT)/...
42
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
43
install:
2432.1.1 by Tim Penhey
Add install flags to statically link libgo with gccgo.
44
	go install $(INSTALL_FLAGS) -v $(PROJECT)/...
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
45
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
46
clean:
47
	go clean $(PROJECT)/...
48
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
49
else # --------------------------------
50
51
build:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
52
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
53
54
check:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
55
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
56
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
57
install:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
58
	$(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.
59
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
60
clean:
1581.3.16 by Gavin Panella
Use $@ instead of repeating the target name.
61
	$(error Cannot $@; $(CURDIR) is not on GOPATH)
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
62
1581.3.4 by Gavin Panella
Guard GOPATH-dependent targets.
63
endif
64
# End of GOPATH-dependent targets.
1151.2.1 by Jeroen Vermeulen
Propose a simple Makefile.
65
1581.3.17 by Gavin Panella
At the suggestion of Roger Peppe, don't treat format as an alias for simplify.
66
# Reformat source files.
67
format:
68
	gofmt -w -l .
1581.3.5 by Gavin Panella
Use gofmt for consistency, and move simplify next to format.
69
1581.3.15 by Gavin Panella
Always simplify; don't distinguish between formatting and simplifying.
70
# Reformat and simplify source files.
1581.3.5 by Gavin Panella
Use gofmt for consistency, and move simplify next to format.
71
simplify:
72
	gofmt -w -l -s .
73
1581.3.6 by Gavin Panella
Merge trunk, resolving conflicts in Makefile.
74
# 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.
75
# PPA includes the required mongodb-server binaries. However, neither
76
# PPA works on Saucy just yet.
1253.2.1 by Jeroen Vermeulen
Add 'make' target for installing required packages.
77
install-dependencies:
2179.1.2 by Aaron Bentley
Change default for lsb_release failure to not adding ppas.
78
ifeq ($(shell lsb_release -cs|sed -r 's/precise|quantal|raring/old/'),old)
1614.2.1 by Michael Nelson
Update and simplify README
79
	@echo Adding juju PPAs for golang and mongodb-server
1581.3.10 by Gavin Panella
Assume yes to all APT manipulations.
80
	@sudo apt-add-repository --yes ppa:juju/golang
81
	@sudo apt-add-repository --yes ppa:juju/stable
1614.2.1 by Michael Nelson
Update and simplify README
82
	@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.
83
endif
1614.2.1 by Michael Nelson
Update and simplify README
84
	@echo Installing dependencies
2378.1.1 by Curtis Hovey
Use the uname arch to select the go compiler; don't assume if golang package is present
85
	@sudo apt-get --yes install $(strip $(DEPENDENCIES)) \
86
	$(shell apt-cache madison juju-mongodb mongodb-server | head -1 | cut -d '|' -f1)
1581.3.6 by Gavin Panella
Merge trunk, resolving conflicts in Makefile.
87
2303.2.4 by JuanJo Ciarlante
add 'make install-etc' target, document it at README
88
# Install bash_completion
89
install-etc:
90
	@echo Installing bash completion
91
	@sudo install -o root -g root -m 644 etc/bash_completion.d/juju-core /etc/bash_completion.d
92
1581.3.7 by Gavin Panella
Move install into the GOPATH-dependent section, and don't use the PPAs on Saucy.
93
.PHONY: build check install
1581.3.12 by Gavin Panella
Use go clean instead of find+xargs.
94
.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.
95
.PHONY: install-dependencies