From: Sebastien Douheret Date: Fri, 16 Jun 2017 12:13:20 +0000 (+0200) Subject: Used standard DESTDIR variable in make install X-Git-Tag: 0.1.0~23 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fxds%2Fxds-agent.git;a=commitdiff_plain;h=03ea9e0e7107d59f207b3842f9fc3f74d036ac91 Used standard DESTDIR variable in make install --- diff --git a/Makefile b/Makefile index 22b954a..902a238 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,12 @@ ifeq ($(origin SUB_VERSION), undefined) endif endif +# for backward compatibility +DESTDIR := $(INSTALL_DIR) # Configurable variables for installation (default /usr/local/...) -ifeq ($(origin INSTALL_DIR), undefined) - INSTALL_DIR := /usr/local/bin +ifeq ($(origin DESTDIR), undefined) + DESTDIR := /usr/local/bin endif HOST_GOOS=$(shell go env GOOS) @@ -117,7 +119,7 @@ distclean: clean .PHONY: install install: all - mkdir -p $(INSTALL_DIR) && cp $(LOCAL_BINDIR)/* $(INSTALL_DIR) + mkdir -p $(DESTDIR) && cp $(LOCAL_BINDIR)/* $(DESTDIR) vendor: tools/glide glide.yaml ./tools/glide install --strip-vendor diff --git a/README.md b/README.md index 4249251..06d0725 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,19 @@ Clone this repo into your `$GOPATH/src/github.com/iotbzh` and use delivered Make make all ``` -And to install xds-agent in /usr/local/bin: +And to install xds-agent (by default in `/usr/local/bin`): ```bash make install ``` -> **NOTE**: To cross build for example for Windows, just execute: +>**NOTE:** Used `DESTDIR` to specify another install directory +>```bash +>make install DESTDIR=$HOME/opt/xds-agent +>``` + + +#### Cross build +For example on a Linux machine to cross-build for Windows, just execute: ```bash export GOOS=windows export GOARCH=amd64