NVIDIA GPU loadable plugin
Source
4
4
TOPDIR := $(CURDIR)
5
5
6
6
ifeq ($(OS),Windows_NT)
7
7
SHELL := cmd
8
8
TOPDIR := $(subst /,\,$(CURDIR))
9
9
PACKAGE:=$(PACKAGE).exe
10
10
WINDRES = windres.exe
11
11
ifneq ("$(shell findstr ZABBIX_RC_NUM $(TOPDIR)\windres\resource.h)","")
12
12
ifeq ("$(WINDRES_FLAGS)","")
13
13
WINDRES_FLAGS := \
14
-
-D ZABBIX_LICENSE_YEARS='\"$(word 3,$(shell findstr Copyright $(TOPDIR)\main.go | findstr 2001-20))\"' \
14
+
-D ZABBIX_LICENSE_YEARS='\"$(word 4,$(shell findstr Copyright $(TOPDIR)\main.go | findstr 2001-20))\"' \
15
15
-D ZABBIX_VERSION_MAJOR=$(lastword $(shell findstr VERSION_MAJOR $(TOPDIR)\main.go | findstr =)) \
16
16
-D ZABBIX_VERSION_MINOR=$(lastword $(shell findstr VERSION_MINOR $(TOPDIR)\main.go | findstr =)) \
17
17
-D ZABBIX_VERSION_PATCH=$(lastword $(shell findstr VERSION_PATCH $(TOPDIR)\main.go | findstr =)) \
18
18
-D ZABBIX_VERSION_RC='\"$(lastword $(shell findstr VERSION_RC $(TOPDIR)\main.go | findstr =))\"' \
19
19
-D ZABBIX_VERSION_RC_NUM=1000
20
20
endif
21
21
endif
22
22
23
23
RFLAGS := $(RFLAGS) --input-format=rc -O coff
24
24
25
25
ifeq ("$(ARCH)", "")
26
26
ARCH := $(PROCESSOR_ARCHITECTURE)
27
27
endif
28
28
endif
29
29
30
30
ifeq ("$(ARCH)", "x86")
31
31
GOARCH := 386
32
32
RFLAGS := $(RFLAGS) --target=pe-i386
33
-
34
33
else
35
34
GOARCH := amd64
36
35
RFLAGS := $(RFLAGS) --target=pe-x86-64
37
36
endif
38
37
39
38
DISTFILES = \
40
39
ChangeLog \
41
40
go.mod \
42
41
go.sum \
43
42
LICENSE \
54
53
55
54
.build_rc:
56
55
ifneq ("$(WINDRES)","")
57
56
$(WINDRES) $(TOPDIR)\windres\resource.rc $(WINDRES_FLAGS) $(RFLAGS) \
58
57
-D VER_FILEDESCRIPTION_STR='\"$(PACKAGE)\"' \
59
58
-D _WINDOWS -o "$(TOPDIR)\$(PACKAGE).syso"
60
59
endif
61
60
62
61
build: .build_rc
63
62
set GOARCH=$(GOARCH)
63
+
set CGO_ENABLED=1
64
64
go build -o "$(TOPDIR)/$(PACKAGE)"
65
65
66
66
clean:
67
67
ifeq ($(OS),Windows_NT)
68
68
if exist "$(TOPDIR)\vendor" rmdir /S /Q "$(TOPDIR)\vendor"
69
69
del /F "$(TOPDIR)\$(PACKAGE)*"
70
70
else
71
71
rm -rf "$(TOPDIR)/vendor"
72
72
rm -rf "$(TOPDIR)/$(PACKAGE)"*
73
73
endif
83
83
go fmt "$(TOPDIR)/..."
84
84
85
85
dist:
86
86
ifneq ($(OS),Windows_NT)
87
87
cd $(TOPDIR); \
88
88
go mod vendor; \
89
89
major_verison=$(lastword $(shell grep 'PLUGIN_VERSION_MAJOR =' ./main.go)); \
90
90
minor_verison=$(lastword $(shell grep 'PLUGIN_VERSION_MINOR =' ./main.go)); \
91
91
patch_verison=$(lastword $(shell grep 'PLUGIN_VERSION_PATCH =' ./main.go)); \
92
92
alphatag=$(lastword $(shell grep 'PLUGIN_VERSION_RC =' ./main.go)); \
93
-
lic_years=$(word 3, $(shell grep ' Copyright 2001-' ./main.go)); \
93
+
lic_years=$(word 4, $(shell grep ' Copyright (C) 2001-' ./main.go)); \
94
94
distdir="$(PACKAGE)-$${major_verison}.$${minor_verison}.$${patch_verison}$${alphatag}"; \
95
95
dist_archive="$${distdir}.tar.gz"; \
96
96
mkdir -p ./$${distdir}; \
97
97
for distfile in '$(DISTFILES)'; do \
98
98
cp -fp ./$${distfile} ./$${distdir}/; \
99
99
done; \
100
100
for subdir in '$(DIST_SUBDIRS)'; do \
101
101
cp -fpR ./$${subdir} ./$${distdir}; \
102
102
done; \
103
103
# File revision number must be numeric (Git commit hash cannot be used).