2024-10-27 19:12:07 +00:00
|
|
|
VERSION := 0.9.12
|
2023-05-25 03:29:26 +00:00
|
|
|
.PHONY: lint vis clean common client server passwd\
|
|
|
|
subpkgs install uninstall reinstall scc
|
2023-11-06 03:05:23 +00:00
|
|
|
|
2020-01-30 20:40:18 +00:00
|
|
|
## Tag version of binaries with build info wrt.
|
|
|
|
## GO111MODULE(=on) and vendor/ setup vs. $GOPATH pkg builds
|
|
|
|
############################################################
|
|
|
|
ifeq ($(shell go env GOMOD),)
|
|
|
|
MTAG=
|
|
|
|
else
|
|
|
|
MTAG="-m"
|
|
|
|
endif
|
2020-01-29 21:25:14 +00:00
|
|
|
|
2022-06-17 05:45:25 +00:00
|
|
|
# If available, one may build 'garbled' binaries
|
|
|
|
# See https://github.com/burrowers/garble.git
|
|
|
|
ifeq ($(GARBLE),y)
|
|
|
|
GO=garble -literals -tiny -debugdir=garbled
|
|
|
|
else
|
|
|
|
GO=go
|
|
|
|
endif
|
|
|
|
|
2020-01-29 21:25:14 +00:00
|
|
|
ifneq ($(VENDOR),)
|
|
|
|
GOBUILDOPTS :=-v -mod vendor
|
2020-01-30 20:40:18 +00:00
|
|
|
VTAG = "-v"
|
2020-01-29 21:25:14 +00:00
|
|
|
else
|
|
|
|
GOBUILDOPTS=
|
|
|
|
VTAG =
|
|
|
|
endif
|
2020-01-30 20:40:18 +00:00
|
|
|
############################################################
|
|
|
|
|
|
|
|
GIT_COMMIT := $(shell git rev-list -1 HEAD)
|
2020-01-29 21:25:14 +00:00
|
|
|
|
2019-06-21 05:44:19 +00:00
|
|
|
#ifeq ($(BUILDOPTS),)
|
2020-01-30 20:40:18 +00:00
|
|
|
BUILDOPTS :=$(BUILDOPTS)"$(GOBUILDOPTS) -ldflags \"-X main.version=$(VERSION)$(MTAG)$(VTAG) -X main.gitCommit=$(GIT_COMMIT)\""
|
2019-06-21 05:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-30 03:34:09 +00:00
|
|
|
SUBPKGS = logger spinsult xsnet
|
2020-05-25 04:15:28 +00:00
|
|
|
TOOLS = xs xsd
|
2018-07-05 06:07:09 +00:00
|
|
|
SUBDIRS = $(LIBS) $(TOOLS)
|
2018-05-27 06:42:43 +00:00
|
|
|
|
2020-05-25 04:15:28 +00:00
|
|
|
ifeq ($(GOOS),)
|
|
|
|
GOOS=$(shell go env GOOS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(GOOS),windows)
|
|
|
|
ifeq ($(MSYSTEM),MSYS)
|
|
|
|
WIN_MSYS=1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
INSTPREFIX = /usr/local
|
|
|
|
|
2021-01-11 06:07:00 +00:00
|
|
|
all: common client server
|
2018-04-04 15:51:03 +00:00
|
|
|
|
|
|
|
clean:
|
2020-04-29 00:49:09 +00:00
|
|
|
@echo "Make: $(MAKE)"
|
2018-05-27 06:42:43 +00:00
|
|
|
go clean .
|
|
|
|
for d in $(SUBDIRS); do\
|
|
|
|
$(MAKE) -C $$d clean;\
|
|
|
|
done
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
subpkgs:
|
|
|
|
for d in $(SUBPKGS); do\
|
2019-07-11 17:12:38 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C $$d all;\
|
2018-07-05 06:07:09 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
tools:
|
|
|
|
for d in $(TOOLS); do\
|
2019-07-11 17:12:38 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C $$d all;\
|
2018-07-05 06:07:09 +00:00
|
|
|
done
|
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
common:
|
2022-06-17 05:45:25 +00:00
|
|
|
$(GO) build .
|
2024-03-02 07:34:14 +00:00
|
|
|
go install -a .
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
client: common
|
2019-10-30 03:34:09 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xs
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
server: common
|
2020-06-04 04:39:42 +00:00
|
|
|
ifeq ($(MSYSTEM),MSYS)
|
2020-05-25 04:15:28 +00:00
|
|
|
echo "Build of xsd server for Windows not yet supported"
|
2018-05-26 22:54:54 +00:00
|
|
|
else
|
2019-10-30 03:34:09 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xsd
|
2018-05-26 22:54:54 +00:00
|
|
|
endif
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2023-05-25 03:29:26 +00:00
|
|
|
scc:
|
2023-05-25 03:47:04 +00:00
|
|
|
@scc --exclude-dir=bacillus,vendor,garbled --cocomo-project-type=rlabs,3,1.12,1,1
|
2023-05-25 03:29:26 +00:00
|
|
|
|
2018-11-21 06:34:16 +00:00
|
|
|
vis:
|
2018-11-22 01:06:09 +00:00
|
|
|
@which go-callvis >/dev/null 2>&1; \
|
2018-11-21 06:34:16 +00:00
|
|
|
stat=$$?; if [ $$stat -ne "0" ]; then \
|
2020-01-29 21:25:14 +00:00
|
|
|
/bin/echo "go-callvis not found. Run go get https://github.com/TrueFurby/go-callvis to install."; \
|
2018-11-21 06:34:16 +00:00
|
|
|
else \
|
2020-04-29 00:49:09 +00:00
|
|
|
$(MAKE) -C xs vis;\
|
|
|
|
$(MAKE) -C xsd vis;\
|
2018-11-21 06:34:16 +00:00
|
|
|
fi
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-11-25 18:24:10 +00:00
|
|
|
lint:
|
2020-04-29 00:49:09 +00:00
|
|
|
$(MAKE) -C xsd lint
|
|
|
|
$(MAKE) -C xs lint
|
2018-11-25 18:24:10 +00:00
|
|
|
|
|
|
|
reinstall: uninstall install
|
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
install:
|
2020-05-25 04:15:28 +00:00
|
|
|
echo "WIN_MSYS:" $(WIN_MSYS)
|
|
|
|
ifdef WIN_MSYS
|
2024-10-27 18:58:22 +00:00
|
|
|
cp xs/xs $(INSTPREFIX)/bin/xs
|
|
|
|
cp xs/xs $(INSTPREFIX)/bin/xc
|
2020-05-25 04:15:28 +00:00
|
|
|
echo "Install of xsd server for Windows not yet supported"
|
2018-11-14 01:38:13 +00:00
|
|
|
else
|
2020-05-25 04:15:28 +00:00
|
|
|
cp xs/xs $(INSTPREFIX)/bin
|
2019-10-30 03:34:09 +00:00
|
|
|
cd $(INSTPREFIX)/bin && ln -s xs xc && cd -
|
2020-07-22 05:10:04 +00:00
|
|
|
cp xsd/xsd $(INSTPREFIX)/sbin
|
2020-05-25 04:15:28 +00:00
|
|
|
endif
|
2018-11-14 01:38:13 +00:00
|
|
|
|
|
|
|
uninstall:
|
2024-10-27 18:58:22 +00:00
|
|
|
rm -f $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/xc
|
2020-05-25 04:15:28 +00:00
|
|
|
ifndef $(WIN_MSYS)
|
|
|
|
rm -f $(INSTPREFIX)/sbin/xsd
|
2018-11-14 01:38:13 +00:00
|
|
|
endif
|