Commit b98147c9723343251dcb2f1f7d51973a63baa792

Steffen Jaeckel 2015-11-12T02:02:18

update install steps in makefiles - add tommath_private.h to HEADERS - only install public header files - move more shared stuff to makefile.include - make it possible to override the *PATH makefile variables

diff --git a/makefile b/makefile
index 576dcd1..aec9982 100644
--- a/makefile
+++ b/makefile
@@ -19,19 +19,6 @@ VERSION=0.43.0
 
 include makefile.include
 
-#install as this user
-ifndef INSTALL_GROUP
-   GROUP=wheel
-else
-   GROUP=$(INSTALL_GROUP)
-endif
-
-ifndef INSTALL_USER
-   USER=root
-else
-   USER=$(INSTALL_USER)
-endif
-
 #default files to install
 ifndef LIBNAME
    LIBNAME=libtommath.a
@@ -39,14 +26,6 @@ endif
 
 default: ${LIBNAME}
 
-#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=
-LIBPATH=/usr/lib
-INCPATH=/usr/include
-DATAPATH=/usr/share/doc/libtommath/pdf
-
 #START_INS
 OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
 bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
@@ -124,7 +103,7 @@ install: $(LIBNAME)
 	install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
 	install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
 	install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
-	install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
+	install -g $(GROUP) -o $(USER) $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
 
 test: $(LIBNAME) demo/demo.o
 	$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test
diff --git a/makefile.include b/makefile.include
index a6c5a66..7f12de6 100644
--- a/makefile.include
+++ b/makefile.include
@@ -47,8 +47,28 @@ endif
 endif # COMPILE_SIZE
 endif # COMPILE_DEBUG
 
-HEADERS=tommath.h tommath_class.h tommath_superclass.h
+HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
+HEADERS=tommath_private.h $(HEADERS_PUB)
 
 test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
 
+#install as this user
+ifndef INSTALL_GROUP
+   GROUP=wheel
+else
+   GROUP=$(INSTALL_GROUP)
+endif
+
+ifndef INSTALL_USER
+   USER=root
+else
+   USER=$(INSTALL_USER)
+endif
+
+#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
 
diff --git a/makefile.shared b/makefile.shared
index 4adb400..f8b7760 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -8,19 +8,6 @@ include makefile.include
 LT	?= libtool
 LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
 
-#install as this user
-ifndef INSTALL_GROUP
-   GROUP=wheel
-else
-   GROUP=$(INSTALL_GROUP)
-endif
-
-ifndef INSTALL_USER
-   USER=root
-else
-   USER=$(INSTALL_USER)
-endif
-
 default: libtommath.la
 
 #default files to install
@@ -31,14 +18,6 @@ ifndef LIBNAME_S
    LIBNAME_S=libtommath.a
 endif
 
-#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=
-LIBPATH=/usr/lib
-INCPATH=/usr/include
-DATAPATH=/usr/share/doc/libtommath/pdf
-
 #START_INS
 OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
 bn_fast_s_mp_mul_high_digs.o bn_fast_s_mp_sqr.o bn_mp_2expt.o bn_mp_abs.o bn_mp_add.o bn_mp_add_d.o \
@@ -79,7 +58,7 @@ install: $(LIBNAME)
 	install -d $(DESTDIR)$(LIBPATH)
 	$(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
 	install -d $(DESTDIR)$(INCPATH)
-	install -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
+	install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
 
 test: $(LIBNAME) demo/demo.o
 	$(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o