2018-11-25 18:24:10 +00:00
|
|
|
.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2019-06-21 05:44:19 +00:00
|
|
|
#ifeq ($(MAKEOPTS),)
|
|
|
|
MAKEOPTS = $(MAKEOPTS)
|
|
|
|
#endif
|
|
|
|
|
2019-07-11 17:12:38 +00:00
|
|
|
GIT_COMMIT := $(shell git rev-list -1 HEAD)
|
2019-08-23 06:32:56 +00:00
|
|
|
VERSION := 0.8.7-kcp
|
2019-06-21 05:44:19 +00:00
|
|
|
#ifeq ($(BUILDOPTS),)
|
2019-07-11 17:12:38 +00:00
|
|
|
BUILDOPTS :=$(BUILDOPTS)" -ldflags \"-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT)\""
|
2019-06-21 05:44:19 +00:00
|
|
|
#endif
|
|
|
|
|
2018-12-07 01:20:43 +00:00
|
|
|
SUBPKGS = logger spinsult hkexnet
|
2018-07-05 06:07:09 +00:00
|
|
|
TOOLS = hkexpasswd hkexsh hkexshd
|
|
|
|
SUBDIRS = $(LIBS) $(TOOLS)
|
2018-05-27 06:42:43 +00:00
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
INSTPREFIX = /usr/local
|
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
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
|
|
|
|
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:
|
2019-07-11 17:12:38 +00:00
|
|
|
go build .
|
2018-04-04 15:51:03 +00:00
|
|
|
go install .
|
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
client: common
|
2019-07-11 17:12:38 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C hkexsh
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-10-26 23:05:01 +00:00
|
|
|
ifeq ($(MSYSTEM),)
|
|
|
|
ifneq ($(GOOS),windows)
|
2018-07-05 06:07:09 +00:00
|
|
|
server: common
|
2019-07-11 17:12:38 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C hkexshd
|
2018-10-26 23:05:01 +00:00
|
|
|
else
|
|
|
|
echo "Cross-build of hkexshd server for Windows not yet supported"
|
|
|
|
endif
|
2018-05-26 22:54:54 +00:00
|
|
|
else
|
2018-07-05 06:07:09 +00:00
|
|
|
server: common
|
2018-10-26 23:05:01 +00:00
|
|
|
echo "hkexshd server not (yet) supported on Windows"
|
2018-05-26 22:54:54 +00:00
|
|
|
endif
|
2018-04-04 15:51:03 +00:00
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
|
2018-07-05 06:07:09 +00:00
|
|
|
passwd: common
|
2019-07-11 17:12:38 +00:00
|
|
|
$(MAKE) BUILDOPTS=$(BUILDOPTS) -C hkexpasswd
|
2018-04-04 15:51:03 +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 \
|
2018-11-22 01:06:09 +00:00
|
|
|
/bin/echo "go-callvis not found. Run go get github.com/Russtopia/go-callvis to install."; \
|
2018-11-21 06:34:16 +00:00
|
|
|
else \
|
2018-11-22 01:06:09 +00:00
|
|
|
make -C hkexsh vis;\
|
|
|
|
make -C hkexshd vis;\
|
|
|
|
make -C hkexpasswd 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:
|
|
|
|
make -C hkexpasswd lint
|
|
|
|
make -C hkexshd lint
|
|
|
|
make -C hkexsh lint
|
|
|
|
|
|
|
|
reinstall: uninstall install
|
|
|
|
|
2018-11-14 01:38:13 +00:00
|
|
|
install:
|
|
|
|
cp hkexsh/hkexsh $(INSTPREFIX)/bin
|
|
|
|
ifeq ($(MSYSTEM),)
|
|
|
|
ifneq ($(GOOS),windows)
|
|
|
|
cp hkexshd/hkexshd hkexpasswd/hkexpasswd $(INSTPREFIX)/sbin
|
|
|
|
else
|
|
|
|
mv $(INSTPREFIX)/bin/hkexsh $(INSTPREFIX)/bin/_hkexsh
|
|
|
|
cp hkexsh/mintty_wrapper.sh $(INSTPREFIX)/bin/hkexsh
|
|
|
|
echo "Cross-build of hkexshd server for Windows not yet supported"
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
echo "Cross-build of hkexshd server for Windows not yet supported"
|
|
|
|
endif
|
|
|
|
cd $(INSTPREFIX)/bin && ln -s hkexsh hkexcp && cd -
|
|
|
|
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f $(INSTPREFIX)/bin/hkexsh $(INSTPREFIX)/bin/hkexcp $(INSTPREFIX)/bin/_hkexsh
|
|
|
|
ifeq ($(MSYSTEM),)
|
|
|
|
ifneq ($(GOOS),windows)
|
|
|
|
rm -f $(INSTPREFIX)/sbin/hkexshd $(INSTPREFIX)/sbin/hkexpasswd
|
|
|
|
else
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
endif
|