correct usage of DESTDIR, PREFIX, etc. for the install make-target

[skip ci]
This commit is contained in:
Steffen Jaeckel 2017-08-28 15:56:12 +02:00
parent 504b3cbde7
commit 237b49ad4a
3 changed files with 19 additions and 18 deletions

View File

@ -83,10 +83,10 @@ profiled_single:
ranlib $(LIBNAME)
install: $(LIBNAME)
install -d $(LIBPATH)
install -d $(INCPATH)
install -m 644 $(LIBNAME) $(LIBPATH)
install -m 644 $(HEADERS_PUB) $(INCPATH)
install -d $(DESTDIR)$(LIBPATH)
install -d $(DESTDIR)$(INCPATH)
install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test

View File

@ -53,13 +53,13 @@ $(LIBNAME): $(OBJECTS)
$(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO)
install: $(LIBNAME)
install -d $(LIBPATH)
install -d $(INCPATH)
$(LT) --mode=install install -m 644 $(LIBNAME) $(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS_PUB) $(INCPATH)
sed -e 's,^prefix=.*,prefix=$(DESTDIR),' -e 's,^Version:.*,Version: $(VERSION),' libtommath.pc.in > libtommath.pc
install -d $(LIBPATH)/pkgconfig
install -m 644 libtommath.pc $(LIBPATH)/pkgconfig/
install -d $(DESTDIR)$(LIBPATH)
install -d $(DESTDIR)$(INCPATH)
$(LT) --mode=install install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtommath.pc.in > libtommath.pc
install -d $(DESTDIR)$(LIBPATH)/pkgconfig
install -m 644 libtommath.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o

View File

@ -68,13 +68,14 @@ HEADERS=tommath_private.h $(HEADERS_PUB)
test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
#LIBPATH-The directory for libtommath to be installed to.
#INCPATH-The directory to install the header files for libtommath.
#DATAPATH-The directory to install the pdf docs.
DESTDIR ?= /usr/local
LIBPATH ?= $(DESTDIR)/lib
INCPATH ?= $(DESTDIR)/include
DATAPATH ?= $(DESTDIR)/share/doc/libtommath/pdf
#LIBPATH The directory for libtommath to be installed to.
#INCPATH The directory to install the header files for libtommath.
#DATAPATH The directory to install the pdf docs.
DESTDIR ?=
PREFIX ?= /usr/local
LIBPATH ?= $(PREFIX)/lib
INCPATH ?= $(PREFIX)/include
DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf
#make the code coverage of the library
#