2022-08-13 18:36:49 +08:00
|
|
|
NAME = sing-box
|
|
|
|
|
COMMIT = $(shell git rev-parse --short HEAD)
|
2026-03-02 13:19:57 +08:00
|
|
|
TAGS ?= $(shell cat release/DEFAULT_BUILD_TAGS_OTHERS)
|
2023-03-13 19:46:08 +08:00
|
|
|
|
|
|
|
|
GOHOSTOS = $(shell go env GOHOSTOS)
|
|
|
|
|
GOHOSTARCH = $(shell go env GOHOSTARCH)
|
2025-05-24 07:31:13 +08:00
|
|
|
VERSION=$(shell CGO_ENABLED=0 GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go run github.com/sagernet/sing-box/cmd/internal/read_tag@latest)
|
2023-03-13 19:46:08 +08:00
|
|
|
|
2026-03-02 13:19:57 +08:00
|
|
|
LDFLAGS_SHARED = $(shell cat release/LDFLAGS)
|
|
|
|
|
PARAMS = -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=$(VERSION)' $(LDFLAGS_SHARED) -s -w -buildid="
|
2025-04-11 22:03:10 +08:00
|
|
|
MAIN_PARAMS = $(PARAMS) -tags "$(TAGS)"
|
2022-08-13 18:36:49 +08:00
|
|
|
MAIN = ./cmd/sing-box
|
2023-03-11 19:18:12 +08:00
|
|
|
PREFIX ?= $(shell go env GOPATH)
|
2026-02-12 16:39:50 +08:00
|
|
|
SING_FFI ?= sing-ffi
|
|
|
|
|
LIBBOX_FFI_CONFIG ?= ./experimental/libbox/ffi.json
|
2022-08-12 22:53:46 +08:00
|
|
|
|
2026-05-11 00:59:35 +03:00
|
|
|
ADMIN_PANEL_DIR = service/admin_panel
|
|
|
|
|
ADMIN_PANEL_WEB = $(ADMIN_PANEL_DIR)/web
|
|
|
|
|
ADMIN_PANEL_DIST = $(ADMIN_PANEL_DIR)/dist
|
|
|
|
|
ADMIN_PANEL_TAGS = $(TAGS),with_admin_panel
|
|
|
|
|
|
|
|
|
|
DOCKER_IMAGE ?= shtorm7/sing-box-extended
|
|
|
|
|
DOCKER_PLATFORMS ?= linux/amd64,linux/arm64
|
|
|
|
|
|
2026-05-29 23:11:38 +03:00
|
|
|
CRONET_GO_PATH ?= $(shell pwd)/cronet-go
|
|
|
|
|
|
2024-03-15 16:22:43 +08:00
|
|
|
.PHONY: test release docs build
|
2022-08-12 22:53:46 +08:00
|
|
|
|
|
|
|
|
build:
|
2025-04-06 19:14:41 +08:00
|
|
|
export GOTOOLCHAIN=local && \
|
2023-08-11 15:44:04 +08:00
|
|
|
go build $(MAIN_PARAMS) $(MAIN)
|
|
|
|
|
|
2026-05-29 04:38:59 +03:00
|
|
|
build_admin_panel:
|
2026-05-11 00:59:35 +03:00
|
|
|
cd $(ADMIN_PANEL_WEB) && \
|
|
|
|
|
npm install --no-fund --no-audit && \
|
|
|
|
|
npm run build
|
|
|
|
|
go run ./cmd/internal/admin_panel_pack \
|
|
|
|
|
-dir $(ADMIN_PANEL_DIST)
|
|
|
|
|
|
2026-05-29 23:11:38 +03:00
|
|
|
build_naive:
|
|
|
|
|
cd $(CRONET_GO_PATH) && \
|
|
|
|
|
for arch in amd64 arm64 386 arm mipsle mips64le riscv64 loong64; do \
|
|
|
|
|
go run ./cmd/build-naive --target=linux/$$arch download-toolchain; \
|
|
|
|
|
done && \
|
|
|
|
|
for arch in amd64 arm64 386 arm mipsle riscv64 loong64; do \
|
|
|
|
|
go run ./cmd/build-naive --target=linux/$$arch --libc=musl download-toolchain; \
|
|
|
|
|
done
|
|
|
|
|
|
2025-09-12 18:04:44 +08:00
|
|
|
race:
|
|
|
|
|
export GOTOOLCHAIN=local && \
|
|
|
|
|
go build -race $(MAIN_PARAMS) $(MAIN)
|
|
|
|
|
|
2023-08-11 15:44:04 +08:00
|
|
|
ci_build:
|
2025-04-06 19:14:41 +08:00
|
|
|
export GOTOOLCHAIN=local && \
|
|
|
|
|
go build $(PARAMS) $(MAIN) && \
|
2023-08-11 15:44:04 +08:00
|
|
|
go build $(MAIN_PARAMS) $(MAIN)
|
2022-08-12 22:53:46 +08:00
|
|
|
|
2024-09-23 22:12:19 +08:00
|
|
|
generate_completions:
|
2025-04-11 22:03:10 +08:00
|
|
|
go run -v --tags "$(TAGS),generate,generate_completions" $(MAIN)
|
2024-09-23 22:12:19 +08:00
|
|
|
|
2022-08-12 22:53:46 +08:00
|
|
|
install:
|
2023-09-16 21:36:06 +08:00
|
|
|
go build -o $(PREFIX)/bin/$(NAME) $(MAIN_PARAMS) $(MAIN)
|
2022-08-12 22:53:46 +08:00
|
|
|
|
|
|
|
|
fmt:
|
2026-05-29 01:31:57 +03:00
|
|
|
@golangci-lint fmt
|
2022-08-12 22:53:46 +08:00
|
|
|
|
2025-12-26 16:19:26 +08:00
|
|
|
fmt_docs:
|
|
|
|
|
go run ./cmd/internal/format_docs
|
|
|
|
|
|
2022-08-12 22:53:46 +08:00
|
|
|
lint:
|
|
|
|
|
GOOS=linux golangci-lint run ./...
|
2022-08-17 20:15:35 +08:00
|
|
|
GOOS=android golangci-lint run ./...
|
2022-08-12 22:53:46 +08:00
|
|
|
GOOS=windows golangci-lint run ./...
|
|
|
|
|
GOOS=darwin golangci-lint run ./...
|
2026-05-29 01:31:57 +03:00
|
|
|
# GOOS=freebsd golangci-lint run ./...
|
2022-08-12 22:53:46 +08:00
|
|
|
|
2022-08-15 00:25:49 +08:00
|
|
|
lint_install:
|
2025-12-31 01:36:25 +08:00
|
|
|
go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest
|
2022-08-21 13:03:19 +08:00
|
|
|
|
2022-08-22 18:53:47 +08:00
|
|
|
proto:
|
|
|
|
|
@go run ./cmd/internal/protogen
|
|
|
|
|
@gofumpt -l -w .
|
|
|
|
|
@gofumpt -l -w .
|
|
|
|
|
|
|
|
|
|
proto_install:
|
|
|
|
|
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
|
|
|
|
go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
|
|
|
|
|
2025-01-08 10:34:45 +08:00
|
|
|
update_certificates:
|
|
|
|
|
go run ./cmd/internal/update_certificates
|
|
|
|
|
|
2026-05-29 23:11:38 +03:00
|
|
|
release: build_admin_panel build_naive
|
|
|
|
|
CRONET_GO_PATH=$(CRONET_GO_PATH) go run ./cmd/internal/build goreleaser release --skip=validate --clean -p 3 --skip publish
|
2022-08-26 16:33:12 +08:00
|
|
|
mkdir dist/release
|
2024-02-22 21:03:51 +08:00
|
|
|
mv dist/*.tar.gz \
|
|
|
|
|
dist/*.zip \
|
|
|
|
|
dist/release
|
2024-12-03 14:10:33 +08:00
|
|
|
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release
|
2026-05-30 01:01:18 +03:00
|
|
|
./codeberg-release.sh --replace --draft --prerelease -p 5 "v${VERSION}" dist/release
|
2023-10-21 12:00:00 +08:00
|
|
|
rm -r dist/release
|
2022-08-26 16:33:12 +08:00
|
|
|
|
2024-03-12 22:01:18 +08:00
|
|
|
release_repo:
|
|
|
|
|
go run ./cmd/internal/build goreleaser release -f .goreleaser.fury.yaml --clean
|
|
|
|
|
|
2022-08-26 16:33:12 +08:00
|
|
|
release_install:
|
2022-08-21 13:03:19 +08:00
|
|
|
go install -v github.com/tcnksm/ghr@latest
|
2022-08-15 00:25:49 +08:00
|
|
|
|
2026-05-11 00:59:35 +03:00
|
|
|
release_docker:
|
|
|
|
|
sudo docker buildx build \
|
|
|
|
|
--platform $(DOCKER_PLATFORMS) \
|
|
|
|
|
-t $(DOCKER_IMAGE):latest \
|
|
|
|
|
-t $(DOCKER_IMAGE):$(VERSION) \
|
|
|
|
|
--push \
|
|
|
|
|
--network=host \
|
|
|
|
|
.
|
|
|
|
|
|
2023-08-30 17:35:40 +08:00
|
|
|
update_android_version:
|
2023-08-27 21:14:10 +08:00
|
|
|
go run ./cmd/internal/update_android_version
|
2023-08-30 17:35:40 +08:00
|
|
|
|
2023-08-31 14:56:01 +08:00
|
|
|
build_android:
|
2026-03-10 04:25:01 +03:00
|
|
|
cd ../sing-box-for-android && ./gradlew :app:clean :app:assembleOtherRelease && ./gradlew --stop
|
2023-08-31 14:56:01 +08:00
|
|
|
|
|
|
|
|
upload_android:
|
|
|
|
|
mkdir -p dist/release_android
|
2026-01-17 06:47:38 +08:00
|
|
|
cp ../sing-box-for-android/app/build/outputs/apk/other/release/*.apk dist/release_android
|
2024-12-03 14:10:33 +08:00
|
|
|
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_android
|
2026-05-30 01:01:18 +03:00
|
|
|
./codeberg-release.sh --replace --draft --prerelease -p 5 "v${VERSION}" dist/release_android
|
2023-08-31 14:56:01 +08:00
|
|
|
rm -rf dist/release_android
|
2023-08-27 21:14:10 +08:00
|
|
|
|
2026-06-04 01:47:50 +03:00
|
|
|
release_android: lib_android update_android_version build_android upload_android
|
2023-08-30 17:35:40 +08:00
|
|
|
|
2023-08-27 21:14:10 +08:00
|
|
|
publish_android:
|
2024-11-14 14:11:32 +08:00
|
|
|
cd ../sing-box-for-android && ./gradlew :app:publishPlayReleaseBundle && ./gradlew --stop
|
2024-09-12 11:38:14 +08:00
|
|
|
|
|
|
|
|
# TODO: find why and remove `-destination 'generic/platform=iOS'`
|
2024-11-27 10:34:20 +08:00
|
|
|
# TODO: remove xcode clean when fix control widget fixed
|
2023-08-27 21:14:10 +08:00
|
|
|
build_ios:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
|
|
|
|
rm -rf build/SFI.xcarchive && \
|
2024-11-27 10:34:20 +08:00
|
|
|
xcodebuild clean -scheme SFI && \
|
2026-01-05 17:46:28 +08:00
|
|
|
xcodebuild archive -scheme SFI -configuration Release -destination 'generic/platform=iOS' -archivePath build/SFI.xcarchive -allowProvisioningUpdates | xcbeautify | grep -A 10 -e "Archive Succeeded" -e "ARCHIVE FAILED" -e "❌"
|
2023-08-27 21:14:10 +08:00
|
|
|
|
|
|
|
|
upload_ios_app_store:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
2023-10-21 12:00:00 +08:00
|
|
|
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
2023-08-27 21:14:10 +08:00
|
|
|
|
2025-06-20 22:07:59 +08:00
|
|
|
export_ios_ipa:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
|
|
|
|
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Export.plist -allowProvisioningUpdates -exportPath build/SFI && \
|
|
|
|
|
cp build/SFI/sing-box.ipa dist/SFI.ipa
|
|
|
|
|
|
|
|
|
|
upload_ios_ipa:
|
|
|
|
|
cd dist && \
|
|
|
|
|
cp SFI.ipa "SFI-${VERSION}.ipa" && \
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "SFI-${VERSION}.ipa"
|
|
|
|
|
|
2023-08-27 21:14:10 +08:00
|
|
|
release_ios: build_ios upload_ios_app_store
|
|
|
|
|
|
|
|
|
|
build_macos:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
|
|
|
|
rm -rf build/SFM.xcarchive && \
|
2026-01-05 17:46:28 +08:00
|
|
|
xcodebuild archive -scheme SFM -configuration Release -archivePath build/SFM.xcarchive -allowProvisioningUpdates | xcbeautify | grep -A 10 -e "Archive Succeeded" -e "ARCHIVE FAILED" -e "❌"
|
2023-08-27 21:14:10 +08:00
|
|
|
|
|
|
|
|
upload_macos_app_store:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
2024-09-12 11:38:14 +08:00
|
|
|
xcodebuild -exportArchive -archivePath build/SFM.xcarchive -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
2023-08-27 21:14:10 +08:00
|
|
|
|
|
|
|
|
release_macos: build_macos upload_macos_app_store
|
|
|
|
|
|
2024-09-12 11:38:14 +08:00
|
|
|
build_macos_standalone:
|
2026-01-05 17:46:28 +08:00
|
|
|
$(MAKE) -C ../sing-box-for-apple archive_macos_standalone
|
2023-08-27 21:14:10 +08:00
|
|
|
|
2024-09-17 18:47:20 +08:00
|
|
|
build_macos_dmg:
|
2026-01-05 17:46:28 +08:00
|
|
|
$(MAKE) -C ../sing-box-for-apple build_macos_dmg
|
|
|
|
|
|
|
|
|
|
build_macos_pkg:
|
|
|
|
|
$(MAKE) -C ../sing-box-for-apple build_macos_pkg
|
2024-09-17 18:47:20 +08:00
|
|
|
|
2024-11-14 14:11:32 +08:00
|
|
|
notarize_macos_dmg:
|
2026-01-05 17:46:28 +08:00
|
|
|
$(MAKE) -C ../sing-box-for-apple notarize_macos_dmg
|
|
|
|
|
|
|
|
|
|
notarize_macos_pkg:
|
|
|
|
|
$(MAKE) -C ../sing-box-for-apple notarize_macos_pkg
|
2024-11-14 14:11:32 +08:00
|
|
|
|
2024-09-17 18:47:20 +08:00
|
|
|
upload_macos_dmg:
|
2026-01-05 17:46:28 +08:00
|
|
|
mkdir -p dist/SFM
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Apple.dmg "dist/SFM/SFM-${VERSION}-Apple.dmg"
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Intel.dmg "dist/SFM/SFM-${VERSION}-Intel.dmg"
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Universal.dmg "dist/SFM/SFM-${VERSION}-Universal.dmg"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Apple.dmg"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Intel.dmg"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Universal.dmg"
|
|
|
|
|
|
|
|
|
|
upload_macos_pkg:
|
|
|
|
|
mkdir -p dist/SFM
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Apple.pkg "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Intel.pkg "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Universal.pkg "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
2023-08-27 21:14:10 +08:00
|
|
|
|
2026-05-29 01:31:57 +03:00
|
|
|
replace_macos_pkg:
|
|
|
|
|
mkdir -p dist/SFM
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Apple.pkg "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Intel.pkg "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM-Universal.pkg "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
|
|
|
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}-Apple.pkg"
|
|
|
|
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}-Intel.pkg"
|
|
|
|
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}-Universal.pkg"
|
|
|
|
|
|
2024-10-30 11:12:31 +08:00
|
|
|
upload_macos_dsyms:
|
2026-01-05 17:46:28 +08:00
|
|
|
mkdir -p dist/SFM
|
|
|
|
|
cd ../sing-box-for-apple/build/SFM.System-universal.xcarchive && zip -r SFM.dSYMs.zip dSYMs
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM.System-universal.xcarchive/SFM.dSYMs.zip "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
2024-10-30 11:12:31 +08:00
|
|
|
|
2026-05-29 01:31:57 +03:00
|
|
|
replace_macos_dsyms:
|
|
|
|
|
mkdir -p dist/SFM
|
|
|
|
|
cd ../sing-box-for-apple/build/SFM.System-universal.xcarchive && zip -r SFM.dSYMs.zip dSYMs
|
|
|
|
|
cp ../sing-box-for-apple/build/SFM.System-universal.xcarchive/SFM.dSYMs.zip "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
|
|
|
|
ghr --replace "v${VERSION}" "dist/SFM/SFM-${VERSION}.dSYMs.zip"
|
|
|
|
|
|
2026-01-05 17:46:28 +08:00
|
|
|
release_macos_standalone: build_macos_pkg notarize_macos_pkg upload_macos_pkg upload_macos_dsyms
|
2023-08-27 21:14:10 +08:00
|
|
|
|
2026-05-29 01:31:57 +03:00
|
|
|
replace_macos_standalone: build_macos_pkg notarize_macos_pkg upload_macos_pkg upload_macos_dsyms
|
|
|
|
|
|
2023-08-27 21:14:10 +08:00
|
|
|
build_tvos:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
|
|
|
|
rm -rf build/SFT.xcarchive && \
|
2026-01-05 17:46:28 +08:00
|
|
|
xcodebuild archive -scheme SFT -configuration Release -archivePath build/SFT.xcarchive -allowProvisioningUpdates | xcbeautify | grep -A 10 -e "Archive Succeeded" -e "ARCHIVE FAILED" -e "❌"
|
2023-08-27 21:14:10 +08:00
|
|
|
|
|
|
|
|
upload_tvos_app_store:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
2024-09-12 11:38:14 +08:00
|
|
|
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
2023-08-27 21:14:10 +08:00
|
|
|
|
2025-06-20 22:07:59 +08:00
|
|
|
export_tvos_ipa:
|
|
|
|
|
cd ../sing-box-for-apple && \
|
|
|
|
|
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Export.plist -allowProvisioningUpdates -exportPath build/SFT && \
|
|
|
|
|
cp build/SFT/sing-box.ipa dist/SFT.ipa
|
|
|
|
|
|
|
|
|
|
upload_tvos_ipa:
|
|
|
|
|
cd dist && \
|
|
|
|
|
cp SFT.ipa "SFT-${VERSION}.ipa" && \
|
|
|
|
|
ghr --replace --draft --prerelease "v${VERSION}" "SFT-${VERSION}.ipa"
|
|
|
|
|
|
2023-08-27 21:14:10 +08:00
|
|
|
release_tvos: build_tvos upload_tvos_app_store
|
|
|
|
|
|
|
|
|
|
update_apple_version:
|
|
|
|
|
go run ./cmd/internal/update_apple_version
|
|
|
|
|
|
2024-12-12 09:34:57 +08:00
|
|
|
update_macos_version:
|
|
|
|
|
MACOS_PROJECT_VERSION=$(shell go run -v ./cmd/internal/app_store_connect next_macos_project_version) go run ./cmd/internal/update_apple_version
|
|
|
|
|
|
2026-02-09 13:33:15 +08:00
|
|
|
release_apple: lib_apple update_apple_version release_ios release_macos release_tvos release_macos_standalone
|
2023-08-30 17:35:40 +08:00
|
|
|
|
2023-08-31 14:56:01 +08:00
|
|
|
release_apple_beta: update_apple_version release_ios release_macos release_tvos
|
2023-08-30 17:35:40 +08:00
|
|
|
|
2024-12-12 09:34:57 +08:00
|
|
|
publish_testflight:
|
2026-01-12 16:27:42 +08:00
|
|
|
go run -v ./cmd/internal/app_store_connect publish_testflight $(filter-out $@,$(MAKECMDGOALS))
|
2024-12-12 09:34:57 +08:00
|
|
|
|
2024-12-12 17:54:05 +08:00
|
|
|
prepare_app_store:
|
|
|
|
|
go run -v ./cmd/internal/app_store_connect prepare_app_store
|
|
|
|
|
|
|
|
|
|
publish_app_store:
|
|
|
|
|
go run -v ./cmd/internal/app_store_connect publish_app_store
|
|
|
|
|
|
2022-08-12 22:53:46 +08:00
|
|
|
test:
|
2022-09-21 18:46:20 +08:00
|
|
|
@go test -v ./... && \
|
2022-09-14 12:56:45 +08:00
|
|
|
cd test && \
|
2022-08-22 12:02:16 +08:00
|
|
|
go mod tidy && \
|
2022-09-21 18:46:20 +08:00
|
|
|
go test -v -tags "$(TAGS_TEST)" .
|
2022-09-25 22:16:24 +08:00
|
|
|
|
2022-09-21 18:46:20 +08:00
|
|
|
test_stdio:
|
|
|
|
|
@go test -v ./... && \
|
|
|
|
|
cd test && \
|
|
|
|
|
go mod tidy && \
|
|
|
|
|
go test -v -tags "$(TAGS_TEST),force_stdio" .
|
2022-08-12 22:53:46 +08:00
|
|
|
|
2023-08-27 21:14:10 +08:00
|
|
|
lib_android:
|
2023-04-13 10:36:22 +08:00
|
|
|
go run ./cmd/internal/build_libbox -target android
|
|
|
|
|
|
2024-12-12 09:34:57 +08:00
|
|
|
lib_apple:
|
|
|
|
|
go run ./cmd/internal/build_libbox -target apple
|
2023-04-13 10:36:22 +08:00
|
|
|
|
2026-02-12 16:39:50 +08:00
|
|
|
lib_windows:
|
|
|
|
|
$(SING_FFI) generate --config $(LIBBOX_FFI_CONFIG) --platform-type csharp
|
2024-12-10 09:58:55 +08:00
|
|
|
|
2026-02-09 13:33:15 +08:00
|
|
|
lib_android_new:
|
2026-02-12 16:39:50 +08:00
|
|
|
$(SING_FFI) generate --config $(LIBBOX_FFI_CONFIG) --platform-type android
|
2024-12-10 09:58:55 +08:00
|
|
|
|
2026-02-09 13:33:15 +08:00
|
|
|
lib_apple_new:
|
2026-02-12 16:39:50 +08:00
|
|
|
$(SING_FFI) generate --config $(LIBBOX_FFI_CONFIG) --platform-type apple
|
2022-10-25 12:55:00 +08:00
|
|
|
|
|
|
|
|
lib_install:
|
2026-02-27 15:00:06 +08:00
|
|
|
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.12
|
|
|
|
|
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.12
|
2022-10-25 12:55:00 +08:00
|
|
|
|
2023-11-09 17:04:08 +08:00
|
|
|
docs:
|
2024-06-24 10:10:49 +08:00
|
|
|
venv/bin/mkdocs serve
|
2023-11-09 17:04:08 +08:00
|
|
|
|
|
|
|
|
publish_docs:
|
2024-06-24 10:10:49 +08:00
|
|
|
venv/bin/mkdocs gh-deploy -m "Update" --force --ignore-version --no-history
|
2023-11-09 17:04:08 +08:00
|
|
|
|
|
|
|
|
docs_install:
|
2026-03-01 18:37:31 +08:00
|
|
|
python3 -m venv venv
|
|
|
|
|
source ./venv/bin/activate && pip install --force-reinstall mkdocs-material=="9.7.2" mkdocs-static-i18n=="1.2.*"
|
2024-06-24 10:10:49 +08:00
|
|
|
|
2022-08-12 22:53:46 +08:00
|
|
|
clean:
|
2022-09-25 22:16:24 +08:00
|
|
|
rm -rf bin dist sing-box
|
2022-08-12 22:53:46 +08:00
|
|
|
rm -f $(shell go env GOPATH)/sing-box
|
|
|
|
|
|
|
|
|
|
update:
|
|
|
|
|
git fetch
|
|
|
|
|
git reset FETCH_HEAD --hard
|
2025-04-11 22:03:10 +08:00
|
|
|
git clean -fdx
|
2026-01-12 16:27:42 +08:00
|
|
|
|
|
|
|
|
%:
|
|
|
|
|
@:
|