Makefile 1.4 KB

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