github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/Makefile (about)

     1  NAME = xray
     2  
     3  VERSION=$(shell git describe --always --dirty)
     4  
     5  # NOTE: This MAKEFILE can be used to build Xray-core locally and in Automatic workflows. It is \
     6  	provided for convinience in automatic building and functions as a part of it.
     7  # NOTE: If you need to modify this file, please be aware that:\
     8  	- This file is not the main Makefile; it only accepts environment variables and builds the \
     9  	binary.\
    10  	- Automatic building expects the correct binaries to be built by this Makefile. If you \
    11  	intend to propose a change to this Makefile, carefully review the file below and ensure \
    12  	that the change will not accidently break the automatic building:\
    13  		.github/workflows/release.yml \
    14  	Otherwise it is recommended to contact the project maintainers.
    15  
    16  LDFLAGS = -X github.com/xtls/xray-core/core.build=$(VERSION) -s -w -buildid=
    17  PARAMS = -trimpath -ldflags "$(LDFLAGS)" -v
    18  MAIN = ./main
    19  PREFIX ?= $(shell go env GOPATH)
    20  ifeq ($(GOOS),windows)
    21  OUTPUT = $(NAME).exe
    22  ADDITION = go build -o w$(NAME).exe -trimpath -ldflags "-H windowsgui $(LDFLAGS)" -v $(MAIN)
    23  else
    24  OUTPUT = $(NAME)
    25  endif
    26  ifeq ($(shell echo "$(GOARCH)" | grep -Pq "(mips|mipsle)" && echo true),true) # 
    27  ADDITION = GOMIPS=softfloat go build -o $(NAME)_softfloat -trimpath -ldflags "$(LDFLAGS)" -v $(MAIN)
    28  endif
    29  .PHONY: clean
    30  
    31  build:
    32  	go build -o $(OUTPUT) $(PARAMS) $(MAIN)
    33  	$(ADDITION)
    34  
    35  install:
    36  	go build -o $(PREFIX)/bin/$(OUTPUT) $(PARAMS) $(MAIN)
    37  
    38  clean:
    39  	go clean -v -i $(PWD)
    40  	rm -f xray xray.exe wxray.exe xray_softfloat