github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/Makefile (about)

     1  #
     2  # Makefile for juju-core.
     3  #
     4  
     5  ifndef GOPATH
     6  $(warning You need to set up a GOPATH.  See the README file.)
     7  endif
     8  
     9  PROJECT := github.com/juju/juju
    10  PROJECT_DIR := $(shell go list -e -f '{{.Dir}}' $(PROJECT))
    11  
    12  ifeq ($(shell uname -p | sed -r 's/.*(86|armel|armhf).*/golang/'), golang)
    13  	GO_C := golang
    14  	INSTALL_FLAGS := 
    15  else
    16  	GO_C := gccgo-4.9  gccgo-go
    17  	INSTALL_FLAGS := -gccgoflags=-static-libgo
    18  endif
    19  
    20  define DEPENDENCIES
    21    ca-certificates
    22    bzr
    23    distro-info-data
    24    git-core
    25    mercurial
    26    juju-local
    27    zip
    28    $(GO_C)
    29  endef
    30  
    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  ifeq ($(JUJU_MAKE_GODEPS),true)
    38  $(GOPATH)/bin/godeps:
    39  	go get launchpad.net/godeps
    40  
    41  godeps: $(GOPATH)/bin/godeps
    42  	$(GOPATH)/bin/godeps -u dependencies.tsv
    43  else
    44  godeps:
    45  	@echo "skipping godeps"
    46  endif
    47  
    48  build: godeps
    49  	go build $(PROJECT)/...
    50  
    51  check: godeps
    52  	go test -test.timeout=1200s $(PROJECT)/...
    53  
    54  install: godeps
    55  	go install $(INSTALL_FLAGS) -v $(PROJECT)/...
    56  
    57  clean:
    58  	go clean $(PROJECT)/...
    59  
    60  else # --------------------------------
    61  
    62  build:
    63  	$(error Cannot $@; $(CURDIR) is not on GOPATH)
    64  
    65  check:
    66  	$(error Cannot $@; $(CURDIR) is not on GOPATH)
    67  
    68  install:
    69  	$(error Cannot $@; $(CURDIR) is not on GOPATH)
    70  
    71  clean:
    72  	$(error Cannot $@; $(CURDIR) is not on GOPATH)
    73  
    74  endif
    75  # End of GOPATH-dependent targets.
    76  
    77  # Reformat source files.
    78  format:
    79  	gofmt -w -l .
    80  
    81  # Reformat and simplify source files.
    82  simplify:
    83  	gofmt -w -l -s .
    84  
    85  # Install packages required to develop Juju and run tests. The stable
    86  # PPA includes the required mongodb-server binaries.
    87  install-dependencies:
    88  ifeq ($(shell lsb_release -cs|sed -r 's/precise/old/'),old)
    89  	@echo Adding juju PPAs for golang and mongodb-server
    90  	@sudo apt-add-repository --yes ppa:juju/golang
    91  	@sudo apt-add-repository --yes ppa:juju/stable
    92  	@sudo apt-get update
    93  endif
    94  	@echo Installing dependencies
    95  	@sudo apt-get --yes install --no-install-recommends \
    96  	$(strip $(DEPENDENCIES)) \
    97  	$(shell apt-cache madison juju-mongodb mongodb-server | head -1 | cut -d '|' -f1)
    98  
    99  # Install bash_completion
   100  install-etc:
   101  	@echo Installing bash completion
   102  	@sudo install -o root -g root -m 644 etc/bash_completion.d/juju-core /etc/bash_completion.d
   103  
   104  .PHONY: build check install
   105  .PHONY: clean format simplify
   106  .PHONY: install-dependencies