github.com/ablease/cli@v6.37.1-0.20180613014814-3adbb7d7fb19+incompatible/Makefile (about)

     1  CF_DIAL_TIMEOUT ?= 15
     2  NODES ?= 4
     3  LC_ALL = "en_US.UTF-8"
     4  
     5  CF_BUILD_VERSION ?= $$(cat BUILD_VERSION)
     6  CF_BUILD_SHA ?= $$(git rev-parse --short HEAD)
     7  CF_BUILD_DATE ?= $$(date -u +"%Y-%m-%d")
     8  LD_FLAGS =-w -s \
     9  	-X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION) \
    10  	-X code.cloudfoundry.org/cli/version.binarySHA=$(CF_BUILD_SHA) \
    11  	-X code.cloudfoundry.org/cli/version.binaryBuildDate=$(CF_BUILD_DATE)
    12  LD_FLAGS_LINUX = -extldflags \"-static\" $(LD_FLAGS)
    13  REQUIRED_FOR_STATIC_BINARY =-a -tags netgo -installsuffix netgo
    14  GOSRC = $(shell find . -name "*.go" ! -name "*test.go" ! -name "*fake*" ! -path "./integration/*")
    15  
    16  all : test build
    17  
    18  build : out/cf-cli_linux_x86-64
    19  	cp out/cf-cli_linux_x86-64 out/cf
    20  
    21  check-target-env :
    22  ifndef CF_INT_API
    23  	$(error CF_INT_API is undefined)
    24  endif
    25  ifndef CF_INT_PASSWORD
    26  	$(error CF_INT_PASSWORD is undefined)
    27  endif
    28  
    29  clean :
    30  	rm -f $(wildcard out/cf*)
    31  
    32  format :
    33  	go fmt ./...
    34  
    35  fly-windows-experimental : check-target-env
    36  	CF_CLI_EXPERIMENTAL=true CF_TEST_SUITE=./integration/experimental fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    37  
    38  fly-windows-isolated : check-target-env
    39  	CF_TEST_SUITE=./integration/isolated fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    40  
    41  fly-windows-plugin : check-target-env
    42  	CF_TEST_SUITE=./integration/plugin fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    43  
    44  fly-windows-push : check-target-env
    45  	CF_TEST_SUITE=./integration/push fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    46  
    47  fly-windows-units :
    48  	fly -t ci execute -c ci/cli/tasks/units-windows.yml -i cli=./ -i cli-ci=./
    49  
    50  integration-cleanup :
    51  	$(PWD)/bin/cleanup-integration
    52  
    53  integration-experimental : build integration-cleanup
    54  	CF_CLI_EXPERIMENTAL=true ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/experimental
    55  
    56  integration-global : build integration-cleanup
    57  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 integration/global
    58  
    59  integration-isolated : build integration-cleanup
    60  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/isolated
    61  
    62  integration-plugin : build integration-cleanup
    63  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/plugin
    64  
    65  integration-push : build integration-cleanup
    66  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/push
    67  
    68  integration-tests : build integration-cleanup
    69  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) integration/isolated integration/push
    70  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 integration/global
    71  	make integration-cleanup
    72  
    73  integration-tests-full : build integration-cleanup
    74  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 -nodes $(NODES) \
    75  		integration/isolated integration/push integration/plugin integration/experimental
    76  	ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60 integration/global
    77  	make integration-cleanup
    78  
    79  lint :
    80  	@echo "style linting files:" # this list will grow as we cleanup all the code
    81  	@bash -c "go run bin/style/main.go api util/{configv3,manifest,randomword,sorting,ui}"
    82  	@echo "No lint errors!"
    83  	@echo
    84  
    85  out/cf-cli_linux_i686 : $(GOSRC)
    86  	CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \
    87  							$(REQUIRED_FOR_STATIC_BINARY) \
    88  							-ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_i686 .
    89  
    90  out/cf-cli_linux_x86-64 : $(GOSRC)
    91  	CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
    92  							$(REQUIRED_FOR_STATIC_BINARY) \
    93  							-ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_x86-64 .
    94  
    95  out/cf-cli_osx : $(GOSRC)
    96  	GOARCH=amd64 GOOS=darwin go build \
    97  				 $(REQUIRED_FOR_STATIC_BINARY) \
    98  				 -ldflags "$(LD_FLAGS)" -o out/cf-cli_osx .
    99  
   100  out/cf-cli_win32.exe : $(GOSRC) rsrc.syso
   101  	GOARCH=386 GOOS=windows go build -tags="forceposix" -o out/cf-cli_win32.exe -ldflags "$(LD_FLAGS)" .
   102  	rm rsrc.syso
   103  
   104  out/cf-cli_winx64.exe : $(GOSRC) rsrc.syso
   105  	GOARCH=amd64 GOOS=windows go build -tags="forceposix" -o out/cf-cli_winx64.exe -ldflags "$(LD_FLAGS)" .
   106  	rm rsrc.syso
   107  
   108  rsrc.syso :
   109  	@# Software for windows icon
   110  	go get github.com/akavel/rsrc
   111  	@# Generates icon file
   112  	rsrc -ico ci/installers/windows/cf.ico
   113  
   114  test : units
   115  
   116  units : format vet lint build
   117  	ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites \
   118  		api actor command types util version
   119  	@echo "\nSWEET SUITE SUCCESS"
   120  
   121  units-full : format vet lint build
   122  	@rm -f $(wildcard fixtures/plugins/*.exe)
   123  	@ginkgo version
   124  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites -skipPackage integration,cf/ssh
   125  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites -flakeAttempts 3 cf/ssh
   126  	@echo "\nSWEET SUITE SUCCESS"
   127  
   128  version :
   129  	@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
   130  
   131  vet :
   132  	@echo  "Vetting packages for potential issues..."
   133  	go tool vet -all -shadow=true ./api ./actor ./command ./integration ./types ./util ./version
   134  	@echo
   135  
   136  .PHONY : all build clean format version vet lint
   137  .PHONY : test units units-full integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
   138  .PHONY : check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push