|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +.PHONY: all init download-binaries generate-assets build clean help |
| 19 | + |
| 20 | +# Default target |
| 21 | +all: generate-assets build |
| 22 | + |
| 23 | +# Initialize project (first time setup) |
| 24 | +init: download-binaries |
| 25 | + @echo "Installing Go dependencies..." |
| 26 | + go mod download |
| 27 | + @echo "Project initialized successfully!" |
| 28 | + |
| 29 | +# Download binary dependencies (supervisord, protoc) |
| 30 | +download-binaries: |
| 31 | + @echo "Downloading binary dependencies..." |
| 32 | + @./scripts/download_binaries.sh |
| 33 | + |
| 34 | +# Generate assets (vfsdata.go for web UI) |
| 35 | +generate-assets: |
| 36 | + @echo "Generating assets..." |
| 37 | + @cd asset && go generate |
| 38 | + @echo "Assets generated successfully!" |
| 39 | + |
| 40 | +# Build vermeer binary |
| 41 | +build: |
| 42 | + @echo "Building vermeer..." |
| 43 | + @go build -o vermeer |
| 44 | + @echo "Build completed: ./vermeer" |
| 45 | + |
| 46 | +# Build for specific platform |
| 47 | +build-linux-amd64: |
| 48 | + @echo "Building for linux/amd64..." |
| 49 | + @CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o vermeer |
| 50 | + |
| 51 | +build-linux-arm64: |
| 52 | + @echo "Building for linux/arm64..." |
| 53 | + @CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o vermeer |
| 54 | + |
| 55 | +# Clean generated files and binaries |
| 56 | +clean: |
| 57 | + @echo "Cleaning..." |
| 58 | + @rm -f vermeer |
| 59 | + @rm -f asset/assets_vfsdata.go |
| 60 | + @echo "Clean completed!" |
| 61 | + |
| 62 | +# Clean including downloaded binaries |
| 63 | +clean-all: clean |
| 64 | + @echo "Cleaning downloaded binaries..." |
| 65 | + @rm -rf tools/supervisord/*/supervisord |
| 66 | + @rm -rf tools/protoc/*/protoc |
| 67 | + @rm -rf tools/protoc/*/bin |
| 68 | + @rm -rf tools/protoc/*/include |
| 69 | + @echo "All clean completed!" |
| 70 | + |
| 71 | +# Help |
| 72 | +help: |
| 73 | + @echo "Vermeer Build System" |
| 74 | + @echo "" |
| 75 | + @echo "Usage:" |
| 76 | + @echo " make init - First time setup (download binaries + go mod download)" |
| 77 | + @echo " make download-binaries - Download supervisord and protoc binaries" |
| 78 | + @echo " make generate-assets - Generate assets_vfsdata.go from web UI" |
| 79 | + @echo " make build - Build vermeer for current platform" |
| 80 | + @echo " make build-linux-amd64 - Build for Linux AMD64" |
| 81 | + @echo " make build-linux-arm64 - Build for Linux ARM64" |
| 82 | + @echo " make clean - Remove generated files and binaries" |
| 83 | + @echo " make clean-all - Remove everything including downloaded tools" |
| 84 | + @echo " make all - Generate assets and build (default)" |
| 85 | + @echo " make help - Show this help message" |
0 commit comments