xs/Makefile
Russ Magee caac02a77b 1/2 Updated Makefile to allow VENDOR flag (adds -vendor to version string)
2/2 Added vendor/ dir to lock down dependent pkg versions.
The author of git.schwanenlied.me/yawning/{chacha20,newhope,kyber}.git has copied
their repos to gitlab.com/yawning/ but some imports of chacha20 from newhope still
inconsistently refer to git.schwanenlied.me/, breaking build.
Licenses for chacha20 also changed from CC0 to AGPL, which may or may not be an
issue. Until the two aforementioned issues are resolved, locking to last-good
versions is probably the best way forward for now.

To build with vendored deps, use make VENDOR=1 clean all
2020-01-29 13:55:38 -08:00

113 lines
2.2 KiB
Makefile

.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
#ifeq ($(MAKEOPTS),)
MAKEOPTS = $(MAKEOPTS)
#endif
GIT_COMMIT := $(shell git rev-list -1 HEAD)
VERSION := 0.8.11
ifneq ($(VENDOR),)
GOBUILDOPTS :=-v -mod vendor
VTAG = "-vendor"
else
GOBUILDOPTS=
VTAG =
endif
#ifeq ($(BUILDOPTS),)
BUILDOPTS :=$(BUILDOPTS)"$(GOBUILDOPTS) -ldflags \"-X main.version=$(VERSION)$(VTAG) -X main.gitCommit=$(GIT_COMMIT)\""
#endif
SUBPKGS = logger spinsult xsnet
TOOLS = xspasswd xs xsd
SUBDIRS = $(LIBS) $(TOOLS)
INSTPREFIX = /usr/local
all: common client server passwd
clean:
go clean .
for d in $(SUBDIRS); do\
$(MAKE) -C $$d clean;\
done
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 .
go install .
client: common
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xs
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
else
server: common
echo "xsd server not (yet) supported on Windows"
endif
passwd: common
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C xspasswd
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;\
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