feat: add build for all mac, win and linux

This commit is contained in:
Urko 2023-07-10 12:56:25 +02:00
parent b8b5d133a6
commit ad90f771ad
1 changed files with 29 additions and 5 deletions

View File

@ -1,19 +1,43 @@
BIN_DIR := ./bin BIN_DIR := ./bin
APP_NAME := backblaze-backup APP_NAME := backblaze-backup
.PHONY: local_run .PHONY: local_run
local_run: local_run:
go run ./cmd/main.go --dir "$(DIR)" --bucket "$(BUCKET)" go run ./cmd/main.go --dir "$(DIR)" --bucket "$(BUCKET)"
.PHONY: build_windows .PHONY: build_linux_amd64
build_windows: build_linux_amd64:
@mkdir -p $(BIN_DIR) @mkdir -p $(BIN_DIR)
GOOS=windows GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME).exe GOOS=linux GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME)_linux_amd64
.PHONY: build_linux_arm64
build_linux_arm64:
@mkdir -p $(BIN_DIR)
GOOS=linux GOARCH=arm64 go build -o $(BIN_DIR)/$(APP_NAME)_linux_arm64
.PHONY: build_windows_amd64
build_windows_amd64:
@mkdir -p $(BIN_DIR)
GOOS=windows GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME)_windows_amd64.exe
.PHONY: build_windows_386
build_windows_386:
@mkdir -p $(BIN_DIR)
GOOS=windows GOARCH=386 go build -o $(BIN_DIR)/$(APP_NAME)_windows_386.exe
.PHONY: build_mac_amd64
build_mac_amd64:
@mkdir -p $(BIN_DIR)
GOOS=darwin GOARCH=amd64 go build -o $(BIN_DIR)/$(APP_NAME)_mac_amd64
.PHONY: build_mac_arm64
build_mac_arm64:
@mkdir -p $(BIN_DIR)
GOOS=darwin GOARCH=arm64 go build -o $(BIN_DIR)/$(APP_NAME)_mac_arm64
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf $(BIN_DIR) rm -rf $(BIN_DIR)
.PHONY: rebuild .PHONY: rebuild
rebuild: clean build_windows rebuild: clean build_linux_amd64 build_linux_arm64 build_windows_amd64 build_windows_386 build_mac_amd64 build_mac_arm64