diff --git a/.gitignore b/.gitignore index efc821b..3a076a0 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,5 @@ $GOPATH/pkg/mod/cache/ *.code-workspace # macOS specific files -.DS_Store \ No newline at end of file +.DS_Store +build/ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ae40ebb --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# Makefile for GoAIDB - Multi-architecture build support + +BINARY_NAME=goaidb +BUILD_DIR=build +GOOS ?= $(shell go env GOOS) +GOARCH ?= $(shell go env GOARCH) + +.PHONY: all build clean run + +all: linux-amd64 linux-arm64 darwin-amd64 darwin-arm64 windows-amd64 + +$(BUILD_DIR)/%: + mkdir -p $@ + +linux-amd64: | $(BUILD_DIR)/linux-amd64 + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BUILD_DIR)/linux-amd64/$(BINARY_NAME) + +linux-arm64: | $(BUILD_DIR)/linux-arm64 + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(BUILD_DIR)/linux-arm64/$(BINARY_NAME) + +darwin-amd64: | $(BUILD_DIR)/darwin-amd64 + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(BUILD_DIR)/darwin-amd64/$(BINARY_NAME) + +darwin-arm64: | $(BUILD_DIR)/darwin-arm64 + CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o $(BUILD_DIR)/darwin-arm64/$(BINARY_NAME) + +windows-amd64: | $(BUILD_DIR)/windows-amd64 + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(BUILD_DIR)/windows-amd64/$(BINARY_NAME).exe + +build: + go build -o $(BINARY_NAME) + +clean: + rm -rf $(BUILD_DIR)/* $(BINARY_NAME) $(BINARY_NAME).exe + +run: + ./$(BINARY_NAME) \ No newline at end of file