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) ranlib $(LIBNAME)
install: $(LIBNAME) install: $(LIBNAME)
install -d $(LIBPATH) install -d $(DESTDIR)$(LIBPATH)
install -d $(INCPATH) install -d $(DESTDIR)$(INCPATH)
install -m 644 $(LIBNAME) $(LIBPATH) install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -m 644 $(HEADERS_PUB) $(INCPATH) install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
test: $(LIBNAME) demo/demo.o test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test $(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) $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO)
install: $(LIBNAME) install: $(LIBNAME)
install -d $(LIBPATH) install -d $(DESTDIR)$(LIBPATH)
install -d $(INCPATH) install -d $(DESTDIR)$(INCPATH)
$(LT) --mode=install install -m 644 $(LIBNAME) $(LIBPATH)/$(LIBNAME) $(LT) --mode=install install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS_PUB) $(INCPATH) install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
sed -e 's,^prefix=.*,prefix=$(DESTDIR),' -e 's,^Version:.*,Version: $(VERSION),' libtommath.pc.in > libtommath.pc sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtommath.pc.in > libtommath.pc
install -d $(LIBPATH)/pkgconfig install -d $(DESTDIR)$(LIBPATH)/pkgconfig
install -m 644 libtommath.pc $(LIBPATH)/pkgconfig/ install -m 644 libtommath.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
test: $(LIBNAME) demo/demo.o test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o 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 test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
#LIBPATH-The directory for libtommath to be installed to. #LIBPATH The directory for libtommath to be installed to.
#INCPATH-The directory to install the header files for libtommath. #INCPATH The directory to install the header files for libtommath.
#DATAPATH-The directory to install the pdf docs. #DATAPATH The directory to install the pdf docs.
DESTDIR ?= /usr/local DESTDIR ?=
LIBPATH ?= $(DESTDIR)/lib PREFIX ?= /usr/local
INCPATH ?= $(DESTDIR)/include LIBPATH ?= $(PREFIX)/lib
DATAPATH ?= $(DESTDIR)/share/doc/libtommath/pdf INCPATH ?= $(PREFIX)/include
DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf
#make the code coverage of the library #make the code coverage of the library
# #