summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile127
1 files changed, 127 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0fde165
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,127 @@
+# Veilith Portable - Makefile
+# Builds portable executables for Windows, Linux, and Android
+
+# Configuration
+VERSION := 0.9
+BUILD_DATE := $(shell date +%Y%m%d)
+OUTPUT_DIR := veilith-portable-v$(VERSION)
+LDFLAGS := -s -w -X main.Version=$(VERSION) -X main.BuildDate=$(BUILD_DATE)
+
+# Colors for output
+GREEN := \033[0;32m
+YELLOW := \033[1;33m
+BLUE := \033[0;34m
+RED := \033[0;31m
+NC := \033[0m
+
+.PHONY: all clean windows linux android portable help test install-deps
+
+# Default target
+all: portable
+
+# Help
+help:
+ @echo "Veilith Portable Build System v$(VERSION)"
+ @echo ""
+ @echo "Usage:"
+ @echo " make portable - Build all portable executables"
+ @echo " make windows - Build Windows executable only"
+ @echo " make linux - Build Linux executable only"
+ @echo " make android - Build Android APK only"
+ @echo " make clean - Clean build artifacts"
+ @echo " make test - Run tests"
+ @echo " make install-deps - Install build dependencies"
+ @echo ""
+
+# Install dependencies
+install-deps:
+ @echo "$(BLUE)[Setup]$(NC) Installing dependencies..."
+ go get fyne.io/fyne/v2
+ go get golang.org/x/crypto/scrypt
+ go get golang.org/x/crypto/nacl/secretbox
+ go get golang.org/x/net/proxy
+ go get github.com/flynn/noise
+ @echo "$(GREEN)✓$(NC) Dependencies installed"
+
+# Build Windows portable
+windows: install-deps
+ @echo "$(BLUE)[Windows]$(NC) Building Windows portable executable..."
+ @mkdir -p $(OUTPUT_DIR)/Windows
+ CGO_ENABLED=1 \
+ GOOS=windows \
+ GOARCH=amd64 \
+ CC=x86_64-w64-mingw32-gcc \
+ go build \
+ -ldflags="$(LDFLAGS) -H windowsgui" \
+ -tags static \
+ -o $(OUTPUT_DIR)/Windows/veilith.exe \
+ ./veilith-main.go
+ @if [ $$? -eq 0 ]; then \
+ echo "$(GREEN)✓$(NC) Windows build complete"; \
+ else \
+ echo "$(RED)✗$(NC) Windows build failed"; \
+ fi
+
+# Build Linux portable
+linux: install-deps
+ @echo "$(BLUE)[Linux]$(NC) Building Linux portable executable..."
+ @mkdir -p $(OUTPUT_DIR)/Linux
+ CGO_ENABLED=1 \
+ GOOS=linux \
+ GOARCH=amd64 \
+ go build \
+ -ldflags="$(LDFLAGS) -extldflags '-static'" \
+ -tags 'osusergo netgo static_build' \
+ -o $(OUTPUT_DIR)/Linux/veilith-linux \
+ ./veilith-main.go
+ @chmod +x $(OUTPUT_DIR)/Linux/veilith-linux
+ @if [ $$? -eq 0 ]; then \
+ echo "$(GREEN)✓$(NC) Linux build complete"; \
+ else \
+ echo "$(RED)✗$(NC) Linux build failed"; \
+ fi
+
+# Build Android APK (placeholder - requires Android SDK)
+android:
+ @echo "$(YELLOW)[Android]$(NC) Android build not yet implemented"
+ @echo " Use build.sh for Android builds"
+
+# Build all portable executables
+portable:
+ @echo "$(BLUE)╔════════════════════════════════════════╗$(NC)"
+ @echo "$(BLUE)║ VEILITH PORTABLE BUILD v$(VERSION) ║$(NC)"
+ @echo "$(BLUE)╚════════════════════════════════════════╝$(NC)"
+ @echo ""
+ @$(MAKE) -s linux
+ @echo ""
+ @echo "$(GREEN)✓ Build complete!$(NC)"
+ @echo "Output: $(OUTPUT_DIR)/"
+
+# Run tests
+test:
+ @echo "$(BLUE)[Test]$(NC) Running tests..."
+ go test -v ./identity/...
+ go test -v ./addressbook/...
+ go test -v ./session/...
+ go test -v ./transport/...
+ @echo "$(GREEN)✓$(NC) Tests complete"
+
+# Clean build artifacts
+clean:
+ @echo "$(YELLOW)[Clean]$(NC) Removing build artifacts..."
+ rm -rf $(OUTPUT_DIR)
+ rm -rf veilith-portable-v*.zip
+ rm -rf veilith-portable-v*.tar.gz
+ @echo "$(GREEN)✓$(NC) Clean complete"
+
+# Package distribution
+package: portable
+ @echo "$(YELLOW)[Package]$(NC) Creating distribution archives..."
+ @if command -v zip > /dev/null; then \
+ zip -r $(OUTPUT_DIR).zip $(OUTPUT_DIR); \
+ echo "$(GREEN)✓$(NC) Created $(OUTPUT_DIR).zip"; \
+ fi
+ @if command -v tar > /dev/null; then \
+ tar -czf $(OUTPUT_DIR).tar.gz $(OUTPUT_DIR); \
+ echo "$(GREEN)✓$(NC) Created $(OUTPUT_DIR).tar.gz"; \
+ fi