xs/Makefile

116 lines
2.3 KiB
Makefile
Raw Normal View History

VERSION := 0.9.3-pre
.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
2018-04-04 15:51:03 +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
ifneq ($(VENDOR),)
GOBUILDOPTS :=-v -mod vendor
VTAG = "-v"
else
GOBUILDOPTS=
VTAG =
endif
############################################################
GIT_COMMIT := $(shell git rev-list -1 HEAD)
#ifeq ($(BUILDOPTS),)
BUILDOPTS :=$(BUILDOPTS)"$(GOBUILDOPTS) -ldflags \"-X main.version=$(VERSION)$(MTAG)$(VTAG) -X main.gitCommit=$(GIT_COMMIT)\""
#endif
SUBPKGS = logger spinsult xsnet
TOOLS = xs xsd
SUBDIRS = $(LIBS) $(TOOLS)
2018-05-27 06:42:43 +00:00
ifeq ($(GOOS),)
GOOS=$(shell go env GOOS)
endif
ifeq ($(GOOS),windows)
ifeq ($(MSYSTEM),MSYS)
WIN_MSYS=1
endif
endif
INSTPREFIX = /usr/local
2021-01-11 06:07:00 +00:00
all: common client server
2018-04-04 15:51:03 +00:00
clean:
@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
subpkgs:
for d in $(SUBPKGS); do\
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C $$d all;\
done
tools:
for d in $(TOOLS); do\
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C $$d all;\
done
common:
go build .
2018-04-04 15:51:03 +00:00
go install .
client: common
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xs
2018-04-04 15:51:03 +00:00
server: common
ifeq ($(MSYSTEM),MSYS)
echo "Build of xsd server for Windows not yet supported"
2018-05-26 22:54:54 +00:00
else
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xsd
2018-05-26 22:54:54 +00:00
endif
2018-04-04 15:51:03 +00:00
vis:
@which go-callvis >/dev/null 2>&1; \
stat=$$?; if [ $$stat -ne "0" ]; then \
/bin/echo "go-callvis not found. Run go get https://github.com/TrueFurby/go-callvis to install."; \
else \
$(MAKE) -C xs vis;\
$(MAKE) -C xsd vis;\
fi
lint:
$(MAKE) -C xsd lint
$(MAKE) -C xs lint
reinstall: uninstall install
install:
echo "WIN_MSYS:" $(WIN_MSYS)
ifdef WIN_MSYS
cp xs/mintty_wrapper.sh $(INSTPREFIX)/bin/xs
cp xs/mintty_wrapper.sh $(INSTPREFIX)/bin/xc
cp xs/xs $(INSTPREFIX)/bin/_xs
cp xs/xs $(INSTPREFIX)/bin/_xc
echo "Install of xsd server for Windows not yet supported"
else
cp xs/xs $(INSTPREFIX)/bin
cd $(INSTPREFIX)/bin && ln -s xs xc && cd -
cp xsd/xsd $(INSTPREFIX)/sbin
endif
uninstall:
rm -f $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/xc \
$(INSTPREFIX)/bin/_xs $(INSTPREFIX)/bin/_xc
ifndef $(WIN_MSYS)
rm -f $(INSTPREFIX)/sbin/xsd
endif