diff --git a/Makefile b/Makefile index 0de3316..31187b9 100644 --- a/Makefile +++ b/Makefile @@ -30,14 +30,18 @@ clean: # Build for current platform build: - $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME) -ldflags "-X main.version=$(VERSION)" crowsnest.go + CGO_ENABLED=1 $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME) -ldflags "-X main.version=$(VERSION)" crowsnest.go # Build for all platforms build-all: clean @for platform in $(PLATFORMS); do \ for arch in $(ARCHS); do \ echo "Building for $$platform/$$arch..."; \ - GOOS=$$platform GOARCH=$$arch $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME)-$$platform-$$arch -ldflags "-X main.version=$(VERSION)" crowsnest.go; \ + if [ "$$platform" = "windows" ] || [ "$$platform" = "darwin" ]; then \ + GOOS=$$platform GOARCH=$$arch CGO_ENABLED=0 $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME)-$$platform-$$arch -ldflags "-X main.version=$(VERSION)" crowsnest.go; \ + else \ + GOOS=$$platform GOARCH=$$arch CGO_ENABLED=1 $(GO) build -o $(BUILD_DIR)/$(BINARY_NAME)-$$platform-$$arch -ldflags "-X main.version=$(VERSION)" crowsnest.go; \ + fi; \ if [ "$$platform" = "windows" ]; then \ mv $(BUILD_DIR)/$(BINARY_NAME)-$$platform-$$arch $(BUILD_DIR)/$(BINARY_NAME)-$$platform-$$arch.exe; \ fi; \