changeset 453:19f1aa01ea10

new approach to config & build for ThemWi software
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 05:45:46 +0000
parents 6e595f7d40e2
children 4b6fa53a8240
files .hgignore Makefile amrconv/Makefile amrefr/Makefile amrtest/Makefile configure dev/Makefile efrtest/Makefile frtest/Makefile libgsmefr/Makefile libgsmfr2/Makefile libtest/Makefile libtwamr/Makefile miscutil/Makefile
diffstat 14 files changed, 80 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri May 10 03:45:47 2024 +0000
+++ b/.hgignore	Fri May 10 05:45:46 2024 +0000
@@ -1,6 +1,7 @@
 syntax: regexp
 
 \.[oa]$
+^config\.defs$
 
 ^amrconv/amr-cod-parse$
 ^amrconv/amr-cod2ietf$
--- a/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,11 +1,10 @@
-CC=	gcc
-CFLAGS=	-O2
-
 SUBDIR_LIBPROD=	libgsmefr libgsmfr2 libtwamr
 SUBDIR_UTILS=	amrconv amrefr amrtest efrtest frtest miscutil
 SUBDIR_INT=	dev libtest
 
 SUBDIR=	${SUBDIR_LIBPROD} ${SUBDIR_UTILS} ${SUBDIR_INT}
+SUBDIR_INST=	${SUBDIR_LIBPROD} ${SUBDIR_UTILS}
+DESTDIR=
 
 all:	${SUBDIR}
 
@@ -16,14 +15,16 @@
 frtest:		libgsmfr2 libtest
 miscutil:	libgsmefr libgsmfr2 libtest
 
-${SUBDIR}: FRC
-	cd $@; ${MAKE} ${MFLAGS} CC=${CC} CFLAGS="${CFLAGS}"
+${SUBDIR}: FRC config.defs
+	cd $@; ${MAKE} ${MFLAGS}
 
-install-lib:	FRC
-	for i in ${SUBDIR_LIBPROD}; do (cd $$i; ${MAKE} ${MFLAGS} install); done
+config.defs:
+	@echo 'You must run ./configure before make'
+	@false
 
-install-utils:	FRC
-	for i in ${SUBDIR_UTILS}; do (cd $$i; ${MAKE} ${MFLAGS} install); done
+install:	FRC
+	for i in ${SUBDIR_INST}; do (cd $$i; ${MAKE} ${MFLAGS} \
+		DESTDIR=${DESTDIR} install); done
 
 clean: FRC
 	rm -f a.out core errs
--- a/amrconv/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/amrconv/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,9 +1,9 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	amr-cod-parse amr-cod2ietf amr-ietf-parse amr-ietf2cod gsm-amr2efr \
 	gsm-efr2amr
 LIBTEST=../libtest/libtest.a
-INSTBIN=/opt/freecalypso/bin
+
+include ../config.defs
+INSTBIN=${DESTDIR}${PREFIX}/bin
 
 AMR2EFR_OBJS=	amr122bits.o bitmanip.o amr2efr.o
 EFR2AMR_OBJS=	amr122bits.o bitmanip.o efr2amr.o
--- a/amrefr/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/amrefr/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,12 +1,12 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	amrefr-decode-r amrefr-encode-r amrefr-tseq-dec amrefr-tseq-enc
 LIBEFR=	../libgsmefr/libgsmefr.a
 LIBAMR=	../libtwamr/libtwamr.a
 LIBTEST=../libtest/libtest.a
 LIBS=	${LIBEFR} ${LIBAMR}
 LIBST=	${LIBEFR} ${LIBAMR} ${LIBTEST}
-INSTBIN=/opt/freecalypso/bin
+
+include ../config.defs
+INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
--- a/amrtest/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/amrtest/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,10 +1,10 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	twamr-decode twamr-decode-r twamr-encode twamr-encode-r twamr-tseq-dec \
 	twamr-tseq-enc
 LIBAMR=	../libtwamr/libtwamr.a
 LIBTEST=../libtest/libtest.a
-INSTBIN=/opt/freecalypso/bin
+
+include ../config.defs
+INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/configure	Fri May 10 05:45:46 2024 +0000
@@ -0,0 +1,41 @@
+#!/bin/sh
+# This configure script is custom and hand-coded;
+# it is NOT a product of GNU Autoconf or any other such tools!
+
+set -e
+
+if [ ! -f configure ]
+then
+	echo "This script needs to be run from the top of the source tree" 1>&2
+	exit 1
+fi
+
+# defaults that can be overridden
+CC=gcc
+CFLAGS=-O2
+PREFIX=/opt/themwi
+
+while [ $# != 0 ]
+do
+	case "$1" in
+		--prefix=*)
+			PREFIX=`echo $1 | cut -c 10-`
+			;;
+		CC=*)
+			CC=`echo $1 | cut -c 4-`
+			;;
+		CFLAGS=*)
+			CFLAGS=`echo $1 | cut -c 8-`
+			;;
+		*)
+			echo "error: non-understood option $1" 1>&2
+			exit 1;
+			;;
+	esac
+	shift
+done
+
+# emit the Makefile include fragment
+echo "CC=$CC" > config.defs
+echo "CFLAGS=$CFLAGS" >> config.defs
+echo "PREFIX=$PREFIX" >> config.defs
--- a/dev/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/dev/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,5 +1,3 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	a2s-regen efr-bit-packing efr-sid-insert efr-tidsp gsm0611-silence-fr \
 	gsmfr-dhf mk-256bytes s2a-regen s2u-regen s2u-regen-plus4 u2s-regen \
 	xmaxc-tables
@@ -7,6 +5,8 @@
 	gsm0611-silence-fr.out gsmfr-dhf.out s2a-regen.out s2u-regen.out \
 	s2u-regen-plus4.out u2s-regen.out xmaxc-tables.out
 
+include ../config.defs
+
 all:	${PROGS} ${DATAOUT}
 
 a2s-regen:	a2s-regen.c
--- a/efrtest/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/efrtest/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,12 +1,12 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	gsmefr-cod-parse gsmefr-cod2gsmx gsmefr-dec-parse gsmefr-decode \
 	gsmefr-decode-r gsmefr-dlcap-dec gsmefr-dlcap-gsmx gsmefr-dlcap-parse \
 	gsmefr-encode gsmefr-encode-r gsmefr-etsi-dec gsmefr-etsi-enc \
 	gsmefr-rec2etsi
 LIBEFR=	../libgsmefr/libgsmefr.a
 LIBTEST=../libtest/libtest.a
-INSTBIN=/opt/freecalypso/bin
+
+include ../config.defs
+INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
--- a/frtest/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/frtest/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,11 +1,11 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	gsmfr-cod2std gsmfr-decode gsmfr-decode-r gsmfr-decode-rb \
 	gsmfr-dlcap-gsmx gsmfr-dlcap-parse gsmfr-encode gsmfr-encode-r \
 	gsmfr-preproc
 LIBFR2=	../libgsmfr2/libgsmfr2.a
 LIBTEST=../libtest/libtest.a
-INSTBIN=/opt/freecalypso/bin
+
+include ../config.defs
+INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}
 
--- a/libgsmefr/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/libgsmefr/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,5 +1,3 @@
-CC=	gcc
-CFLAGS=	-O2
 OBJS=	agc.o autocorr.o az_lsp.o basicops.o bfi_nodata.o c1035pf.o cod_12k2.o \
 	convolve.o d1035pf.o d_gains.o d_homing.o d_plsf_5.o dec_12k2.o \
 	dec_create.o dec_lag6.o dec_main.o dec_wrap.o dtx_common.o dtx_dec.o \
@@ -15,7 +13,8 @@
 	no_count.h oper_32b.h q_plsf5_tab.h sig_proc.h typedef.h vad.h
 LIB=	libgsmefr.a
 
-INSTALL_PREFIX=	/usr/local
+include ../config.defs
+INSTALL_PREFIX=${DESTDIR}${PREFIX}
 
 all:	${LIB}
 
--- a/libgsmfr2/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/libgsmfr2/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,5 +1,3 @@
-CC=	gcc
-CFLAGS=	-O2
 OBJS=	add.o comfort_noise.o dec_main.o dec_wrap.o dhf.o ed_state.o \
 	enc_homing.o enc_main.o enc_wrap.o full_dec.o long_term.o lpc.o \
 	pack_frame.o pack_frame2.o pp_bad.o pp_good.o pp_state.o preprocess.o \
@@ -8,7 +6,8 @@
 HDRS=	ed_internal.h ed_state.h pp_internal.h pp_state.h tw_gsmfr.h typedef.h
 LIB=	libgsmfr2.a
 
-INSTALL_PREFIX=	/usr/local
+include ../config.defs
+INSTALL_PREFIX=${DESTDIR}${PREFIX}
 
 all:	${LIB}
 
--- a/libtest/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/libtest/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,9 +1,9 @@
-CC=	gcc
-CFLAGS=	-O2
 OBJS=	binreader.o parse_dlcap.o pcmwrite.o roberead.o robewrite.o wavrdhelp.o\
 	wavreader.o wavwriter.o
 LIB=	libtest.a
 
+include ../config.defs
+
 all:	${LIB}
 
 ${LIB}:	${OBJS}
--- a/libtwamr/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/libtwamr/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,5 +1,3 @@
-CC=	gcc
-CFLAGS=	-O2
 OBJS=	a_refl.o agc.o autocorr.o az_lsp.o b_cn_cod.o basicop2.o bgnscd.o \
 	bitno.o bits2prm.o c1035pf.o c2_11pf.o c2_9pf.o c3_14pf.o c4_17pf.o \
 	c8_31pf.o c_g_aver.o calc_cor.o calc_en.o cbsearch.o cl_ltp.o cod_amr.o\
@@ -40,7 +38,8 @@
 	window.h
 LIB=	libtwamr.a
 
-INSTALL_PREFIX=	/usr/local
+include ../config.defs
+INSTALL_PREFIX=${DESTDIR}${PREFIX}
 
 all:	${LIB}
 
--- a/miscutil/Makefile	Fri May 10 03:45:47 2024 +0000
+++ b/miscutil/Makefile	Fri May 10 05:45:46 2024 +0000
@@ -1,10 +1,10 @@
-CC=	gcc
-CFLAGS=	-O2
 PROGS=	gsmrec-dump pcm16-check13 pcm16-raw2wav pcm16-to-alaw pcm16-to-ulaw \
 	pcm16-wav2raw pcm8-to-pcm16
 LIBEFR=	../libgsmefr/libgsmefr.a ../libgsmfr2/libgsmfr2.a
 LIBTEST=../libtest/libtest.a
-INSTBIN=/opt/freecalypso/bin
+
+include ../config.defs
+INSTBIN=${DESTDIR}${PREFIX}/bin
 
 all:	${PROGS}