golang.org/x/build@v0.0.0-20240506185731-218518f32b70/cmd/buildlet/stage0/Makefile (about)

     1  # Common targets:
     2  #
     3  #  - compile: build all stage0 binaries (but do not upload)
     4  #  - upload: build and upload all stage0 binaries to prod
     5  #  - dev-upload: build and upload all stage0 binaries to dev cluster
     6  #  - docker: build golang/buildlet-stage0 Docker image (but do not push)
     7  #  - install-go: install the version of Go needed by the Makefile
     8  #
     9  # Individual targets:
    10  #
    11  #  - buildlet-stage0.linux-arm64: build stage0 binary for linux-arm64 (but do not upload)
    12  #  - upload.linux-arm64: build stage0 binary for linux-arm64 and upload to prod
    13  #  - dev-upload.linux-arm64: build stage0 binary for linux-arm64 and upload to dev cluster
    14  
    15  #
    16  # The stage0 binaries are typically baked into VM images and container
    17  # images and are NOT downloaded per build or VM/container start-up.
    18  # The only reason we upload them to GCS is because that's where the
    19  # automated VM/container creation scripts download them from.
    20  #
    21  
    22  GO=go1.19
    23  
    24  ALL=\
    25  	buildlet-stage0.illumos-amd64 \
    26  	buildlet-stage0.linux-arm \
    27  	buildlet-stage0.linux-arm64 \
    28  	buildlet-stage0.linux-loong64 \
    29  	buildlet-stage0.linux-mips \
    30  	buildlet-stage0.linux-mips64 \
    31  	buildlet-stage0.linux-mips64le \
    32  	buildlet-stage0.linux-mipsle \
    33  	buildlet-stage0.linux-ppc64 \
    34  	buildlet-stage0.linux-ppc64le \
    35  	buildlet-stage0.linux-s390x \
    36  	buildlet-stage0.solaris-amd64 \
    37  	buildlet-stage0.windows-amd64 \
    38  	buildlet-stage0.windows-arm64 \
    39  
    40  usage: FORCE
    41  	@sed -E '/^$$/q; s/^# ?//' Makefile
    42  	exit 1
    43  
    44  FORCE:
    45  
    46  # A convenience for people who are missing $(GO).
    47  install-go:
    48  	go install golang.org/dl/$(GO)@latest
    49  	$(GO) download
    50  
    51  clean:
    52  	rm -f buildlet-stage0.*-*
    53  
    54  # Compile everything without uploading.
    55  compile: $(ALL)
    56  
    57  GOFILES:=$(shell ls *.go)
    58  
    59  BUILD=CGO_ENABLED=0 $(GO) build -o
    60  
    61  buildlet-stage0.%-arm: $(GOFILES)
    62  	GOOS=$* GOARCH=arm GOARM=7 $(BUILD) $@
    63  
    64  buildlet-stage0.%-arm64: $(GOFILES)
    65  	GOOS=$* GOARCH=arm64 $(BUILD) $@
    66  
    67  buildlet-stage0.%-amd64: $(GOFILES)
    68  	GOOS=$* GOARCH=amd64 $(BUILD) $@
    69  
    70  buildlet-stage0.%-loong64: $(GOFILES)
    71  	GOOS=$* GOARCH=loong64 $(BUILD) $@
    72  
    73  buildlet-stage0.%-mips: $(GOFILES)
    74  	GOOS=$* GOARCH=mips $(BUILD) $@
    75  
    76  buildlet-stage0.%-mipsle: $(GOFILES)
    77  	GOOS=$* GOARCH=mipsle $(BUILD) $@
    78  
    79  buildlet-stage0.%-mips64: $(GOFILES)
    80  	GOOS=$* GOARCH=mips64 $(BUILD) $@
    81  
    82  buildlet-stage0.%-mips64le: $(GOFILES)
    83  	GOOS=$* GOARCH=mips64le $(BUILD) $@
    84  
    85  buildlet-stage0.%-ppc64: $(GOFILES)
    86  	GOOS=$* GOARCH=ppc64 $(BUILD) $@
    87  
    88  buildlet-stage0.%-ppc64le: $(GOFILES)
    89  	GOOS=$* GOARCH=ppc64le $(BUILD) $@
    90  
    91  buildlet-stage0.%-s390x: $(GOFILES)
    92  	GOOS=$* GOARCH=s390x $(BUILD) $@
    93  
    94  docker: Dockerfile
    95  	go install golang.org/x/build/cmd/xb
    96  	xb docker build --force-rm -f Dockerfile --tag=golang/buildlet-stage0 ../../..
    97  
    98  # Upload everything.
    99  upload: $(ALL:buildlet-stage0.%=upload.%)
   100  
   101  UPLOAD=$(GO) run golang.org/x/build/cmd/upload -verbose -public -cacheable=false
   102  
   103  upload.%: buildlet-stage0.%
   104  	$(UPLOAD) -file=$< go-builder-data/$<
   105  
   106  # Upload everything to dev cluster.
   107  dev-upload: $(ALL:buildlet-stage0.%=upload.%)
   108  
   109  dev-upload.%: buildlet-stage0.%
   110  	$(UPLOAD) -file=$< dev-go-builder-data/$<