# HG changeset patch # User Mychaela Falconia # Date 1716256757 0 # Node ID 2a19b44c272ee86c3adbf21016b51fb7005be468 # Parent f0139d74d3aa9dfe3004cb2f4398115e7eb0fce4 convert to new ThemWi configure and build system diff -r f0139d74d3aa -r 2a19b44c272e .hgignore --- a/.hgignore Sat Sep 02 19:45:47 2023 +0000 +++ b/.hgignore Tue May 21 01:59:17 2024 +0000 @@ -1,6 +1,7 @@ syntax: regexp \.[oa]$ +^config\.defs$ ^enc-text/sms-encode-text$ ^gen-pdu/sms-gen-tpdu$ diff -r f0139d74d3aa -r 2a19b44c272e Makefile --- a/Makefile Sat Sep 02 19:45:47 2023 +0000 +++ b/Makefile Tue May 21 01:59:17 2024 +0000 @@ -1,26 +1,26 @@ -CC= gcc -CFLAGS= -O2 PROGDIR=enc-text gen-pdu scripts LIBDIR= libcoding SUBDIR= ${PROGDIR} ${LIBDIR} - -INSTALL_PREFIX= /opt/freecalypso +DESTDIR= all: ${SUBDIR} enc-text: libcoding gen-pdu: libcoding -${SUBDIR}: FRC - cd $@; ${MAKE} ${MFLAGS} CC=${CC} CFLAGS="${CFLAGS}" +${SUBDIR}: FRC config.defs + cd $@; ${MAKE} ${MFLAGS} + +config.defs: + @echo 'You must run ./configure before make' + @false clean: FRC rm -f a.out core errs for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} clean); done install: FRC - mkdir -p ${INSTALL_PREFIX} for i in ${PROGDIR}; do (cd $$i; ${MAKE} ${MFLAGS} \ - INSTALL_PREFIX=${INSTALL_PREFIX} install); done + DESTDIR=${DESTDIR} install); done FRC: diff -r f0139d74d3aa -r 2a19b44c272e configure --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure Tue May 21 01:59:17 2024 +0000 @@ -0,0 +1,68 @@ +#!/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=/usr/local +exec_prefix= +bindir= + +while [ $# != 0 ] +do + case "$1" in + --prefix=*) + prefix=`echo $1 | cut -c 10-` + ;; + --exec-prefix=*) + exec_prefix=`echo $1 | cut -c 15-` + ;; + --bindir=*) + bindir=`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 + +# inheritance rules for install directories + +if [ -z "$exec_prefix" ] +then + exec_prefix="$prefix" +fi +if [ -z "$bindir" ] +then + bindir="$exec_prefix/bin" +fi + +# report the final configuration + +echo "C code will be compiled with:" +echo " CC=$CC" +echo " CFLAGS=$CFLAGS" +echo "Installation directory:" +echo " bindir=$bindir" + +# emit the Makefile include fragment +echo "CC=$CC" > config.defs +echo "CFLAGS=$CFLAGS" >> config.defs +echo "bindir=$bindir" >> config.defs diff -r f0139d74d3aa -r 2a19b44c272e enc-text/Makefile --- a/enc-text/Makefile Sat Sep 02 19:45:47 2023 +0000 +++ b/enc-text/Makefile Tue May 21 01:59:17 2024 +0000 @@ -1,12 +1,8 @@ -CC= gcc -CFLAGS= -O2 PROG= sms-encode-text OBJS= concat_refno.o gsm7.o main.o ucs2.o LIBS= ../libcoding/libcoding.a -INSTALL_PREFIX= /opt/freecalypso - -INSTBIN=${INSTALL_PREFIX}/bin +include ../config.defs all: ${PROG} @@ -14,8 +10,8 @@ ${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} install: ${PROG} - mkdir -p ${INSTBIN} - install -c ${PROG} ${INSTBIN} + mkdir -p ${DESTDIR}${bindir} + install -c ${PROG} ${DESTDIR}${bindir} clean: rm -f *.o *.out *errs ${PROG} diff -r f0139d74d3aa -r 2a19b44c272e gen-pdu/Makefile --- a/gen-pdu/Makefile Sat Sep 02 19:45:47 2023 +0000 +++ b/gen-pdu/Makefile Tue May 21 01:59:17 2024 +0000 @@ -1,12 +1,8 @@ -CC= gcc -CFLAGS= -O2 PROG= sms-gen-tpdu OBJS= auto_scts.o input.o main.o message.o settings.o LIBS= ../libcoding/libcoding.a -INSTALL_PREFIX= /opt/freecalypso - -INSTBIN=${INSTALL_PREFIX}/bin +include ../config.defs all: ${PROG} @@ -14,8 +10,8 @@ ${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} install: ${PROG} - mkdir -p ${INSTBIN} - install -c ${PROG} ${INSTBIN} + mkdir -p ${DESTDIR}${bindir} + install -c ${PROG} ${DESTDIR}${bindir} clean: rm -f *.o *.out *errs ${PROG} diff -r f0139d74d3aa -r 2a19b44c272e libcoding/Makefile --- a/libcoding/Makefile Sat Sep 02 19:45:47 2023 +0000 +++ b/libcoding/Makefile Tue May 21 01:59:17 2024 +0000 @@ -1,10 +1,10 @@ -CC= gcc -CFLAGS= -O2 OBJS= alpha_addr.o check_high_bit.o gsm7_encode.o gsm7_encode2.o \ gsm7_encode_table.o gsm7_pack.o hexdigits.o hexout.o number_encode.o \ timestamp.o ucs2_bigend.o utf8_decode.o utf8_decode2.o LIB= libcoding.a +include ../config.defs + all: ${LIB} ${LIB}: ${OBJS} diff -r f0139d74d3aa -r 2a19b44c272e scripts/Makefile --- a/scripts/Makefile Sat Sep 02 19:45:47 2023 +0000 +++ b/scripts/Makefile Tue May 21 01:59:17 2024 +0000 @@ -1,13 +1,11 @@ SCRIPTS=gen-sms-deliver-pdu sms-deliver-pdu-hdr -INSTALL_PREFIX= /opt/freecalypso - -INSTBIN=${INSTALL_PREFIX}/bin +include ../config.defs all: install: - mkdir -p ${INSTBIN} - install -c ${SCRIPTS} ${INSTBIN} + mkdir -p ${DESTDIR}${bindir} + install -c ${SCRIPTS} ${DESTDIR}${bindir} clean: