PostgreSQL loadable plugin
Source
branch=`(git symbolic-ref -q HEAD > /dev/null && echo 1) || (git tag -l --points-at HEAD| grep "."| grep -q -v "-" && echo 2) || echo 1`; \
.ONESHELL:
PACKAGE=zabbix-agent2-plugin-postgresql
TOPDIR := $(CURDIR)
ifeq ($(OS),Windows_NT)
GOOS := windows
SHELL := cmd
TOPDIR := $(subst /,\,$(CURDIR))
PACKAGE:=$(PACKAGE).exe
WINDRES = windres.exe
ifneq ("$(shell findstr ZABBIX_RC_NUM $(TOPDIR)\windres\resource.h)","")
ifeq ("$(WINDRES_FLAGS)","")
WINDRES_FLAGS := \
-D ZABBIX_LICENSE_YEARS='\"$(word 4,$(shell findstr Copyright $(TOPDIR)\main.go | findstr 2001-20))\"' \
-D ZABBIX_VERSION_MAJOR=$(lastword $(shell findstr VERSION_MAJOR $(TOPDIR)\main.go | findstr =)) \
-D ZABBIX_VERSION_MINOR=$(lastword $(shell findstr VERSION_MINOR $(TOPDIR)\main.go | findstr =)) \
-D ZABBIX_VERSION_PATCH=$(lastword $(shell findstr VERSION_PATCH $(TOPDIR)\main.go | findstr =)) \
-D ZABBIX_VERSION_RC='\"$(lastword $(shell findstr VERSION_RC $(TOPDIR)\main.go | findstr =))\"' \
-D ZABBIX_VERSION_RC_NUM=1000
endif
endif
RFLAGS := $(RFLAGS) --input-format=rc -O coff
ifeq ("$(ARCH)", "")
ifdef PROCESSOR_ARCHITECTURE
ARCH := $(PROCESSOR_ARCHITECTURE)
else
ARCH := x86
endif
endif
ifeq ($(ARCH), x86)
RFLAGS := $(RFLAGS) --target=pe-i386
else ifeq ($(ARCH), AMD64)
RFLAGS := $(RFLAGS) --target=pe-x86-64
else ifeq (,$(findstring ARM,$(ARCH)))
ifneq ($(ARCH), $(PROCESSOR_ARCHITECTURE))
$(error Unsupported CPU architecture: $(ARCH))
endif
endif
endif
ifeq ($(ARCH), x86)
GOARCH := 386
else ifeq ($(ARCH), AMD64)
GOARCH := amd64
else ifeq ($(ARCH), ARM)
GOARCH := arm
else ifeq ($(ARCH), ARM64)
GOARCH := arm64
endif
ifndef GOOS
GOOS := $(shell go env GOOS)
endif
ifndef GOARCH
GOARCH := $(shell go env GOARCH)
endif
DISTFILES = \