github.com/igoogolx/clash@v1.19.8/Makefile (about) 1 NAME=clash 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/Dreamacro/clash/constant.Version=$(VERSION)" \ 6 -X "github.com/Dreamacro/clash/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-armv5 \ 17 linux-armv6 \ 18 linux-armv7 \ 19 linux-arm64 \ 20 linux-mips-softfloat \ 21 linux-mips-hardfloat \ 22 linux-mipsle-softfloat \ 23 linux-mipsle-hardfloat \ 24 linux-mips64 \ 25 linux-mips64le \ 26 linux-riscv64 \ 27 linux-loong64 \ 28 freebsd-386 \ 29 freebsd-amd64 \ 30 freebsd-amd64-v3 \ 31 freebsd-arm64 32 33 WINDOWS_ARCH_LIST = \ 34 windows-386 \ 35 windows-amd64 \ 36 windows-amd64-v3 \ 37 windows-arm64 \ 38 windows-armv7 39 40 all: linux-amd64 darwin-amd64 windows-amd64 # Most used 41 42 darwin-amd64: 43 GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 44 45 darwin-amd64-v3: 46 GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 47 48 darwin-arm64: 49 GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 50 51 linux-386: 52 GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 53 54 linux-amd64: 55 GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 56 57 linux-amd64-v3: 58 GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 59 60 linux-armv5: 61 GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 62 63 linux-armv6: 64 GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 65 66 linux-armv7: 67 GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 68 69 linux-arm64: 70 GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 71 72 linux-mips-softfloat: 73 GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 74 75 linux-mips-hardfloat: 76 GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 77 78 linux-mipsle-softfloat: 79 GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 80 81 linux-mipsle-hardfloat: 82 GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 83 84 linux-mips64: 85 GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 86 87 linux-mips64le: 88 GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 89 90 linux-riscv64: 91 GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 92 93 linux-loong64: 94 GOARCH=loong64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 95 96 freebsd-386: 97 GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 98 99 freebsd-amd64: 100 GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 101 102 freebsd-amd64-v3: 103 GOARCH=amd64 GOOS=freebsd GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 104 105 freebsd-arm64: 106 GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 107 108 windows-386: 109 GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 110 111 windows-amd64: 112 GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 113 114 windows-amd64-v3: 115 GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 116 117 windows-arm64: 118 GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 119 120 windows-armv7: 121 GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 122 123 gz_releases=$(addsuffix .gz, $(PLATFORM_LIST)) 124 zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST)) 125 126 $(gz_releases): %.gz : % 127 chmod +x $(BINDIR)/$(NAME)-$(basename $@) 128 gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@) 129 130 $(zip_releases): %.zip : % 131 zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe 132 133 all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) 134 135 releases: $(gz_releases) $(zip_releases) 136 137 LINT_OS_LIST := darwin windows linux freebsd openbsd 138 139 lint: $(foreach os,$(LINT_OS_LIST),$(os)-lint) 140 %-lint: 141 GOOS=$* golangci-lint run ./... 142 143 lint-fix: $(foreach os,$(LINT_OS_LIST),$(os)-lint-fix) 144 %-lint-fix: 145 GOOS=$* golangci-lint run --fix ./... 146 147 clean: 148 rm $(BINDIR)/*