FreeCalypso > hg > themwi-nanp
changeset 14:78319ed870dc
convert to new ThemWi configure and build system
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 21 May 2024 00:15:24 +0000 |
parents | c0bfd300b6e5 |
children | a24f0794ab4d |
files | .hgignore Makefile configure include/Makefile libnumdb/Makefile libnumutil/Makefile utils/Makefile |
diffstat | 7 files changed, 116 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Wed Dec 13 06:07:40 2023 +0000 +++ b/.hgignore Tue May 21 00:15:24 2024 +0000 @@ -1,6 +1,7 @@ syntax: regexp \.[oa]$ +^config\.defs$ ^utils/themwi-check-own$ ^utils/themwi-dump-numdb$
--- a/Makefile Wed Dec 13 06:07:40 2023 +0000 +++ b/Makefile Tue May 21 00:15:24 2024 +0000 @@ -1,18 +1,20 @@ SUBDIR= include libnumdb libnumutil utils - -INSTALL_PREFIX= /opt/themwi +DESTDIR= all: ${SUBDIR} utils: libnumdb libnumutil -${SUBDIR}: FRC +${SUBDIR}: FRC config.defs cd $@; ${MAKE} ${MFLAGS} +config.defs: + @echo 'You must run ./configure before make' + @false + install: FRC - mkdir -p ${INSTALL_PREFIX} for i in ${SUBDIR}; do (cd $$i; ${MAKE} ${MFLAGS} \ - INSTALL_PREFIX=${INSTALL_PREFIX} install); done + DESTDIR=${DESTDIR} install); done clean: FRC rm -f a.out core errs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure Tue May 21 00:15:24 2024 +0000 @@ -0,0 +1,88 @@ +#!/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= +includedir= +libdir= + +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-` + ;; + --includedir=*) + includedir=`echo $1 | cut -c 14-` + ;; + --libdir=*) + libdir=`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 +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 "bindir=$bindir" >> config.defs +echo "includedir=$includedir" >> config.defs +echo "libdir=$libdir" >> config.defs
--- a/include/Makefile Wed Dec 13 06:07:40 2023 +0000 +++ b/include/Makefile Tue May 21 00:15:24 2024 +0000 @@ -1,7 +1,8 @@ -INSTALL_PREFIX= /opt/themwi +FILES= number_db_v2.h number_lookup.h number_utils.h -INSTDIR=${INSTALL_PREFIX}/include/themwi/nanp -FILES= number_db_v2.h number_lookup.h number_utils.h +include ../config.defs + +INSTDIR=${DESTDIR}${includedir}/themwi/nanp all:
--- a/libnumdb/Makefile Wed Dec 13 06:07:40 2023 +0000 +++ b/libnumdb/Makefile Tue May 21 00:15:24 2024 +0000 @@ -1,10 +1,8 @@ -INSTALL_PREFIX= /opt/themwi - -CC= gcc -CFLAGS= -O2 -I../build-inc +CPPFLAGS=-I../build-inc OBJS= check_nanp.o check_short.o readbin.o refresh.o LIB= libnumdb.a -INSTDIR=${INSTALL_PREFIX}/lib + +include ../config.defs all: ${LIB} @@ -13,8 +11,8 @@ ranlib $@ install: - mkdir -p ${INSTDIR} - install -c -m 644 ${LIB} ${INSTDIR} + mkdir -p ${DESTDIR}${libdir} + install -c -m 644 ${LIB} ${DESTDIR}${libdir} clean: rm -f *.[oa] errs
--- a/libnumutil/Makefile Wed Dec 13 06:07:40 2023 +0000 +++ b/libnumutil/Makefile Tue May 21 00:15:24 2024 +0000 @@ -1,10 +1,8 @@ -INSTALL_PREFIX= /opt/themwi - -CC= gcc -CFLAGS= -O2 -I../build-inc +CPPFLAGS=-I../build-inc OBJS= digit_groups.o nanp_valid.o numstring.o LIB= libnumutil.a -INSTDIR=${INSTALL_PREFIX}/lib + +include ../config.defs all: ${LIB} @@ -13,8 +11,8 @@ ranlib $@ install: - mkdir -p ${INSTDIR} - install -c -m 644 ${LIB} ${INSTDIR} + mkdir -p ${DESTDIR}${libdir} + install -c -m 644 ${LIB} ${DESTDIR}${libdir} clean: rm -f *.[oa] errs
--- a/utils/Makefile Wed Dec 13 06:07:40 2023 +0000 +++ b/utils/Makefile Tue May 21 00:15:24 2024 +0000 @@ -1,11 +1,9 @@ -INSTALL_PREFIX= /opt/themwi - -CC= gcc -CFLAGS= -O2 -I../build-inc +CPPFLAGS=-I../build-inc PROGS= themwi-check-own themwi-dump-numdb themwi-short-dial themwi-update-numdb LIBNUMDB=../libnumdb/libnumdb.a LIBUTIL=../libnumutil/libnumutil.a -INSTBIN=${INSTALL_PREFIX}/bin + +include ../config.defs all: ${PROGS} @@ -13,7 +11,7 @@ ${CC} -o $@ $@.o ${LIBNUMDB} ${LIBUTIL} themwi-dump-numdb: themwi-dump-numdb.c - ${CC} ${CFLAGS} -o $@ $@.c + ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ $@.c themwi-short-dial: themwi-short-dial.o ${LIBNUMDB} ${LIBUTIL} ${CC} -o $@ $@.o ${LIBNUMDB} ${LIBUTIL} @@ -22,8 +20,8 @@ ${CC} -o $@ $@.o ${LIBUTIL} install: - mkdir -p ${INSTBIN} - install -c -m 755 ${PROGS} ${INSTBIN} + mkdir -p ${DESTDIR}${bindir} + install -c -m 755 ${PROGS} ${DESTDIR}${bindir} clean: rm -f *.o ${PROGS} errs