github.com/yaling888/clash@v1.53.0/Makefile (about)

     1  NAME=clash-plus-pro
     2  BINDIR=bin
     3  VERSION=$(shell git describe --tags --always || echo "unknown version")
     4  BUILDTIME=$(shell date -u +'%FT%TZ')
     5  GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/yaling888/clash/constant.Version=$(VERSION)" \
     6  		-X "github.com/yaling888/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-softfloat-without-gvisor \
    22  	linux-mips-hardfloat \
    23  	linux-mips-hardfloat-without-gvisor \
    24  	linux-mipsle-softfloat \
    25  	linux-mipsle-softfloat-without-gvisor \
    26  	linux-mipsle-hardfloat \
    27  	linux-mipsle-hardfloat-without-gvisor \
    28  	linux-mips64 \
    29  	linux-mips64-without-gvisor \
    30  	linux-mips64le \
    31  	linux-mips64le-without-gvisor \
    32  	linux-riscv64 \
    33  	linux-loong64 \
    34  	freebsd-386 \
    35  	freebsd-amd64 \
    36  	freebsd-amd64-v3 \
    37  	freebsd-arm64
    38  
    39  WINDOWS_ARCH_LIST = \
    40  	windows-386 \
    41  	windows-amd64 \
    42  	windows-amd64-v3 \
    43  	windows-arm64 \
    44  	windows-armv7
    45  
    46  all: linux-amd64 darwin-amd64 windows-amd64 # Most used
    47  
    48  docker:
    49  	$(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    50  
    51  darwin-amd64:
    52  	GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    53  
    54  darwin-amd64-v3:
    55  	GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    56  
    57  darwin-amd64-v3-without-gvisor:
    58  	GOARCH=amd64 GOOS=darwin GOAMD64=v3 $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
    59  
    60  darwin-arm64:
    61  	GOARCH=arm64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    62  
    63  linux-386:
    64  	GOARCH=386 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    65  
    66  linux-amd64:
    67  	GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    68  
    69  linux-amd64-v3:
    70  	GOARCH=amd64 GOOS=linux GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    71  
    72  linux-armv5:
    73  	GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    74  
    75  linux-armv6:
    76  	GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    77  
    78  linux-armv7:
    79  	GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    80  
    81  linux-arm64:
    82  	GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    83  
    84  linux-mips-softfloat:
    85  	GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    86  
    87  linux-mips-softfloat-without-gvisor:
    88  	GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
    89  
    90  linux-mips-hardfloat:
    91  	GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    92  
    93  linux-mips-hardfloat-without-gvisor:
    94  	GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
    95  
    96  linux-mipsle-softfloat:
    97  	GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
    98  
    99  linux-mipsle-softfloat-without-gvisor:
   100  	GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
   101  
   102  linux-mipsle-hardfloat:
   103  	GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   104  
   105  linux-mipsle-hardfloat-without-gvisor:
   106  	GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
   107  
   108  linux-mips64:
   109  	GOARCH=mips64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   110  
   111  linux-mips64-without-gvisor:
   112  	GOARCH=mips64 GOOS=linux $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
   113  
   114  linux-mips64le:
   115  	GOARCH=mips64le GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   116  
   117  linux-mips64le-without-gvisor:
   118  	GOARCH=mips64le GOOS=linux $(GOBUILD) -tags nogvisor -o $(BINDIR)/$(NAME)-$@
   119  
   120  linux-riscv64:
   121  	GOARCH=riscv64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   122  
   123  linux-loong64:
   124  	GOARCH=loong64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   125  
   126  freebsd-386:
   127  	GOARCH=386 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   128  
   129  freebsd-amd64:
   130  	GOARCH=amd64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   131  
   132  freebsd-amd64-v3:
   133  	GOARCH=amd64 GOOS=freebsd GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   134  
   135  freebsd-arm64:
   136  	GOARCH=arm64 GOOS=freebsd $(GOBUILD) -o $(BINDIR)/$(NAME)-$@
   137  
   138  windows-386:
   139  	GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
   140  
   141  windows-amd64:
   142  	GOARCH=amd64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
   143  
   144  windows-amd64-v3:
   145  	GOARCH=amd64 GOOS=windows GOAMD64=v3 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
   146  
   147  windows-arm64:
   148  	GOARCH=arm64 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
   149  
   150  windows-armv7:
   151  	GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe
   152  
   153  gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
   154  zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
   155  
   156  $(gz_releases): %.gz : %
   157  	chmod +x $(BINDIR)/$(NAME)-$(basename $@)
   158  	gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)
   159  
   160  $(zip_releases): %.zip : %
   161  	zip -m -j $(BINDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(BINDIR)/$(NAME)-$(basename $@).exe
   162  
   163  all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST)
   164  
   165  releases: $(gz_releases) $(zip_releases)
   166  
   167  vet:
   168  	go test ./...
   169  
   170  lint_os_list := darwin windows linux freebsd openbsd
   171  
   172  lint: $(foreach os,$(lint_os_list),$(os)-lint)
   173  %-lint:
   174  	GOOS=$* golangci-lint run ./...
   175  
   176  lint-fix: $(foreach os,$(lint_os_list),$(os)-lint-fix)
   177  %-lint-fix:
   178  	GOOS=$* golangci-lint run --fix ./...
   179  
   180  clean:
   181  	rm -rf $(BINDIR)/*
   182  
   183  CLANG ?= clang-14
   184  CFLAGS := -O2 -g -Wall -Werror $(CFLAGS)
   185  
   186  ebpf: export BPF_CLANG := $(CLANG)
   187  ebpf: export BPF_CFLAGS := $(CFLAGS)
   188  ebpf:
   189  	cd component/ebpf/ && go generate ./...