-
-
-# FIXME - package webapp
-release: releasetar
- goxc -d ./release -tasks-=go-vet,go-test -os="linux darwin" -pv=$(VERSION) -arch="386 amd64 arm arm64" -build-ldflags="-X main.AppVersionGitTag=$(VERSION)" -resources-include="README.md,Documentation,LICENSE,contrib" -main-dirs-exclude="vendor"
-
-releasetar:
- mkdir -p release/$(VERSION)
- glide install --strip-vcs --strip-vendor --update-vendored --delete
- glide-vc --only-code --no-tests --keep="**/*.json.in"
- git ls-files > /tmp/xds-server-build
- find vendor >> /tmp/xds-server-build
- find webapp/ -path webapp/node_modules -prune -o -print >> /tmp/xds-server-build
- tar -cvf release/$(VERSION)/xds-server_$(VERSION)_src.tar -T /tmp/xds-server-build --transform 's,^,xds-server_$(VERSION)/,'
- rm /tmp/xds-server-build
- gzip release/$(VERSION)/xds-server_$(VERSION)_src.tar
-
-
-vendor: tools/glide glide.yaml
- ./tools/glide install --strip-vendor
-
-tools/glide:
- @echo "Downloading glide"
- mkdir -p tools
- curl --silent -L https://glide.sh/get | GOBIN=./tools sh
-
-goenv:
- @go env
-
+ @[ -d ${DESTDIR}/usr ] && { echo "Removing unwanted ${DESTDIR}/usr directory"; rm -rf ${DESTDIR}/usr; } || true
+
+.PHONY: scripts
+scripts:
+ @mkdir -p $(LOCAL_BINDIR) && cp -rf scripts/xds-utils scripts/sdks $(LOCAL_BINDIR)
+
+.PHONY: conffile
+conffile:
+ cat $(ROOT_SRCDIR)/conf.d/etc/xds/server/server-config.json \
+ | sed -e s,"www","$(DESTDIR_WWW)",g \
+ > $(DESTDIR)/server-config.json.in
+
+.PHONY: install
+install:
+ @test -e $(LOCAL_BINDIR)/xds-server$(EXT) -a -d webapp/dist || { echo "Please execute first: make all"; exit 1; }
+ @test -d $(LOCAL_BINDIR)/xds-utils || { echo "Please execute first: make all"; exit 1; }
+ @test -e $(LOCAL_BINDIR)/syncthing$(EXT) -a -e $(LOCAL_BINDIR)/syncthing-inotify$(EXT) || { echo "Please execute first: make all"; exit 1; }
+ mkdir -p $(DESTDIR) \
+ && cp -a $(LOCAL_BINDIR)/* $(DESTDIR)
+ mkdir -p $(DESTDIR_WWW) \
+ && cp -a webapp/dist/* $(DESTDIR_WWW)
+
+.PHONY: _package
+_package: clean
+ make -f $(ROOT_SRCDIR)/Makefile all install DESTDIR=$(PACKAGE_DIR)/xds-server
+ make -f $(ROOT_SRCDIR)/Makefile conffile DESTDIR=$(PACKAGE_DIR)/xds-server DESTDIR_WWW=www
+ cp -r $(ROOT_SRCDIR)/conf.d $(PACKAGE_DIR)/xds-server
+ rm -f $(ROOT_SRCDIR)/$(PACKAGE_ZIPFILE)
+ (cd $(PACKAGE_DIR) && zip -r $(ROOT_SRCDIR)/$(PACKAGE_ZIPFILE) ./xds-server)
+
+# On support Linux for now
+.PHONY: package
+package:
+ @echo "# Build linux amd64..."
+ GOOS=linux GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile _package
+ make -f $(ROOT_SRCDIR)/Makefile clean
+
+.PHONY: package-all
+package-all: package
+
+.PHONY: gomod
+gomod:
+ go get
+
+gomod/debug:
+ @echo "replace gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git => $(ROOT_SRCDIR)/../xds-common" >> $(ROOT_SRCDIR)/go.mod
+ @echo "Add replace in go.mod file - done."
+
+vendor: gomod
+ go mod vendor
+
+vendor/debug: vendor
+ (cd vendor/gerrit.automotivelinux.org/gerrit/src/xds && \
+ rm -rf xds-common.git && ln -s ../../../../../../xds-common xds-common.git )
+
+.PHONY: tools/syncthing
+tools/syncthing:
+ @test -e $(LOCAL_TOOLSDIR)/syncthing$(EXT) -a -e $(LOCAL_TOOLSDIR)/syncthing-inotify$(EXT) || { \
+ mkdir -p $(LOCAL_TOOLSDIR); \
+ DESTDIR=$(LOCAL_TOOLSDIR) \
+ SYNCTHING_VERSION=$(SYNCTHING_VERSION) \
+ SYNCTHING_INOTIFY_VERSION=$(SYNCTHING_INOTIFY_VERSION) \
+ ./scripts/xds-utils/get-syncthing.sh; }
+
+.PHONY: tools/syncthing/copytobin
+tools/syncthing/copytobin:
+ @test -e $(LOCAL_TOOLSDIR)/syncthing$(EXT) -a -e $(LOCAL_TOOLSDIR)/syncthing-inotify$(EXT) || { echo "Please execute first: make tools/syncthing\n"; exit 1; }
+ @mkdir -p $(LOCAL_BINDIR)
+ @cp -f $(LOCAL_TOOLSDIR)/syncthing$(EXT) $(LOCAL_TOOLSDIR)/syncthing-inotify$(EXT) $(LOCAL_BINDIR)
+
+.PHONY:
+checkgover:
+ @test "$(CHECKGOVER)" = "true" || { echo $(CHECKERRMSG); exit 1; }
+
+.PHONY:
+checkgorace: checkgover
+ @ls $(shell go env GOROOT)/src/runtime/race/*.syso 1> /dev/null 2>&1 || { echo "ERROR: go-race package mandatory to run test. Please install it, for example: zypper install go-race"; exit 1; }
+
+.PHONY: help