github.com/laof/lite-speed-test@v0.0.0-20230930011949-1f39b7037845/Makefile (about) 1 NAME=lite 2 BINDIR=bin 3 VERSION=$(shell git describe --tags || echo "unknown version") 4 BUILDTIME=$(shell date -u) 5 GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/xxf098/LiteSpeedTest/constant.Version=$(VERSION)" \ 6 -X "github.com/xxf098/LiteSpeedTest/constant.BuildTime=$(BUILDTIME)" \ 7 -w -s -buildid=' 8 9 PLATFORM_LIST = \ 10 darwin-amd64 \ 11 darwin-amd64-v3 \ 12 darwin-arm64 \ 13 linux-386 \ 14 linux-amd64 \ 15 linux-amd64-v3 \ 16 linux-armv7 \ 17 linux-armv8 \ 18 freebsd-386 \ 19 freebsd-amd64 \ 20 freebsd-amd64-v3 \ 21 freebsd-arm64 22 23 WINDOWS_ARCH_LIST = \ 24 windows-386 \ 25 windows-amd64 \ 26 windows-amd64-v3 \ 27 windows-arm64 \ 28 windows-arm32v7 29 30 all: linux-amd64 darwin-amd64 windows-amd64 # Most used 31 32 dockerbin: 33 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 34 35 darwin-amd64: 36 GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 37 38 darwin-amd64-v3: 39 GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 40 41 darwin-arm64: 42 GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 43 44 linux-386: 45 GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 46 47 linux-amd64: 48 GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 49 50 linux-amd64-v3: 51 GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 52 53 linux-armv5: 54 GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 55 56 linux-armv6: 57 GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 58 59 linux-armv7: 60 GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 61 62 linux-armv8: 63 GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 64 65 linux-mips-softfloat: 66 GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 67 68 linux-mips-hardfloat: 69 GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 70 71 linux-mipsle-softfloat: 72 GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 73 74 linux-mipsle-hardfloat: 75 GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 76 77 linux-mips64: 78 GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 79 80 linux-mips64le: 81 GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 82 83 freebsd-386: 84 GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 85 86 freebsd-amd64: 87 GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 88 89 freebsd-amd64-v3: 90 GOARCH=amd64 GOOS=freebsd GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 91 92 freebsd-arm64: 93 GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 94 95 windows-386: 96 GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 97 98 windows-amd64: 99 GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 100 101 windows-amd64-v3: 102 GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 103 104 windows-arm64: 105 GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 106 107 windows-arm32v7: 108 GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 109 110 gz_releases=$(addsuffix .gz, $(PLATFORM_LIST)) 111 zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST)) 112 113 $(gz_releases): %.gz : % 114 chmod +x $(BINDIR)/$(NAME)-$(basename $@) 115 gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@) 116 117 $(zip_releases): %.zip : % 118 zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe 119 120 all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) 121 122 releases: $(gz_releases) $(zip_releases) 123 124 lint: 125 GOOS=darwin golangci-lint run ./... 126 GOOS=windows golangci-lint run ./... 127 GOOS=linux golangci-lint run ./... 128 GOOS=freebsd golangci-lint run ./... 129 130 clean: 131 rm $(BINDIR)/*