xs/Makefile

105 lines
2.1 KiB
Makefile
Raw Permalink Normal View History

.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
2018-04-04 15:51:03 +00:00
#ifeq ($(MAKEOPTS),)
MAKEOPTS = $(MAKEOPTS)
#endif
GIT_COMMIT := $(shell git rev-list -1 HEAD)
VERSION := 0.8.8
#ifeq ($(BUILDOPTS),)
BUILDOPTS :=$(BUILDOPTS)" -ldflags \"-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT)\""
#endif
SUBPKGS = logger spinsult xsnet
TOOLS = xspasswd xs xsd
SUBDIRS = $(LIBS) $(TOOLS)
2018-05-27 06:42:43 +00:00
INSTPREFIX = /usr/local
all: common client server passwd
2018-04-04 15:51:03 +00:00
clean:
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
ifeq ($(MSYSTEM),)
ifneq ($(GOOS),windows)
server: common
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xsd
else
echo "Cross-build of xsd server for Windows not yet supported"
endif
2018-05-26 22:54:54 +00:00
else
server: common
echo "xsd server not (yet) supported on Windows"
2018-05-26 22:54:54 +00:00
endif
2018-04-04 15:51:03 +00:00
passwd: common
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xspasswd
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 github.com/Russtopia/go-callvis to install."; \
else \
make -C xs vis;\
make -C xsd vis;\
make -C xspasswd vis; \
fi
lint:
make -C xspasswd lint
make -C xsd lint
make -C xs lint
reinstall: uninstall install
install:
cp xs/xs $(INSTPREFIX)/bin
ifeq ($(MSYSTEM),)
ifneq ($(GOOS),windows)
cp xsd/xsd xspasswd/xspasswd $(INSTPREFIX)/sbin
else
mv $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/_xs
cp xs/mintty_wrapper.sh $(INSTPREFIX)/bin/xs
echo "Cross-build of xsd server for Windows not yet supported"
endif
else
echo "Cross-build of xsd server for Windows not yet supported"
endif
cd $(INSTPREFIX)/bin && ln -s xs xc && cd -
uninstall:
rm -f $(INSTPREFIX)/bin/xs $(INSTPREFIX)/bin/xc $(INSTPREFIX)/bin/_xs
ifeq ($(MSYSTEM),)
ifneq ($(GOOS),windows)
rm -f $(INSTPREFIX)/sbin/xsd $(INSTPREFIX)/sbin/xspasswd
else
endif
else
endif