install per default to `/usr/local`
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/makefile.include b/makefile.include
index c862f0f..d09dc38 100644
--- a/makefile.include
+++ b/makefile.include
@@ -71,9 +71,10 @@ 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.
-LIBPATH?=/usr/lib
-INCPATH?=/usr/include
-DATAPATH?=/usr/share/doc/libtommath/pdf
+DESTDIR ?= /usr/local
+LIBPATH ?= $(DESTDIR)/lib
+INCPATH ?= $(DESTDIR)/include
+DATAPATH ?= $(DESTDIR)/share/doc/libtommath/pdf
#make the code coverage of the library
#
diff --git a/makefile.shared b/makefile.shared
index 559720e..02d6fcc 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -51,10 +51,10 @@ $(LIBNAME): $(OBJECTS)
$(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO)
install: $(LIBNAME)
- install -d $(DESTDIR)$(LIBPATH)
- install -d $(DESTDIR)$(INCPATH)
- $(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
- install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
+ install -d $(LIBPATH)
+ install -d $(INCPATH)
+ $(LT) --mode=install install -c $(LIBNAME) $(LIBPATH)/$(LIBNAME)
+ install -m 644 $(HEADERS_PUB) $(INCPATH)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o