Implemented epics read/write
This commit is contained in:
@@ -42,13 +42,46 @@ $(BINARY): $(GO_SRCS) $(FRONTEND_OUT)
|
||||
go build -ldflags="-s -w" -o $(BINARY) ./cmd/uopi
|
||||
|
||||
# Build with EPICS Channel Access support.
|
||||
# Requires EPICS Base and:
|
||||
# EPICS_BASE=/path/to/epics/base
|
||||
# CGO_CFLAGS="-I$$EPICS_BASE/include -I$$EPICS_BASE/include/os/Linux"
|
||||
# CGO_LDFLAGS="-L$$EPICS_BASE/lib/linux-x86_64 -lca -lCom"
|
||||
#
|
||||
# Auto-detection: if EPICS_BASE is set in the environment, CGO flags are
|
||||
# derived automatically. Override any variable on the command line:
|
||||
#
|
||||
# make backend-epics EPICS_BASE=/path/to/epics/base EPICS_ARCH=linux-x86_64
|
||||
#
|
||||
# If EPICS_BASE is not set, set it to the directory that contains
|
||||
# include/cadef.h and lib/<arch>/libca.so.
|
||||
|
||||
EPICS_BASE ?= $(EPICS_BASE)
|
||||
|
||||
# Detect host arch from EPICS startup script if not provided.
|
||||
EPICS_ARCH ?= $(shell \
|
||||
if [ -x "$(EPICS_BASE)/startup/EpicsHostArch" ]; then \
|
||||
"$(EPICS_BASE)/startup/EpicsHostArch"; \
|
||||
elif [ -x "$(EPICS_BASE)/lib" ]; then \
|
||||
ls "$(EPICS_BASE)/lib" | grep linux | head -1; \
|
||||
else \
|
||||
echo "linux-x86_64"; \
|
||||
fi)
|
||||
|
||||
EPICS_CGO_CFLAGS ?= -I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux -I$(EPICS_BASE)/include/compiler/gcc
|
||||
EPICS_CGO_LDFLAGS ?= -L$(EPICS_BASE)/lib/$(EPICS_ARCH) -lca -lCom -Wl,-rpath,$(EPICS_BASE)/lib/$(EPICS_ARCH)
|
||||
|
||||
backend-epics: $(FRONTEND_OUT)
|
||||
@if [ -z "$(EPICS_BASE)" ]; then \
|
||||
echo "ERROR: EPICS_BASE is not set."; \
|
||||
echo " export EPICS_BASE=/path/to/epics/base"; \
|
||||
echo " then re-run: make backend-epics"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Building with EPICS support"
|
||||
@echo " EPICS_BASE = $(EPICS_BASE)"
|
||||
@echo " EPICS_ARCH = $(EPICS_ARCH)"
|
||||
@mkdir -p dist
|
||||
CGO_ENABLED=1 go build -tags epics -ldflags="-s -w" -o $(BINARY) ./cmd/uopi
|
||||
CGO_ENABLED=1 \
|
||||
CGO_CFLAGS="$(EPICS_CGO_CFLAGS)" \
|
||||
CGO_LDFLAGS="$(EPICS_CGO_LDFLAGS)" \
|
||||
go build -tags epics -ldflags="-s -w" -o $(BINARY) ./cmd/uopi
|
||||
@echo "Built: $(BINARY) (EPICS CA enabled)"
|
||||
|
||||
# Unstripped binary for debugging
|
||||
backend-debug: $(FRONTEND_OUT)
|
||||
|
||||
Reference in New Issue
Block a user