Files
iptvc/Makefile
2026-06-01 20:29:34 +08:00

63 lines
1.6 KiB
Makefile

.DEFAULT_GOAL=help
BINARY_NAME := iptvc
GOARCH ?= amd64
## clean: Remove all compiled binaries
clean:
@go clean
@rm -rf bin/
## linux: Build new binaries for linux
linux:
@rm -rf bin/linux_$(GOARCH)
@GOARCH=$(GOARCH) GOOS=linux go build -o bin/linux_$(GOARCH)/$(BINARY_NAME) .
@zip -j bin/linux_$(GOARCH).zip bin/linux_$(GOARCH)/$(BINARY_NAME)
@echo "Compiled: bin/linux_$(GOARCH)/$(BINARY_NAME) ($(GOARCH))"
## win: Build new binaries for windows
win:
@rm -rf bin/windows_$(GOARCH)
@GOARCH=$(GOARCH) GOOS=windows go build -o bin/windows_$(GOARCH)/$(BINARY_NAME).exe .
@zip -j bin/windows_$(GOARCH).zip bin/windows_$(GOARCH)/$(BINARY_NAME).exe
@echo "Compiled: bin/windows_$(GOARCH)/$(BINARY_NAME).exe ($(GOARCH))"
## darwin: Build new binaries for darwin
darwin:
@rm -rf bin/darwin_$(GOARCH)
@GOARCH=$(GOARCH) GOOS=darwin go build -o bin/darwin_$(GOARCH)/$(BINARY_NAME) .
@zip -j bin/darwin_$(GOARCH).zip bin/darwin_$(GOARCH)/$(BINARY_NAME)
@echo "Compiled: bin/darwin_$(GOARCH)/$(BINARY_NAME) ($(GOARCH))"
## release: Build all binaries and zip them
release: clean
@make linux GOARCH=amd64
@make linux GOARCH=arm64
@make win GOARCH=amd64
@make win GOARCH=arm64
@make darwin GOARCH=amd64
@make darwin GOARCH=arm64
## fmt: Format Go source code
fmt:
@go fmt ./...
## vet: Run go vet
vet:
@go vet ./...
## tidy: Tidy and verify Go modules
tidy:
@go mod tidy
@go mod verify
## lint: Run fmt, vet and build as basic linting
lint: fmt vet
@go build -o /dev/null .
@echo "Linting complete"
## help: Show this message and exit
help: Makefile
@echo "Available recipes:"
@sed -n 's/^## //p' $< | column -t -s ':'