-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (55 loc) · 1.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Build configuration
ROCM_PATH ?= /opt/rocm
GO ?= go
GOFLAGS ?=
LDFLAGS ?=
# Export CGO settings
export CGO_ENABLED=1
export CGO_CFLAGS=-I${ROCM_PATH}/include
export CGO_LDFLAGS=-L${ROCM_PATH}/lib -lrocm_smi64
# Binary names
EXAMPLE_BIN=device_info
# Directories
PKG_DIR=pkg
EXAMPLES_DIR=examples
BUILD_DIR=build
.PHONY: all
all: build example
.PHONY: build
build:
$(GO) build $(GOFLAGS) ./...
.PHONY: example
example:
mkdir -p $(BUILD_DIR)
$(GO) build $(GOFLAGS) -o $(BUILD_DIR)/$(EXAMPLE_BIN) $(EXAMPLES_DIR)/main.go
.PHONY: test
test:
$(GO) test $(GOFLAGS) ./...
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)
$(GO) clean
.PHONY: vendor
vendor:
$(GO) mod vendor
$(GO) mod tidy
.PHONY: check
check:
$(GO) vet ./...
$(GO) fmt ./...
.PHONY: install
install:
$(GO) install $(GOFLAGS) ./...
# Help target
.PHONY: help
help:
@echo "Available targets:"
@echo " all - Build everything (default)"
@echo " build - Build the library"
@echo " example - Build the example program"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@echo " vendor - Update vendor directory"
@echo " check - Run code checks"
@echo " install - Install the library"
@echo " help - Show this help"