Simple command line calculator https://amath.innolan.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1292 lines
29 KiB

#!/bin/sh
#
# Copyright {c} 2014-2017 Carsten Sonne Larsen <cs@innolan.net>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES {INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION}
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT {INCLUDING NEGLIGENCE OR OTHERWISE} ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
set -e
version="1.8.3"
clang=false
debugsym=false
regtest=true
openlibm=false
stdlibm=false
stdlibc=false
useldconfig=false
fpic=false
prefix="/usr"
pkgconfigdir="lib/pkgconfig"
mandir="share/man"
cflags=""
cxxflags=""
ldflags=""
gcclib="-lstdc++"
libm=""
libc=""
for arg in "$@"; do
unknown=true
case "$arg" in
--prefix=*)
prefix=`echo $arg | sed 's/--prefix=//'`
unknown=false
;;
--pkgconfig=*)
pkgconfigdir=`echo $arg | sed 's/--pkgconfig=//'`
unknown=false
;;
--mandir=*)
mandir=`echo $arg | sed 's/--mandir=//'`
unknown=false
;;
--man-dir=*)
mandir=`echo $arg | sed 's/--mandir=//'`
unknown=false
;;
--doc-dir=*)
unknown=false
;;
--cross-compile=*)
crosscompile=`echo $arg | sed 's/--cross-compile=//'`
crosscompile="${crosscompile}-"
unknown=false
;;
CFLAGS=*)
cflags=`echo $arg | sed 's/CFLAGS=//'`
cflags="${cflags} "
unknown=false
;;
CXXFLAGS=*)
cxxflags=`echo $arg | sed 's/CXXFLAGS=//'`
cxxflags="${cxxflags} "
unknown=false
;;
LDFLAGS=*)
ldflags=`echo $arg | sed 's/LDFLAGS=//'`
ldflags="${ldflags} "
unknown=false
;;
--enable-clang)
clang=true
unknown=false
;;
--disable-clang)
clang=false
unknown=false
;;
--enable-ldconfig)
useldconfig=true
unknown=false
;;
--disable-ldconfig)
useldconfig=false
unknown=false
;;
--enable-pic)
fpic=true
unknown=false
;;
--disable-pic)
fpic=false
unknown=false
;;
--enable-debug)
debugsym=true
unknown=false
;;
--disable-debug)
debugsym=false
unknown=false
;;
--enable-test)
regtest=true
unknown=false
;;
--disable-test)
regtest=false
unknown=false
;;
--with-libm)
stdlibm=true
unknown=false
;;
--without-libm)
stdlibm=false
unknown=false
;;
--with-openlibm)
openlibm=true
unknown=false
;;
--without-openlibm)
openlibm=false
unknown=false
;;
--with-stdc++)
gcclib="-lstdc++"
unknown=false
;;
--without-stdc++)
gcclib=""
unknown=false
;;
--with-libc)
stdlibc=true
unknown=false
;;
--without-libc)
stdlibc=false
unknown=false
;;
--help)
echo "amath configure script ${version}"
echo
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation prefix'
echo ' --pkgconfig=<path>: pkg-config path (without prefix)'
echo ' --mandir=<path>: manpage path (without prefix)'
echo ' --cross-compile=<prefix>: cross compiler prefix'
echo ' --enable-debug: include debug symbols'
echo ' --disable-debug: do not include debug symbols'
echo ' --enable-test: build code with regression tests'
echo ' --disable-test: do not include regression test'
echo ' --enable-clang: build explicit with clang compiler'
echo ' --disable-clang: do not explicit build with clang compiler'
echo ' --enable-ldconfig: use ldconfig to registre libraries'
echo ' --disable-ldconfig: do not use ldconfig to registre libraries'
echo ' --enable-pic: build with Position Independent Code (-fPIC)'
echo ' --disable-pic: do not build static libraries with Position Independent Code'
echo ' --with-libm: link with libm library (-lm)'
echo ' --without-libm: do not link with libm library'
echo ' --with-openlibm: link with openlibm library (-lopenlibm)'
echo ' --without-openlibm: do not link with openlibm library'
echo ' --with-stdc++: link with stdc++ library (-lstdc++)'
echo ' --without-stdc++: do not link with stdc++ library'
echo ' --with-libc: explicit link with libc library (-lc)'
echo ' --without-libc: do not link with libc library'
echo
echo ' CFLAGS=<flags>: additional compiler flags'
echo ' CXXFLAGS=<flags>: additional compiler flags'
echo ' LDFLAGS=<flags>: additional linker flags'
echo
exit 0
;;
esac
if $unknown; then
echo "Invalid option $arg"
exit 1
fi
done
if $clang; then
ccompiler="clang"
cxxcompiler="clang++"
else
ccompiler="gcc"
cxxcompiler="g++"
fi
if $regtest; then
options=" -DWITHTEST"
else
options=" "
fi
if $debugsym; then
appop="-O0 -g"
libop="-O0 -g"
exestrip=""
debugflag="-DDEBUG "
else
appop="-O2"
libop="-O3"
exestrip="-s"
debugflag=""
fi
dlibm=false
mflags=""
if $stdlibm; then
libm="-lm "
mflags="-DLIBM "
dlibm=true
fi
if $openlibm; then
libm="-lopenlibm "
mflags="-DLIBM "
dlibm=true
fi
if $useldconfig; then
soverion=".${version}"
else
soverion=""
fi
if $stdlibc; then
gcclib="${gcclib} -lc"
libc="-lc"
fi
if $fpic; then
fPIC=" -fPIC"
else
fPIC=""
fi
cflags="${cflags}${debugflag}${mflags}"
cxxflags="${cflags} ${cxxflags}"
APPSRCS='
evaluator.cpp
functionlist.cpp
fgrid.cpp
lexer.cpp
nodes.cpp
operators.cpp
optimizer.cpp
parser.cpp
token.cpp
userfunction.cpp
values.cpp
viewer.cpp
'
SYSSRCS='
console.cpp
console_amiga.cpp
console_stdc.cpp
console_termios.cpp
console_windows.cpp
filesystem_amiga.cpp
filesystem_stdc.cpp
language.cpp
language_amiga.cpp
language_stdc.cpp
preferences.cpp
preferences_amiga.cpp
preferences_stdc.cpp
program.cpp
program_amiga.cpp
program_haiku.cpp
program_stdc.cpp
program_test.cpp
window_amiga.cpp
window_haiku.cpp
'
FUNCTIONSRC='
absolute.cpp
aexcosecant.cpp
aexsecant.cpp
arcchord.cpp
arccos.cpp
arcsin.cpp
arctan.cpp
arccosecant.cpp
arccotangent.cpp
arcsecant.cpp
arccovercosine.cpp
arccoversine.cpp
archacovercosine.cpp
archacoversine.cpp
archavercosine.cpp
archaversine.cpp
arcvercosine.cpp
arcversine.cpp
ceil.cpp
chord.cpp
cosecant.cpp
cosine.cpp
cotangent.cpp
covercos.cpp
coversin.cpp
cube.cpp
excosecant.cpp
exsecant.cpp
floor.cpp
hacovercos.cpp
hacoversin.cpp
havercos.cpp
haversin.cpp
hyparccosecant.cpp
hyparccosine.cpp
hyparccotangent.cpp
hyparcsecant.cpp
hyparcsine.cpp
hyparctangent.cpp
hypcosecant.cpp
hypcosine.cpp
hypcotangent.cpp
hypsecant.cpp
hypsine.cpp
hyptangent.cpp
ln.cpp
log10.cpp
log2.cpp
node.cpp
round.cpp
secant.cpp
signum.cpp
sine.cpp
square.cpp
tangent.cpp
trunc.cpp
user.cpp
vercos.cpp
versin.cpp
'
STATEMENTSRCS='
about.cpp
clear.cpp
delete.cpp
digits.cpp
draw.cpp
empty.cpp
eval.cpp
execute.cpp
exit.cpp
funcdef.cpp
funclist.cpp
help.cpp
input.cpp
license.cpp
list.cpp
load.cpp
memory.cpp
node.cpp
output.cpp
plot.cpp
prefs.cpp
prompt.cpp
save.cpp
show.cpp
silent.cpp
version.cpp
'
LIBAPPSRCS='
aengine.cpp
bigint.cpp
charbuf.cpp
cplex.cpp
nnumb.cpp
ntext.cpp
ntextd.cpp
ntextp.cpp
real.cpp
'
LIBREALSRCS='
acos.c
acosh.c
asin.c
asinh.c
atan.c
atan2.c
atanh.c
cbrt.c
ceil.c
csign.c
cos.c
cosh.c
exp.c
expm1.c
fabs.c
floor.c
fmod.c
hypot.c
kcos.c
kremp2.c
ksin.c
ktan.c
log.c
log10.c
log1p.c
pow.c
remp2.c
round.c
scalbn.c
sin.c
sinh.c
sqrt.c
tan.c
tanh.c
trunc.c
'
LIBREAL2SRCS='
acot.c
acoth.c
acrd.c
acsc.c
acsch.c
acvc.c
acvs.c
aexc.c
aexs.c
ahcc.c
ahcv.c
ahv.c
ahvc.c
asec.c
asech.c
avcs.c
aver.c
cot.c
coth.c
crd.c
csc.c
csch.c
cvc.c
cvs.c
exc.c
exs.c
hcc.c
hcv.c
hv.c
hvc.c
log2i.c
log2p.c
sec.c
sech.c
vcs.c
ver.c
'
LIBCPLEXSRCS='
cacos.c
cacosh.c
casin.c
casinh.c
catan.c
catanh.c
ccos.c
ccosh.c
cexp.c
clog.c
cpow.c
csin.c
csinh.c
csqrt.c
ctan.c
ctanh.c
'
LIBCPLEX2SRCS='
cacot.c
cacoth.c
cacsc.c
cacsch.c
casec.c
casech.c
ccbrt.c
ccot.c
ccoth.c
ccsc.c
ccsch.c
clogb.c
clog10.c
csec.c
csech.c
csgn.c
prim.c
'
LIBC1SRCS='
alloccpy.c
mem.c
memcpy.c
memset.c
strcmp.c
strlen.c
untag.c
'
FLXSRCS='
asprintf.c
createcat.c
createcatsrc.c
createct.c
globals.c
locale_other.c
main.c
openlibs.c
readprefs.c
scancd.c
scanct.c
scanpo.c
showfuncs.c
strptime.c
swapfuncs.c
utils.c
vastubs.c
'
if $dlibm; then
LIBREALSRCS="${LIBREAL2SRCS}"
else
LIBREALSRCS="${LIBREALSRCS}${LIBREAL2SRCS}"
fi
if $dlibm; then
LIBCPLEXSRCS="${LIBCPLEX2SRCS}"
else
LIBCPLEXSRCS="${LIBCPLEXSRCS}${LIBCPLEX2SRCS}"
fi
amathc="amathc"
amath="amath"
amathcplex="amathcplex"
amathapp="amathapp"
appmain="appmain"
appfunction="functions"
appstatement="statement"
appsystem="appsystem"
program="src/main"
ldsysflags="-l${appsystem} -l${appfunction} -l${appstatement} -l${appmain} -l${appfunction} -l${appstatement} -l${appmain} "
ldlibflags="-l${amathapp} ${libm}-l${amathcplex} ${libm}-l${amath} -l${amathc} ${gcclib}"
############################ Main Application ###########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
echo
echo "all: lib"
echo "static: lib"
echo
files=""
for f in ${APPSRCS}
do
b=`basename $f .cpp`
echo "${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -c ${f}"
echo
files="${files} ${b}.o"
done
echo "lib: ${files}"
echo " \${AR} rcs lib${appmain}.a ${files}"
echo " \${RANLIB} lib${appmain}.a"
echo
echo "clean:"
echo " \${DEL} lib${appmain}.a ${files}"
echo
} > src/main/Makefile
#########################################################################
########################### Functions Library ###########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I../.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
echo
echo "all: lib"
echo "static: lib"
echo
files=""
for f in ${FUNCTIONSRC}
do
b=`basename $f .cpp`
echo "${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -c ${f}"
echo
files="${files} ${b}.o"
done
echo "lib: ${files}"
echo " \${AR} rcs lib${appfunction}.a ${files}"
echo " \${RANLIB} lib${appfunction}.a"
echo
echo "clean:"
echo " \${DEL} lib${appfunction}.a ${files}"
echo
} > src/main/function/Makefile
#########################################################################
########################### Statement Library ###########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I../.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
echo
echo "all: lib"
echo "static: lib"
echo
files=""
for f in ${STATEMENTSRCS}
do
b=`basename $f .cpp`
echo "${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -c ${f}"
echo
files="${files} ${b}.o"
done
echo "lib: ${files}"
echo " \${AR} rcs lib${appstatement}.a ${files}"
echo " \${RANLIB} lib${appstatement}.a"
echo
echo "clean:"
echo " \${DEL} lib${appstatement}.a ${files}"
echo
} > src/main/statement/Makefile
#########################################################################
############################ System Library #############################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
echo
echo "all: lib"
echo "static: lib"
echo
files=""
for f in ${SYSSRCS}
do
b=`basename $f .cpp`
echo "${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -c ${f}"
echo
files="${files} ${b}.o"
done
echo "lib: ${files}"
echo " \${AR} rcs lib${appsystem}.a ${files}"
echo " \${RANLIB} lib${appsystem}.a"
echo
echo "clean:"
echo " \${DEL} lib${appsystem}.a ${files}"
echo
} > src/system/Makefile
#########################################################################
########################## Application Library ##########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${libop}${options} ${cxxflags}-I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "MKDIR = mkdir -p"
echo "RMDIR = rm -Rf"
echo "DEL = rm -f"
echo "INSTALL = install -m 0644"
echo "LDCONFIG = ldconfig"
echo "DOXYGEN = doxygen"
echo "PREFIX = ${prefix}"
echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath"
echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath"
echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}"
echo "alib = lib${amathapp}.a"
echo "solib = lib${amathapp}.so"
echo "pkgconfig = amatha.pc"
echo
echo "all: static shared"
echo
echo "static: \${alib}"
echo
echo "shared: \${solib}"
echo
files=""
files2=""
for f in ${LIBAPPSRCS}
do
b=`basename $f .cpp`
echo "static/${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS}${fPIC} -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -fPIC -c ${f} -o shared/${b}.o"
echo
files="${files} static/${b}.o"
files2="${files2} shared/${b}.o"
done
echo ".PHONY: build"
echo "build:"
echo " \${MKDIR} static"
echo " \${MKDIR} shared"
echo
echo "\${solib}: build ${files2}"
echo " \${CXX} \${CXXFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}${soverion} -o \${solib} ${files2}"
echo
echo "\${alib}: build ${files}"
echo " \${AR} rcs static/\${alib} ${files}"
echo " \${RANLIB} static/\${alib}"
echo
echo ".PHONY: doc"
echo "doc:"
echo " \${DOXYGEN} amatha.dox"
echo
echo ".PHONY: install"
echo "install: \${alib} \${solib}"
echo " \${MKDIR} \${INSTDIR}"
echo " \${MKDIR} \${INSTDIRPC}"
echo " \${MKDIR} \${INSTDIRI}"
echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}"
echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}"
echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}"
echo " \${INSTALL} aengine.h \${INSTDIRI}/aengine.h"
echo " \${INSTALL} bigint.h \${INSTDIRI}/bigint.h"
echo " \${INSTALL} charbuf.h \${INSTDIRI}/charbuf.h"
echo " \${INSTALL} cplex.h \${INSTDIRI}/cplex.h"
echo " \${INSTALL} nnumb.h \${INSTDIRI}/nnumb.h"
echo " \${INSTALL} ntext.h \${INSTDIRI}/ntext.h"
echo " \${INSTALL} ntext.h \${INSTDIRI}/ntextd.h"
echo " \${INSTALL} ntext.h \${INSTDIRI}/ntextp.h"
echo " \${INSTALL} numb.h \${INSTDIRI}/numb.h"
echo " \${INSTALL} real.h \${INSTDIRI}/real.h"
if ${useldconfig}; then
echo " \${LDCONFIG} \${INSTDIR}"
fi
echo
echo ".PHONY: uninstall"
echo "uninstall:"
echo " \${DEL} \${INSTDIR}/\${alib}"
echo " \${DEL} \${INSTDIR}/\${solib}"
echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}"
echo " \${DEL} \${INSTDIRI}/aengine.h"
echo " \${DEL} \${INSTDIRI}/charbuf.h"
echo " \${DEL} \${INSTDIRI}/cplex.h"
echo " \${DEL} \${INSTDIRI}/integer.h"
echo " \${DEL} \${INSTDIRI}/nnumb.h"
echo " \${DEL} \${INSTDIRI}/ntext.h"
echo " \${DEL} \${INSTDIRI}/numb.h"
echo " \${DEL} \${INSTDIRI}/real.h"
if ${useldconfig}; then
echo " \${LDCONFIG}"
fi
echo
echo "clean:"
echo " \${DEL} static/\${alib} \${solib} ${files} ${files2}"
echo
echo "very-clean: clean"
echo " \${DEL} doxygen.warn"
echo " \${RMDIR} man"
echo " \${RMDIR} static"
echo " \${RMDIR} shared"
echo
} > src/lib/Makefile
#########################################################################
############################### C Library ###############################
{
echo "CC = ${crosscompile}${ccompiler}"
echo "CFLAGS = -std=c9x ${libop}${options} ${cflags}-I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "MKDIR = mkdir -p"
echo "RMDIR = rm -Rf"
echo "DEL = rm -f"
echo "INSTALL = install -m 0644"
echo "LDCONFIG = ldconfig"
echo "DOXYGEN = doxygen"
echo "PREFIX = ${prefix}"
echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath"
echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath"
echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}"
echo "INSTDIRM = \${DESTDIR}\${PREFIX}/${mandir}/man3"
echo "alib = lib${amathc}.a"
echo "solib = lib${amathc}.so"
echo "pkgconfig = amathc.pc"
echo "manpage = amathc.3"
echo
echo "all: static shared"
echo
echo "static: \${alib}"
echo
echo "shared: \${solib}"
echo
libc=""
libcs=""
for f in ${LIBC1SRCS}
do
b=`basename $f .c`
echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
echo
libc="${libc} static/${b}.o"
libcs="${libcs} shared/${b}.o"
done
echo ".PHONY: build"
echo "build:"
echo " \${MKDIR} static"
echo " \${MKDIR} shared"
echo
echo "\${solib}: build ${libcs}"
echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}${soverion} -o \${solib} ${libcs}"
echo
echo "\${alib}: build ${libc}"
echo " \${AR} rcs static/\${alib} ${libc}"
echo " \${RANLIB} static/\${alib}"
echo
echo ".PHONY: doc"
echo "doc:"
echo " \${DOXYGEN} amathc.dox"
echo
echo ".PHONY: install"
echo "install: \${alib} \${solib}"
echo " \${MKDIR} \${INSTDIR}"
echo " \${MKDIR} \${INSTDIRPC}"
echo " \${MKDIR} \${INSTDIRI}"
echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}"
echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}"
echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}"
echo " \${INSTALL} \${manpage} \${INSTDIRM}/\${manpage}"
echo " \${INSTALL} ../amath.h \${INSTDIRI}"
echo " \${INSTALL} ../amathc.h \${INSTDIRI}"
if ${useldconfig}; then
echo " \${LDCONFIG} \${INSTDIR}"
fi
echo
echo ".PHONY: uninstall"
echo "uninstall:"
echo " \${DEL} \${INSTDIR}/\${alib}"
echo " \${DEL} \${INSTDIR}/\${solib}"
echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}"
echo " \${DEL} \${INSTDIRM}/\${manpage}"
echo " \${DEL} \${INSTDIRI}/amath.h"
echo " \${DEL} \${INSTDIRI}/amathc.h"
if ${useldconfig}; then
echo " \${LDCONFIG}"
fi
echo
echo "clean:"
echo " \${DEL} static/\${alib} \${solib} ${libc} ${libcs}"
echo
echo "very-clean: clean"
echo " \${DEL} doxygen.warn"
echo " \${RMDIR} man"
echo " \${RMDIR} static"
echo " \${RMDIR} shared"
echo
} > src/clib/Makefile
#########################################################################
############################# Real Numbers ##############################
{
echo "CC = ${crosscompile}${ccompiler}"
echo "CFLAGS = -std=c9x ${libop}${options} ${cflags}-I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "MKDIR = mkdir -p"
echo "RMDIR = rm -Rf"
echo "DEL = rm -f"
echo "INSTALL = install -m 0644"
echo "LDCONFIG = ldconfig"
echo "DOXYGEN = doxygen"
echo "PREFIX = ${prefix}"
echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath"
echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath"
echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}"
echo "INSTDIRM = \${DESTDIR}\${PREFIX}/${mandir}/man3"
echo "alib = lib${amath}.a"
echo "solib = lib${amath}.so"
echo "pkgconfig = amathr.pc"
echo "manpage = amathr.3"
echo
echo "all: static shared"
echo
echo "static: \${alib}"
echo
echo "shared: \${solib}"
echo
libamath=""
libamaths=""
for f in ${LIBREALSRCS}
do
b=`basename $f .c`
echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
echo
libamath="${libamath} static/${b}.o"
libamaths="${libamaths} shared/${b}.o"
done
echo ".PHONY: build"
echo "build:"
echo " \${MKDIR} static"
echo " \${MKDIR} shared"
echo
echo "\${solib}: build ${libamaths}"
echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}${soverion} -o \${solib} ${libamaths}"
echo
echo "\${alib}: build ${libamath}"
echo " \${AR} rcs static/\${alib} ${libamath}"
echo " \${RANLIB} static/\${alib}"
echo
echo ".PHONY: doc"
echo "doc:"
echo " \${DOXYGEN} amathr.dox"
echo
echo ".PHONY: install"
echo "install: \${alib} \${solib}"
echo " \${MKDIR} \${INSTDIR}"
echo " \${MKDIR} \${INSTDIRPC}"
echo " \${MKDIR} \${INSTDIRI}"
echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}"
echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}"
echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}"
echo " \${INSTALL} \${manpage} \${INSTDIRM}/\${manpage}"
echo " \${INSTALL} ../mathr.h \${INSTDIRI}/mathr.h"
if ${useldconfig}; then
echo " \${LDCONFIG} \${INSTDIR}"
fi
echo
echo ".PHONY: uninstall"
echo "uninstall:"
echo " \${DEL} \${INSTDIR}/\${alib}"
echo " \${DEL} \${INSTDIR}/\${solib}"
echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}"
echo " \${DEL} \${INSTDIRM}/\${manpage}"
echo " \${DEL} \${INSTDIRI}/mathr.h"
if ${useldconfig}; then
echo " \${LDCONFIG}"
fi
echo
echo "clean:"
echo " \${DEL} static/\${alib} \${solib} ${libamath} ${libamaths}"
echo
echo "very-clean: clean"
echo " \${DEL} doxygen.warn"
echo " \${RMDIR} man"
echo " \${RMDIR} static"
echo " \${RMDIR} shared"
echo
} > src/real/Makefile
#########################################################################
############################ Complex Numbers ############################
{
echo "CC = ${crosscompile}${ccompiler}"
echo "CFLAGS = -std=c9x ${libop}${options} ${cxxflags}-I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "MKDIR = mkdir -p"
echo "RMDIR = rm -Rf"
echo "DEL = rm -f"
echo "INSTALL = install -m 0644"
echo "LDCONFIG = ldconfig"
echo "DOXYGEN = doxygen"
echo "PREFIX = ${prefix}"
echo "INSTDIR = \${DESTDIR}\${PREFIX}/lib/amath"
echo "INSTDIRI = \${DESTDIR}\${PREFIX}/include/amath"
echo "INSTDIRPC = \${DESTDIR}\${PREFIX}/${pkgconfigdir}"
echo "INSTDIRM = \${DESTDIR}\${PREFIX}/${mandir}/man3"
echo "alib = lib${amathcplex}.a"
echo "solib = lib${amathcplex}.so"
echo "pkgconfig = amathi.pc"
echo "manpage = amathi.3"
echo
echo "all: static shared"
echo
echo "static: \${alib}"
echo
echo "shared: \${solib}"
echo
libcomplex=""
libcomplexs=""
for f in ${LIBCPLEXSRCS}
do
b=`basename $f .c`
echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
echo
libcomplex="${libcomplex} static/${b}.o"
libcomplexs="${libcomplexs} shared/${b}.o"
done
echo ".PHONY: build"
echo "build:"
echo " \${MKDIR} static"
echo " \${MKDIR} shared"
echo
echo "\${solib}: build ${libcomplexs}"
echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}${soverion} -o \${solib} ${libcomplexs}"
echo
echo "\${alib}: build ${libcomplex}"
echo " \${AR} rcs static/\${alib} ${libcomplex}"
echo " \${RANLIB} static/\${alib}"
echo
echo ".PHONY: doc"
echo "doc:"
echo " \${DOXYGEN} amathi.dox"
echo
echo ".PHONY: install"
echo "install: \${alib} \${solib}"
echo " \${MKDIR} \${INSTDIR}"
echo " \${MKDIR} \${INSTDIRPC}"
echo " \${MKDIR} \${INSTDIRI}"
echo " \${INSTALL} static/\${alib} \${INSTDIR}/\${alib}"
echo " \${INSTALL} \${solib} \${INSTDIR}/\${solib}"
echo " \${INSTALL} \${pkgconfig} \${INSTDIRPC}/\${pkgconfig}"
echo " \${INSTALL} \${manpage} \${INSTDIRM}/\${manpage}"
echo " \${INSTALL} ../mathi.h \${INSTDIRI}/mathi.h"
if ${useldconfig}; then
echo " \${LDCONFIG} \${INSTDIR}"
fi
echo
echo ".PHONY: uninstall"
echo "uninstall:"
echo " \${DEL} \${INSTDIR}/\${alib}"
echo " \${DEL} \${INSTDIR}/\${solib}"
echo " \${DEL} \${INSTDIRPC}/\${pkgconfig}"
echo " \${DEL} \${INSTDIRM}/\${manpage}"
echo " \${DEL} \${INSTDIRPC}/amathi.pc"
echo " \${DEL} \${INSTDIRI}/mathi.h"
if ${useldconfig}; then
echo " \${LDCONFIG}"
fi
echo
echo "clean:"
echo " \${DEL} static/\${alib} \${solib} ${libcomplex} ${libcomplexs}"
echo
echo "very-clean: clean"
echo " \${DEL} doxygen.warn"
echo " \${RMDIR} man"
echo " \${RMDIR} static"
echo " \${RMDIR} shared"
echo
} > src/cplex/Makefile
#########################################################################
################################# Main ##################################
{
echo
echo "CC = ${crosscompile}${ccompiler}"
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CFLAGS = ${appop}${options} ${cflags}-Wall -Isrc -Isrc/main"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-Wall -Isrc -Isrc/main"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "LFLAGS = ${ldflags}${ldsysflags}${ldlibflags}"
echo "LPATH = -Lsrc/lib -Lsrc/clib -Lsrc/real -Lsrc/cplex -Lsrc/main/function -Lsrc/main/statement -Lsrc/main -Lsrc/system"
echo "LPATHS = -Lsrc/lib/static -Lsrc/clib/static -Lsrc/real/static -Lsrc/cplex/static -Lsrc/main/function -Lsrc/main/statement -Lsrc/main -Lsrc/system"
echo "FLXCAT = build/flexcat/flexcat"
echo "MKDIR = mkdir -p"
echo "DEL = rm -f"
echo "INSTALLP = install -m 0755"
echo "INSTALLM = install -m 0644"
echo "PREFIX = ${prefix}"
echo "INSTDIRP = \${DESTDIR}\${PREFIX}/bin"
echo "INSTDIRM = \${DESTDIR}\${PREFIX}/${mandir}/man1"
echo
echo "all: shared-libs static-libs static-app"
echo "amath: shared-libs static-libs shared-app"
echo "static: static-app"
echo "app: ${appmain} ${appfunction} ${appstatement} ${appsystem}"
echo "libs: ${amathapp} ${amath} ${amathc} ${amathcplex}"
echo
echo "${program}.o: ${program}.cpp"
echo " \${CXX} \${CXXFLAGS} -c ${program}.cpp -o ${program}.o"
echo
echo "${appmain}:"
echo " cd src/main && \${MAKE}"
echo
echo "${appsystem}:"
echo " cd src/system && \${MAKE}"
echo
echo "${appfunction}:"
echo " cd src/main/function && \${MAKE}"
echo
echo "${appstatement}:"
echo " cd src/main/statement && \${MAKE}"
echo
echo "${amathapp}:"
echo " cd src/lib && \${MAKE}"
echo
echo "${amath}:"
echo " cd src/real && \${MAKE}"
echo
echo "${amathc}:"
echo " cd src/clib && \${MAKE}"
echo
echo "${amathcplex}:"
echo " cd src/cplex && \${MAKE}"
echo
echo "locale:"
echo " cd build/flexcat && \${MAKE}"
echo " \${FLXCAT} text/keyword.cd src/loc/kword.h=text/keyword.sd"
echo " \${FLXCAT} text/help.cd src/loc/help.h=text/help.sd"
echo " \${FLXCAT} text/ident.cd src/loc/ident.h=text/ident.sd"
echo " \${FLXCAT} text/text.cd src/loc/text.h=text/text.sd"
echo
echo "doc:"
echo " cd src/clib && \${MAKE} doc"
echo " cd src/real && \${MAKE} doc"
echo " cd src/cplex && \${MAKE} doc"
echo
echo "catalogs:"
echo " cd build/flexcat && \${MAKE}"
echo " \${MKDIR} dist/catalog/english"
echo " \${FLXCAT} text/help.cd catalog/english/amath-help.ct CATALOG dist/catalog/english/amath-help.catalog"
echo " \${FLXCAT} text/ident.cd catalog/english/amath-ident.ct CATALOG dist/catalog/english/amath-ident.catalog"
echo " \${FLXCAT} text/text.cd catalog/english/amath-text.ct CATALOG dist/catalog/english/amath-text.catalog"
echo
echo "shared-libs:"
echo " cd src/lib && \${MAKE} shared"
echo " cd src/clib && \${MAKE} shared"
echo " cd src/real && \${MAKE} shared"
echo " cd src/cplex && \${MAKE} shared"
echo
echo "static-libs:"
echo " cd src/lib && \${MAKE} static"
echo " cd src/clib && \${MAKE} static"
echo " cd src/real && \${MAKE} static"
echo " cd src/cplex && \${MAKE} static"
echo
echo "shared-app: app shared-libs ${program}.o"
echo " \${CC} \${CFLAGS} ${exestrip} ${program}.o -o amath \${LPATH} \${LFLAGS}"
echo
echo "static-app: app static-libs ${program}.o"
echo " \${CC} \${CFLAGS} ${exestrip} ${program}.o -o amath \${LPATHS} \${LFLAGS}"
echo
echo ".PHONY: test"
echo "test: amath"
echo " LD_LIBRARY_PATH=src/clib/:src/lib:src/cplex:scr/real"
echo " ./amath test"
echo
echo ".PHONY: install"
echo "install:"
echo " cd src/lib && \${MAKE} install"
echo " cd src/clib && \${MAKE} install"
echo " cd src/real && \${MAKE} install"
echo " cd src/cplex && \${MAKE} install"
echo " \${INSTALLP} amath \${INSTDIRP}/amath"
echo " \${INSTALLM} amath.1 \${INSTDIRM}/amath.1"
echo
echo ".PHONY: uninstall"
echo "uninstall:"
echo " cd src/lib && \${MAKE} uninstall"
echo " cd src/clib && \${MAKE} uninstall"
echo " cd src/real && \${MAKE} uninstall"
echo " cd src/cplex && \${MAKE} uninstall"
echo " \${DEL} \${INSTDIRP}/amath"
echo " \${DEL} \${INSTDIRM}/amath.1"
echo
echo ".PHONY: clean"
echo "clean:"
echo " cd src/lib && \${MAKE} clean"
echo " cd src/clib && \${MAKE} clean"
echo " cd src/real && \${MAKE} clean"
echo " cd src/cplex && \${MAKE} clean"
echo " cd src/main && \${MAKE} clean"
echo " cd src/system && \${MAKE} clean"
echo " cd src/main/function && \${MAKE} clean"
echo " cd src/main/statement && \${MAKE} clean"
echo " cd build/flexcat && \${MAKE} clean"
echo " \${DEL} ${program}.o amath"
echo
echo ".PHONY: very-clean"
echo "very-clean: clean"
echo " cd src/lib && \${MAKE} very-clean"
echo " cd src/clib && \${MAKE} very-clean"
echo " cd src/real && \${MAKE} very-clean"
echo " cd src/cplex && \${MAKE} very-clean"
echo
} > Makefile
#########################################################################
################################ Flexcat ################################
{
echo 'all: flexcat'
echo ''
echo "CFLAGS += -I. -Wall"
echo ''
l=""
for f in ${FLXSRCS}
do
b=`basename $f .c`
echo "${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -c ${f}"
echo
l="${l} ${b}.o"
done
echo
echo "flexcat: ${l}"
echo " \${CC} \${CFLAGS} -o flexcat ${l} -lm"
echo
echo "clean:"
echo " rm -f ${l} flexcat"
echo
} > build/flexcat/Makefile
#########################################################################
echo "Makefile generated"