The standard variable for staged installations is DESTDIR and it should
be set only by the user, outside of Makefile. This is consistent with
recommendations from both GNU Make and FreeBSD porters-handbook.

        make DESTDIR=/tmp/stage install

$prefix and $PREFIX (in FreeBSD world) are used to specify where the
files will be installed. It defaults to /usr/local but can be /usr or
/opt or something else.

Usually one wants to do a stage installation when cross-building or for
other purposes. The convention is to use DESTDIR.
Changing $prefix is useful for installers. They can override its value
when calling make:

        make prefix=/usr install

Signed-off-by: Cristian Stoica <cristian.sto...@nxp.com>
---
 Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7f8df37..9871a8e 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,9 @@ CRYPTODEV_CFLAGS ?= #-DENABLE_ASYNC
 KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS)
 KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
 VERSION = 1.8
-PREFIX ?=
+
+prefix ?= /usr/local
+includedir = $(prefix)/include
 
 cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
 
@@ -31,8 +33,7 @@ install: modules_install
 
 modules_install:
        $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
-       @echo "Installing cryptodev.h in $(PREFIX)/usr/include/crypto ..."
-       @install -D crypto/cryptodev.h $(PREFIX)/usr/include/crypto/cryptodev.h
+       install -m 644 -D crypto/cryptodev.h 
$(DESTDIR)/$(includedir)/crypto/cryptodev.h
 
 clean:
        $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean
-- 
2.7.0


_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to