github.com/willmadison/cli@v6.40.1-0.20181018160101-29d5937903ff+incompatible/Makefile (about)

     1  CF_DIAL_TIMEOUT ?= 15
     2  NODES ?= 4
     3  PACKAGES ?= api actor command types util version integration/helpers
     4  LC_ALL = "en_US.UTF-8"
     5  
     6  CF_BUILD_VERSION ?= $$(cat BUILD_VERSION)
     7  CF_BUILD_VERSION_V7 ?= $$(cat BUILD_VERSION_V7)
     8  CF_BUILD_SHA ?= $$(git rev-parse --short HEAD)
     9  CF_BUILD_DATE ?= $$(date -u +"%Y-%m-%d")
    10  LD_FLAGS_COMMON=-w -s \
    11  	-X code.cloudfoundry.org/cli/version.binarySHA=$(CF_BUILD_SHA) \
    12  	-X code.cloudfoundry.org/cli/version.binaryBuildDate=$(CF_BUILD_DATE)
    13  LD_FLAGS =$(LD_FLAGS_COMMON) \
    14  	-X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION)
    15  LD_FLAGS_V7 =$(LD_FLAGS_COMMON) \
    16  	-X code.cloudfoundry.org/cli/version.binaryVersion=$(CF_BUILD_VERSION_V7)
    17  LD_FLAGS_LINUX = -extldflags \"-static\" $(LD_FLAGS)
    18  LD_FLAGS_LINUX_V7 = -extldflags \"-static\" $(LD_FLAGS_V7)
    19  REQUIRED_FOR_STATIC_BINARY =-a -tags netgo -installsuffix netgo
    20  REQUIRED_FOR_STATIC_BINARY_V7 =-a -tags "V7 netgo" -installsuffix netgo
    21  GOSRC = $(shell find . -name "*.go" ! -name "*test.go" ! -name "*fake*" ! -path "./integration/*")
    22  UNAME_S := $(shell uname -s)
    23  
    24  ginkgo_int = ginkgo -r -randomizeAllSpecs -slowSpecThreshold 60
    25  
    26  ifndef TARGET_V7
    27  TARGET = v6
    28  else
    29  TARGET = v7
    30  endif
    31  
    32  all : test build
    33  
    34  build : out/cf
    35  
    36  check-target-env :
    37  ifndef CF_INT_API
    38  	$(error CF_INT_API is undefined)
    39  endif
    40  ifndef CF_INT_PASSWORD
    41  	$(error CF_INT_PASSWORD is undefined)
    42  endif
    43  
    44  clean :
    45  	rm -f $(wildcard out/cf*)
    46  
    47  format :
    48  	go fmt ./...
    49  
    50  fly-windows-experimental : check-target-env
    51  	CF_TEST_SUITE=./integration/shared/experimental fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    52  
    53  fly-windows-isolated : check-target-env
    54  	CF_TEST_SUITE=./integration/shared/isolated fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    55  
    56  fly-windows-plugin : check-target-env
    57  	CF_TEST_SUITE=./integration/shared/plugin fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    58  
    59  fly-windows-push : check-target-env
    60  	CF_TEST_SUITE=./integration/v6/push fly -t ci execute -c ci/cli/tasks/integration-windows-oneoff.yml -i cli=./
    61  
    62  fly-windows-global : check-target-env
    63  	CF_TEST_SUITE=./integration/shared/global fly -t ci execute -c ci/cli/tasks/integration-windows-serial.yml -i cli=./
    64  
    65  fly-windows-units :
    66  	fly -t ci execute -c ci/cli/tasks/units-windows.yml -i cli=./ -i cli-ci=./
    67  
    68  integration-cleanup :
    69  	$(PWD)/bin/cleanup-integration
    70  
    71  integration-experimental : build integration-cleanup integration-experimental-shared integration-experimental-versioned
    72  
    73  integration-experimental-shared : build integration-cleanup
    74  	$(ginkgo_int) -nodes $(NODES) integration/shared/experimental
    75  
    76  integration-experimental-versioned : build integration-cleanup
    77  	$(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/experimental
    78  
    79  integration-global : build integration-cleanup integration-global-shared integration-global-versioned
    80  
    81  integration-global-shared : build integration-cleanup
    82  	$(ginkgo_int) integration/shared/global
    83  
    84  integration-global-versioned : build integration-cleanup
    85  	$(ginkgo_int) integration/$(TARGET)/global
    86  
    87  integration-isolated : build integration-cleanup integration-isolated-shared integration-isolated-versioned
    88  
    89  integration-isolated-shared : build integration-cleanup
    90  	$(ginkgo_int) -nodes $(NODES) integration/shared/isolated
    91  
    92  integration-isolated-versioned : build integration-cleanup
    93  	$(ginkgo_int) -nodes $(NODES) integration/$(TARGET)/isolated
    94  
    95  integration-plugin : build integration-cleanup
    96  	$(ginkgo_int) -nodes $(NODES) integration/shared/plugin
    97  
    98  integration-push : build integration-cleanup
    99  	$(ginkgo_int) -nodes $(NODES) integration/v6/push
   100  
   101  integration-tests : build integration-cleanup integration-isolated integration-push integration-global
   102  
   103  integration-tests-full : build integration-cleanup integration-isolated integration-push integration-experimental integration-plugin integration-global
   104  
   105  lint :
   106  	@echo "style linting files:" # this list will grow as we cleanup all the code
   107  	@bash -c "go run bin/style/main.go api util/{configv3,manifest,randomword,sorting,ui}"
   108  	@echo "No lint errors!"
   109  	@echo
   110  
   111  ifeq ($(TARGET),v6)
   112  out/cf : out/cf6
   113  	cp out/cf6 out/cf
   114  else
   115  out/cf : out/cf7
   116  	cp out/cf7 out/cf
   117  endif
   118  
   119  # Build dynamic binary for Darwin
   120  ifeq ($(UNAME_S),Darwin)
   121  out/cf6: $(GOSRC)
   122  	go build -ldflags "$(LD_FLAGS)" -o out/cf6 .
   123  else
   124  out/cf6: $(GOSRC)
   125  	CGO_ENABLED=0 go build \
   126  		$(REQUIRED_FOR_STATIC_BINARY) \
   127  		-ldflags "$(LD_FLAGS_LINUX)" -o out/cf6 .
   128  endif
   129  
   130  # Build dynamic binary for Darwin
   131  ifeq ($(UNAME_S),Darwin)
   132  out/cf7: $(GOSRC)
   133  	go build -tags="V7" -ldflags "$(LD_FLAGS_V7)" -o out/cf7 .
   134  else
   135  out/cf7: $(GOSRC)
   136  	CGO_ENABLED=0 go build \
   137  		$(REQUIRED_FOR_STATIC_BINARY_V7) \
   138  		-ldflags "$(LD_FLAGS_LINUX_V7)" -o out/cf7 .
   139  endif
   140  
   141  out/cf-cli_linux_i686 : $(GOSRC)
   142  	CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \
   143  							$(REQUIRED_FOR_STATIC_BINARY) \
   144  							-ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_i686 .
   145  
   146  out/cf-cli_linux_x86-64 : $(GOSRC)
   147  	CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
   148  							$(REQUIRED_FOR_STATIC_BINARY) \
   149  							-ldflags "$(LD_FLAGS_LINUX)" -o out/cf-cli_linux_x86-64 .
   150  
   151  out/cf-cli_osx : $(GOSRC)
   152  	GOARCH=amd64 GOOS=darwin go build \
   153  				 -a -ldflags "$(LD_FLAGS)" -o out/cf-cli_osx .
   154  
   155  out/cf-cli_win32.exe : $(GOSRC) rsrc.syso
   156  	GOARCH=386 GOOS=windows go build -tags="forceposix" -o out/cf-cli_win32.exe -ldflags "$(LD_FLAGS)" .
   157  	rm rsrc.syso
   158  
   159  out/cf-cli_winx64.exe : $(GOSRC) rsrc.syso
   160  	GOARCH=amd64 GOOS=windows go build -tags="forceposix" -o out/cf-cli_winx64.exe -ldflags "$(LD_FLAGS)" .
   161  	rm rsrc.syso
   162  
   163  out/cf7-cli_linux_i686 : $(GOSRC)
   164  	CGO_ENABLED=0 GOARCH=386 GOOS=linux go build \
   165  							$(REQUIRED_FOR_STATIC_BINARY_V7) \
   166  							-ldflags "$(LD_FLAGS_LINUX_V7)" -o out/cf7-cli_linux_i686 .
   167  
   168  out/cf7-cli_linux_x86-64 : $(GOSRC)
   169  	CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build \
   170  							$(REQUIRED_FOR_STATIC_BINARY_V7) \
   171  							-ldflags "$(LD_FLAGS_LINUX_V7)" -o out/cf7-cli_linux_x86-64 .
   172  
   173  out/cf7-cli_osx : $(GOSRC)
   174  	GOARCH=amd64 GOOS=darwin go build -tags="V7" \
   175  				 -a -ldflags "$(LD_FLAGS_V7)" -o out/cf7-cli_osx .
   176  
   177  out/cf7-cli_win32.exe : $(GOSRC) rsrc.syso
   178  	GOARCH=386 GOOS=windows go build -tags="forceposix V7" -o out/cf7-cli_win32.exe -ldflags "$(LD_FLAGS_V7)" .
   179  	rm rsrc.syso
   180  
   181  out/cf7-cli_winx64.exe : $(GOSRC) rsrc.syso
   182  	GOARCH=amd64 GOOS=windows go build -tags="forceposix V7" -o out/cf7-cli_winx64.exe -ldflags "$(LD_FLAGS_V7)" .
   183  	rm rsrc.syso
   184  
   185  rsrc.syso :
   186  	@# Software for windows icon
   187  	go get github.com/akavel/rsrc
   188  	@# Generates icon file
   189  	rsrc -ico ci/installers/windows/cf.ico
   190  
   191  test : units
   192  
   193  units : format vet lint build
   194  	ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites \
   195  		$(PACKAGES)
   196  	@echo "\nSWEET SUITE SUCCESS"
   197  
   198  units-plugin :
   199  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes 1 -randomizeAllSpecs -randomizeSuites -flakeAttempts 2 -skipPackage integration ./**/plugin* ./plugin
   200  
   201  units-non-plugin :
   202  	@rm -f $(wildcard fixtures/plugins/*.exe)
   203  	@ginkgo version
   204  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites \
   205  		-skipPackage integration,cf/ssh,plugin,cf/actors/plugin,cf/commands/plugin,cf/actors/plugin
   206  	CF_HOME=$(PWD)/fixtures ginkgo -r -nodes $(NODES) -randomizeAllSpecs -randomizeSuites -flakeAttempts 3 cf/ssh
   207  
   208  units-full: format vet lint build units-plugin units-non-plugin
   209  	@echo "\nSWEET SUITE SUCCESS"
   210  
   211  version :
   212  	@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
   213  
   214  vet :
   215  	@echo  "Vetting packages for potential issues..."
   216  	go tool vet -all -shadow=true ./api ./actor ./command ./integration ./types ./util ./version
   217  	@echo
   218  
   219  .PHONY : all build clean format version vet lint
   220  .PHONY : test units units-full integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
   221  .PHONY : check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push