|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | +# |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# 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 | +include deps.mk |
| 18 | + |
| 19 | +SHELL = /usr/bin/env bash -o pipefail |
| 20 | +.SHELLFLAGS = -ec |
| 21 | + |
| 22 | +GO ?= go |
| 23 | +BINARY_DIR ?= ./bin |
| 24 | +AGENT_BINARY ?= $(BINARY_DIR)/agent |
| 25 | + |
| 26 | +.PHONY: all |
| 27 | +all: build |
| 28 | + |
| 29 | +##@ General |
| 30 | +.PHONY: help |
| 31 | +help: ## Display this help. |
| 32 | + @awk 'BEGIN {FS = ":.*##"; printf "\n\033[1;31mUsage:\033[0m\n make \033[3;1;36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1;31m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 33 | + |
| 34 | +##@ Development |
| 35 | +.PHONY: license-fmt |
| 36 | +license-fmt: ## Run license header formatting for changed files. |
| 37 | + python3 ../../scripts/format_license.py --root-dir . --license-file ../../LICENSE |
| 38 | + |
| 39 | +.PHONY: fmt |
| 40 | +fmt: license-fmt ## Format go files and update license headers. |
| 41 | + $(GO) fmt ./... |
| 42 | + |
| 43 | +.PHONY: vet |
| 44 | +vet: ## Run go vet against code. |
| 45 | + $(GO) vet ./... |
| 46 | + |
| 47 | +.PHONY: test |
| 48 | +test: ## Run unit tests. |
| 49 | + $(GO) test ./... |
| 50 | + |
| 51 | +.PHONY: lint |
| 52 | +lint: golangci-lint ## Run golangci-lint. |
| 53 | + $(GOLANGCI_LINT) run ./... |
| 54 | + |
| 55 | +.PHONY: lint-fix |
| 56 | +lint-fix: golangci-lint ## Run golangci-lint and apply fixes. |
| 57 | + $(GOLANGCI_LINT) run --fix ./... |
| 58 | + |
| 59 | +##@ Build |
| 60 | +.PHONY: build |
| 61 | +build: ## Build agent binary. |
| 62 | + mkdir -p $(BINARY_DIR) |
| 63 | + $(GO) build -o $(AGENT_BINARY) ./cmd/agent |
| 64 | + |
| 65 | +##@ Clean |
| 66 | +.PHONY: clean |
| 67 | +clean: ## Remove local build artifacts. |
| 68 | + rm -rf $(BINARY_DIR) |
| 69 | + rm -rf $(LOCALBIN) |
0 commit comments