# Wordle Bot Makefile BINARY_NAME=wordle-bot GO=go INSTALL_DIR=/usr/local/bin SERVICE_DIR=/usr/local/etc/rc.d SERVICE_NAME=wordle_bot .PHONY: all build clean install uninstall deps test run all: build # Download dependencies deps: $(GO) mod tidy $(GO) mod download $(GO) mod verify # Build the binary build: deps $(GO) build -ldflags="-s -w" -o $(BINARY_NAME) ./cmd/wordle-bot # Build with debug symbols build-debug: $(GO) build -o $(BINARY_NAME) ./cmd/wordle-bot # Run tests (when you add them) test: $(GO) test -v ./... # Run the bot (for testing) run: build ./$(BINARY_NAME) # Clean build artifacts clean: rm -f $(BINARY_NAME) rm -f wordle_scores.json rm -f bot_config.json rm -f wordle-bot.log rm -f wordle-bot.pid # Install the binary (requires root/sudo) # Note: Service installation varies by OS - see README for details install: build install -m 755 $(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME) @echo "" @echo "Installation complete!" @echo "Binary installed to $(INSTALL_DIR)/$(BINARY_NAME)" @echo "" @echo "See README.md for service setup instructions for your OS" # Uninstall the binary (requires root/sudo) uninstall: rm -f $(INSTALL_DIR)/$(BINARY_NAME) @echo "Binary uninstalled from $(INSTALL_DIR)/$(BINARY_NAME)" # Build for different platforms build-linux-amd64: GOOS=linux GOARCH=amd64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-linux-amd64 ./cmd/wordle-bot build-linux-arm64: GOOS=linux GOARCH=arm64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-linux-arm64 ./cmd/wordle-bot build-darwin-amd64: GOOS=darwin GOARCH=amd64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-darwin-amd64 ./cmd/wordle-bot build-darwin-arm64: GOOS=darwin GOARCH=arm64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-darwin-arm64 ./cmd/wordle-bot build-windows-amd64: GOOS=windows GOARCH=amd64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-windows-amd64.exe ./cmd/wordle-bot build-freebsd-amd64: GOOS=freebsd GOARCH=amd64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-freebsd-amd64 ./cmd/wordle-bot build-freebsd-arm64: GOOS=freebsd GOARCH=arm64 $(GO) build -ldflags="-s -w" -o $(BINARY_NAME)-freebsd-arm64 ./cmd/wordle-bot build-all: build-linux-amd64 build-linux-arm64 build-darwin-amd64 build-darwin-arm64 build-windows-amd64 build-freebsd-amd64 build-freebsd-arm64 @echo "Built binaries for all platforms" # Compress binary with upx (if installed) compress: build @if command -v upx >/dev/null 2>&1; then \ upx --best $(BINARY_NAME); \ else \ echo "upx not installed. Install with: pkg install upx"; \ fi help: @echo "Available targets:" @echo " make build - Build the bot binary" @echo " make install - Install bot binary (requires root/sudo)" @echo " make uninstall - Remove bot binary (requires root/sudo)" @echo " make clean - Remove build artifacts" @echo " make deps - Download Go dependencies" @echo " make test - Run tests" @echo " make run - Build and run the bot" @echo " make compress - Compress binary with upx" @echo " make build-linux-amd64 - Cross-compile for Linux x86_64" @echo " make build-linux-arm64 - Cross-compile for Linux ARM64" @echo " make build-darwin-amd64 - Cross-compile for macOS x86_64" @echo " make build-darwin-arm64 - Cross-compile for macOS ARM64 (Apple Silicon)" @echo " make build-windows-amd64 - Cross-compile for Windows x86_64" @echo " make build-freebsd-amd64 - Cross-compile for FreeBSD x86_64" @echo " make build-freebsd-arm64 - Cross-compile for FreeBSD ARM64" @echo " make build-all - Build for all platforms"