-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
44 lines (34 loc) · 1021 Bytes
/
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
CFORGO = ${HOME}/go/bin/c-for-go
CGO = $(shell go env GOTOOLDIR)/cgo
all: generate
UINT64_TYPE = unsigned long long
INT64_TYPE = long long
TEST_VERBOSE = -v
generate:
cd pkg && \
sed -e "s/uint64_t/$(UINT64_TYPE)/g" \
-e "s/int64_t/$(INT64_TYPE)/g" \
-e "s/union id/union id_rename/g" \
rocm_smi/rocm_smi/rocm_smi.h.orig > rocm_smi/rocm_smi/rocm_smi.h && \
$(CFORGO) -ccincl --ccdefs ../rocm_smi.yml && \
cd -
cd pkg/rocm_smi && \
$(CGO) -godefs types.go > types.go.expand && \
mv types.go.expand types.go && \
rm -rf _obj && \
cd -
clean:
rm -f pkg/rocm_smi/cgo_helpers.go pkg/rocm_smi/cgo_helpers.h pkg/rocm_smi/cgo_helpers.c
rm -f pkg/rocm_smi/const.go pkg/rocm_smi/doc.go pkg/rocm_smi/types.go
rm -f pkg/rocm_smi/rocm_smi.go
build:
cd pkg/rocm_smi && go build
test: build
cd pkg/rocm_smi && go test $(TEST_VERBOSE)
.PHONY: fmt
fmt:
cd pkg/rocm_smi && go fmt
# Examine Go source code and reports suspicious constructs
.PHONY: vet
vet:
cd pkg/rocm_smi && go vet ./...