github.com/kelleygo/clashcore@v1.0.2/Makefile (about) 1 NAME=yiclashcore 2 BINDIR=bin 3 BRANCH=$(shell git branch --show-current) 4 ifeq ($(BRANCH),Alpha) 5 VERSION=alpha-$(shell git rev-parse --short HEAD) 6 else ifeq ($(BRANCH),Beta) 7 VERSION=beta-$(shell git rev-parse --short HEAD) 8 else ifeq ($(BRANCH),) 9 VERSION=$(shell git describe --tags) 10 else 11 VERSION=$(shell git rev-parse --short HEAD) 12 endif 13 14 BUILDTIME=$(shell date -u) 15 GOBUILD=CGO_ENABLED=0 go build -tags with_gvisor -trimpath -ldflags '-X "github.com/kelleygo/clashcore/constant.Version=$(VERSION)" \ 16 -X "github.com/kelleygo/clashcore/constant.BuildTime=$(BUILDTIME)" \ 17 -w -s -buildid=' 18 19 PLATFORM_LIST = \ 20 darwin-amd64-compatible \ 21 darwin-amd64 \ 22 darwin-arm64 \ 23 linux-amd64-compatible \ 24 linux-amd64 \ 25 linux-armv5 \ 26 linux-armv6 \ 27 linux-armv7 \ 28 linux-arm64 \ 29 linux-mips64 \ 30 linux-mips64le \ 31 linux-mips-softfloat \ 32 linux-mips-hardfloat \ 33 linux-mipsle-softfloat \ 34 linux-mipsle-hardfloat \ 35 linux-riscv64 \ 36 linux-loong64 \ 37 android-arm64 \ 38 freebsd-386 \ 39 freebsd-amd64 \ 40 freebsd-arm64 41 42 WINDOWS_ARCH_LIST = \ 43 windows-386 \ 44 windows-amd64-compatible \ 45 windows-amd64 \ 46 windows-arm64 \ 47 windows-arm32v7 48 49 all:linux-amd64 linux-arm64\ 50 darwin-amd64 darwin-arm64\ 51 windows-amd64 windows-arm64\ 52 53 54 darwin-all: darwin-amd64 darwin-arm64 55 56 docker: 57 GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 58 59 darwin-amd64: 60 GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 61 62 darwin-amd64-compatible: 63 GOARCH=amd64 GOOS=darwin GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 64 65 darwin-arm64: 66 GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 67 68 linux-386: 69 GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 70 71 linux-amd64: 72 GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 73 74 linux-amd64-compatible: 75 GOARCH=amd64 GOOS=linux GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 76 77 linux-arm64: 78 GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 79 80 linux-armv5: 81 GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 82 83 linux-armv6: 84 GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 85 86 linux-armv7: 87 GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 88 89 linux-mips-softfloat: 90 GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 91 92 linux-mips-hardfloat: 93 GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 94 95 linux-mipsle-softfloat: 96 GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 97 98 linux-mipsle-hardfloat: 99 GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 100 101 linux-mips64: 102 GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 103 104 linux-mips64le: 105 GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 106 107 linux-riscv64: 108 GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 109 110 linux-loong64: 111 GOARCH=loong64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 112 113 android-arm64: 114 GOARCH=arm64 GOOS=android $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 115 116 freebsd-386: 117 GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 118 119 freebsd-amd64: 120 GOARCH=amd64 GOOS=freebsd GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 121 122 freebsd-arm64: 123 GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@ 124 125 windows-386: 126 GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 127 128 windows-amd64: 129 GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 130 131 windows-amd64-compatible: 132 GOARCH=amd64 GOOS=windows GOAMD64=v1 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 133 134 windows-arm64: 135 GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 136 137 windows-arm32v7: 138 GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe 139 140 gz_releases=$(addsuffix .gz, $(PLATFORM_LIST)) 141 zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST)) 142 143 $(gz_releases): %.gz : % 144 chmod +x $(BINDIR)/$(NAME)-$(basename $@) 145 gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@) 146 147 $(zip_releases): %.zip : % 148 zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe 149 150 all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) 151 152 releases: $(gz_releases) $(zip_releases) 153 154 vet: 155 go test ./... 156 157 lint: 158 golangci-lint run ./... 159 160 clean: 161 rm $(BINDIR)/* 162 163 CLANG ?= clang-14 164 CFLAGS := -O2 -g -Wall -Werror $(CFLAGS) 165 166 ebpf: export BPF_CLANG := $(CLANG) 167 ebpf: export BPF_CFLAGS := $(CFLAGS) 168 ebpf: 169 cd component/ebpf/ && go generate ./...