changeset 460:cb1d1ea7f2c5

new build system: accept more directory options
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 23:04:44 +0000
parents b094bc07051a
children a53225b44ea5
files amrconv/Makefile amrefr/Makefile amrtest/Makefile configure efrtest/Makefile frtest/Makefile libgsmefr/Makefile libgsmfr2/Makefile libtwamr/Makefile miscutil/Makefile
diffstat 10 files changed, 74 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/amrconv/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/amrconv/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -3,7 +3,6 @@
 LIBTEST=../libtest/libtest.a
 
 include ../config.defs
-INSTBIN=${DESTDIR}${PREFIX}/bin
 
 AMR2EFR_OBJS=	amr122bits.o bitmanip.o amr2efr.o
 EFR2AMR_OBJS=	amr122bits.o bitmanip.o efr2amr.o
@@ -38,8 +37,8 @@
 	${CC} ${CFLAGS} -o $@ ${EFR2AMR_OBJS} ${LIBTEST}
 
 install:
-	mkdir -p ${INSTBIN}
-	install -c ${PROGS} ${INSTBIN}
+	mkdir -p ${DESTDIR}${bindir}
+	install -c ${PROGS} ${DESTDIR}${bindir}
 
 clean:
 	rm -f *.o *.out ${PROGS}
--- a/amrefr/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/amrefr/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -6,7 +6,6 @@
 LIBST=	${LIBEFR} ${LIBAMR} ${LIBTEST}
 
 include ../config.defs
-INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
@@ -32,8 +31,8 @@
 	${CC} ${CFLAGS} -c -o $@ $<
 
 install:
-	mkdir -p ${INSTBIN}
-	install -c ${PROGS} ${INSTBIN}
+	mkdir -p ${DESTDIR}${bindir}
+	install -c ${PROGS} ${DESTDIR}${bindir}
 
 clean:
 	rm -f *.o *.out ${PROGS}
--- a/amrtest/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/amrtest/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -4,7 +4,6 @@
 LIBTEST=../libtest/libtest.a
 
 include ../config.defs
-INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
@@ -27,8 +26,8 @@
 	${CC} ${CFLAGS} -o $@ $^
 
 install:
-	mkdir -p ${INSTBIN}
-	install -c ${PROGS} ${INSTBIN}
+	mkdir -p ${DESTDIR}${bindir}
+	install -c ${PROGS} ${DESTDIR}${bindir}
 
 clean:
 	rm -f *.o *.out ${PROGS}
--- a/configure	Fri May 10 19:50:29 2024 +0000
+++ b/configure	Fri May 10 23:04:44 2024 +0000
@@ -13,13 +13,29 @@
 # defaults that can be overridden
 CC=gcc
 CFLAGS=-O2
-PREFIX=/opt/themwi
+prefix=/opt/themwi
+exec_prefix=
+bindir=
+includedir=
+libdir=
 
 while [ $# != 0 ]
 do
 	case "$1" in
 		--prefix=*)
-			PREFIX=`echo $1 | cut -c 10-`
+			prefix=`echo $1 | cut -c 10-`
+			;;
+		--exec-prefix=*)
+			exec_prefix=`echo $1 | cut -c 15-`
+			;;
+		--bindir=*)
+			bindir=`echo $1 | cut -c 10-`
+			;;
+		--includedir=*)
+			includedir=`echo $1 | cut -c 14-`
+			;;
+		--libdir=*)
+			libdir=`echo $1 | cut -c 10-`
 			;;
 		CC=*)
 			CC=`echo $1 | cut -c 4-`
@@ -35,7 +51,38 @@
 	shift
 done
 
+# inheritance rules for install directories
+
+if [ -z "$exec_prefix" ]
+then
+	exec_prefix="$prefix"
+fi
+if [ -z "$bindir" ]
+then
+	bindir="$exec_prefix/bin"
+fi
+if [ -z "$includedir" ]
+then
+	includedir="$prefix/include"
+fi
+if [ -z "$libdir" ]
+then
+	libdir="$exec_prefix/lib"
+fi
+
+# report the final configuration
+
+echo "C code will be compiled with:"
+echo "  CC=$CC"
+echo "  CFLAGS=$CFLAGS"
+echo "Installation directories:"
+echo "  bindir=$bindir"
+echo "  includedir=$includedir"
+echo "  libdir=$libdir"
+
 # emit the Makefile include fragment
 echo "CC=$CC" > config.defs
 echo "CFLAGS=$CFLAGS" >> config.defs
-echo "PREFIX=$PREFIX" >> config.defs
+echo "bindir=$bindir" >> config.defs
+echo "includedir=$includedir" >> config.defs
+echo "libdir=$libdir" >> config.defs
--- a/efrtest/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/efrtest/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -6,7 +6,6 @@
 LIBTEST=../libtest/libtest.a
 
 include ../config.defs
-INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
@@ -50,8 +49,8 @@
 	${CC} ${CFLAGS} -o $@ $^
 
 install:
-	mkdir -p ${INSTBIN}
-	install -c ${PROGS} ${INSTBIN}
+	mkdir -p ${DESTDIR}${bindir}
+	install -c ${PROGS} ${DESTDIR}${bindir}
 
 clean:
 	rm -f *.o *.out ${PROGS}
--- a/frtest/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/frtest/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -5,7 +5,6 @@
 LIBTEST=../libtest/libtest.a
 
 include ../config.defs
-INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
@@ -37,8 +36,8 @@
 	${CC} ${CFLAGS} -o $@ $^
 
 install:
-	mkdir -p ${INSTBIN}
-	install -c ${PROGS} ${INSTBIN}
+	mkdir -p ${DESTDIR}${bindir}
+	install -c ${PROGS} ${DESTDIR}${bindir}
 
 clean:
 	rm -f *.o *.out ${PROGS}
--- a/libgsmefr/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/libgsmefr/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -14,7 +14,6 @@
 LIB=	libgsmefr.a
 
 include ../config.defs
-INSTALL_PREFIX=${DESTDIR}${PREFIX}
 
 all:	${LIB}
 
@@ -25,10 +24,10 @@
 	ranlib $@
 
 install:
-	mkdir -p ${INSTALL_PREFIX}/include
-	install -c -m 444 gsm_efr.h ${INSTALL_PREFIX}/include
-	mkdir -p ${INSTALL_PREFIX}/lib
-	install -c -m 444 ${LIB} ${INSTALL_PREFIX}/lib
+	mkdir -p ${DESTDIR}${includedir}
+	install -c -m 444 gsm_efr.h ${DESTDIR}${includedir}
+	mkdir -p ${DESTDIR}${libdir}
+	install -c -m 444 ${LIB} ${DESTDIR}${libdir}
 
 clean:
 	rm -f *.[oa] errs
--- a/libgsmfr2/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/libgsmfr2/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -7,7 +7,6 @@
 LIB=	libgsmfr2.a
 
 include ../config.defs
-INSTALL_PREFIX=${DESTDIR}${PREFIX}
 
 all:	${LIB}
 
@@ -18,10 +17,10 @@
 	ranlib $@
 
 install:
-	mkdir -p ${INSTALL_PREFIX}/include
-	install -c -m 444 tw_gsmfr.h ${INSTALL_PREFIX}/include
-	mkdir -p ${INSTALL_PREFIX}/lib
-	install -c -m 444 ${LIB} ${INSTALL_PREFIX}/lib
+	mkdir -p ${DESTDIR}${includedir}
+	install -c -m 444 tw_gsmfr.h ${DESTDIR}${includedir}
+	mkdir -p ${DESTDIR}${libdir}
+	install -c -m 444 ${LIB} ${DESTDIR}${libdir}
 
 clean:
 	rm -f *.[oa] errs
--- a/libtwamr/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/libtwamr/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -39,7 +39,6 @@
 LIB=	libtwamr.a
 
 include ../config.defs
-INSTALL_PREFIX=${DESTDIR}${PREFIX}
 
 all:	${LIB}
 
@@ -53,10 +52,10 @@
 	ranlib $@
 
 install:
-	mkdir -p ${INSTALL_PREFIX}/include
-	install -c -m 444 tw_amr.h ${INSTALL_PREFIX}/include
-	mkdir -p ${INSTALL_PREFIX}/lib
-	install -c -m 444 ${LIB} ${INSTALL_PREFIX}/lib
+	mkdir -p ${DESTDIR}${includedir}
+	install -c -m 444 tw_amr.h ${DESTDIR}${includedir}
+	mkdir -p ${DESTDIR}${libdir}
+	install -c -m 444 ${LIB} ${DESTDIR}${libdir}
 
 clean:
 	rm -f *.[oa] namespace.h errs
--- a/miscutil/Makefile	Fri May 10 19:50:29 2024 +0000
+++ b/miscutil/Makefile	Fri May 10 23:04:44 2024 +0000
@@ -4,7 +4,6 @@
 LIBTEST=../libtest/libtest.a
 
 include ../config.defs
-INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
@@ -30,8 +29,8 @@
 	${CC} ${CFLAGS} -o $@ $@.c
 
 install:
-	mkdir -p ${INSTBIN}
-	install -c ${PROGS} ${INSTBIN}
+	mkdir -p ${DESTDIR}${bindir}
+	install -c ${PROGS} ${DESTDIR}${bindir}
 
 clean:
 	rm -f *.o *.out ${PROGS}