Ian Jauslin
3f0510629e
The update to version 1.5 is rather substantial, and introduces some minor backward-incompatibilities: * The header "#!symbols" has been replaced by "#!virtual_fields" * Multiplying polynomials using the '*' symbol is no longer supported (or, rather, the symbolic capabilities of meankondo were enhanced, and the syntax has been changed). * 'meantools exp' has been removed (its functionality is now handled by other means) * 'meantoolds derive' has been replaced by 'meantools differentiate' * The symbolic capabilities were enhanced: polynomials can now be multiplied, added, exponentiated, and their logarithms can be taken directly in the configuration file. * The flow equation can now be processed after being computed using the various "#!postprocess_*" entries. * Deprecated kondo_preprocess. * Compute the mean using an LU decomposition if possible. * More detailed checks for syntax errors in configuration file. * Check that different '#!group' entries are indeed uncorrelated. * New flags in meankondo: '-p' and '-A'. * New tool: meantools expand. * Improve conversion to LaTeX using meantools-convert * Assign terms randomly to different threads. * Created vim files to implement syntax highlighting for configuration files. * Multiple bug fixes
162 lines
5.0 KiB
Makefile
162 lines
5.0 KiB
Makefile
## Copyright 2015-2022 Ian Jauslin
|
|
##
|
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
|
## you may not use this file except in compliance with the License.
|
|
## You may obtain a copy of the License at
|
|
##
|
|
## http://www.apache.org/licenses/LICENSE-2.0
|
|
##
|
|
## Unless required by applicable law or agreed to in writing, software
|
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
## See the License for the specific language governing permissions and
|
|
## limitations under the License.
|
|
|
|
# whether to link dynamically
|
|
# if static=0 then link dynamically
|
|
# if static=2 then link statically
|
|
# if static=1 then link libkondo statically but other libraries dynamically
|
|
STATIC=1
|
|
|
|
VERSION=1.4
|
|
|
|
# products of the compilation
|
|
PROJECT_BINS= meankondo numkondo meantools kondo_preprocess meantools-convert
|
|
PROJECT_SO=libkondo.so.$(VERSION)
|
|
PROJECT_LIBS=libkondo.a
|
|
PROJECT_MANS=meankondo.1 numkondo.1 meantools.1 meantools-convert.1 kondo_preprocess.1
|
|
PROJECT_SCRIPTS=config_functions.sh
|
|
PROJECT_DOCS=meankondo-doc.html
|
|
|
|
# debug and optimization flags
|
|
#DB= -ggdb
|
|
OPT= -O3
|
|
|
|
# warning flags
|
|
WARNINGS= -Wall -Wextra -Wno-strict-overflow -std=c99 -pedantic
|
|
|
|
# installation dirs
|
|
PREFIX=/usr
|
|
BINDIR=$(PREFIX)/bin
|
|
LIBDIR=$(PREFIX)/lib
|
|
MANDIR=$(PREFIX)/share/man/man1
|
|
SCRIPTDIR=$(PREFIX)/share/meankondo/scripts
|
|
DOCDIR=$(PREFIX)/share/doc/meankondo-doc
|
|
|
|
# compiler
|
|
CC=/usr/bin/gcc
|
|
LD=$(CC)
|
|
AR=/usr/bin/ar
|
|
|
|
# directories
|
|
INCLUDE =
|
|
LIB =
|
|
|
|
# flags
|
|
override LDFLAGS +=$(LIB)
|
|
override CFLAGS +=$(INCLUDE)$(DB) $(OPT) $(WARNINGS)
|
|
|
|
# build directories
|
|
BUILDDIR=./build
|
|
SRCDIR=./src
|
|
OBJDIR=./objs
|
|
|
|
# objects
|
|
LIBKONDO_OBJS = $(addprefix $(OBJDIR)/,array.o cli_parser.o coefficient.o fields.o grouped_polynomial.o idtable.o istring.o number.o parse_file.o polynomial.o rational_float.o rational_int.o rcc.o rcc_mpfr.o symbolic_parser.o tree.o tools.o)
|
|
MEANKONDO_OBJS = $(addprefix $(OBJDIR)/,meankondo.o determinant.o mean.o)
|
|
NUMKONDO_OBJS = $(addprefix $(OBJDIR)/,numkondo.o flow.o flow_mpfr.o)
|
|
MEANTOOLS_OBJS = $(addprefix $(OBJDIR)/,meantools.o meantools_deriv.o meantools_eval.o meantools_expand.o)
|
|
KONDO_PP_OBJS = $(addprefix $(OBJDIR)/,kondo_preprocess.o kondo.o)
|
|
|
|
|
|
# flags which depend on whether to link statically or dynamically
|
|
# lib flag for libkondo
|
|
LIBKONDO_FLAG=-lkondo
|
|
# additional library required for static linking
|
|
XTRA_LIBS=
|
|
|
|
ifeq ($(STATIC),1)
|
|
# compile libkondo.a
|
|
PREREQ=static
|
|
# libkondo is linked against libm, libmpfr and libgmp
|
|
XTRA_LIBS=-lm -lmpfr -lgmp
|
|
# link binaries using the static library
|
|
LIBKONDO_FLAG=-l:libkondo.a
|
|
# install static lib
|
|
INSTALLLIB=install-static
|
|
else ifeq ($(STATIC),2)
|
|
# compile libkondo.a
|
|
PREREQ=static
|
|
# libkondo is linked against libm, libmpfr and libgmp
|
|
XTRA_LIBS=-lm -lmpfr -lgmp
|
|
# link binaries statically
|
|
override LDFLAGS += -static
|
|
INSTALLLIB=install-static
|
|
else
|
|
# compile libkondo.so.$(VERSION)
|
|
PREREQ=shared
|
|
# required flag for subsequent dynamic linking
|
|
override CFLAGS += -fPIC
|
|
INSTALLLIB=install-shared
|
|
endif
|
|
|
|
|
|
all: init $(PREREQ)
|
|
|
|
# create dirs
|
|
init:
|
|
@[ -d $(OBJDIR) ] || /bin/mkdir $(OBJDIR)
|
|
@[ -d $(BUILDDIR) ] || /bin/mkdir $(BUILDDIR)
|
|
@[ -d $(BUILDDIR)/bin ] || /bin/mkdir $(BUILDDIR)/bin
|
|
@[ -d $(BUILDDIR)/lib ] || /bin/mkdir $(BUILDDIR)/lib
|
|
|
|
# static library
|
|
static: $(PROJECT_LIBS) $(PROJECT_BINS)
|
|
# shared library
|
|
shared: $(PROJECT_SO) $(PROJECT_BINS)
|
|
|
|
libkondo.a: $(LIBKONDO_OBJS)
|
|
$(AR) -rc $(BUILDDIR)/lib/$@ $^
|
|
|
|
libkondo.so.$(VERSION): $(LIBKONDO_OBJS)
|
|
$(LD) -shared -lm -lmpfr -lgmp $(LDFLAGS) -o $(BUILDDIR)/lib/$@ $^
|
|
ln -fs ./libkondo.so.$(VERSION) $(BUILDDIR)/lib/libkondo.so
|
|
|
|
meankondo: $(MEANKONDO_OBJS)
|
|
$(LD) -L$(BUILDDIR)/lib $(LDFLAGS) -o $(BUILDDIR)/bin/$@ $^ $(LIBKONDO_FLAG) -lpthread $(XTRA_LIBS)
|
|
|
|
numkondo: $(NUMKONDO_OBJS)
|
|
$(LD) -L$(BUILDDIR)/lib $(LDFLAGS) -o $(BUILDDIR)/bin/$@ $^ $(LIBKONDO_FLAG) -lm -lmpfr -lgmp $(XTRA_LIBS)
|
|
|
|
meantools: $(MEANTOOLS_OBJS)
|
|
$(LD) -L$(BUILDDIR)/lib $(LDFLAGS) -o $(BUILDDIR)/bin/$@ $^ $(LIBKONDO_FLAG) -lmpfr -lgmp $(XTRA_LIBS)
|
|
|
|
meantools-convert:
|
|
cp scripts/meantools-convert $(BUILDDIR)/bin/
|
|
|
|
kondo_preprocess: $(KONDO_PP_OBJS)
|
|
$(LD) -L$(BUILDDIR)/lib $(LDFLAGS) -o $(BUILDDIR)/bin/$@ $^ $(LIBKONDO_FLAG) $(XTRA_LIBS)
|
|
|
|
%.o : ../$(SRCDIR)/%.c
|
|
$(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
install: $(INSTALLLIB) all
|
|
mkdir -p $(BINDIR) $(MANDIR) $(SCRIPTDIR) $(DOCDIR)
|
|
install -Dm755 $(addprefix $(BUILDDIR)/bin/,$(PROJECT_BINS)) $(BINDIR)/
|
|
install -Dm644 $(addprefix man/,$(PROJECT_MANS)) $(MANDIR)/
|
|
gzip $(addprefix $(MANDIR)/,$(PROJECT_MANS))
|
|
install -Dm644 $(addprefix scripts/,$(PROJECT_SCRIPTS)) $(SCRIPTDIR)/
|
|
install -Dm644 $(addprefix doc/,$(PROJECT_DOCS)) $(DOCDIR)/
|
|
|
|
install-static: all
|
|
mkdir -p $(LIBDIR)
|
|
install -Dm755 $(addprefix $(BUILDDIR)/lib/,$(PROJECT_LIBS)) $(LIBDIR)/
|
|
install-shared: all
|
|
mkdir -p $(LIBDIR)
|
|
install -Dm755 $(addprefix $(BUILDDIR)/lib/,$(PROJECT_SO)) $(LIBDIR)/
|
|
for lib in $(PROJECT_SO); do ln -fs ./$$lib $(LIBDIR)/$${lib%.so.*}.so; done
|
|
|
|
clean:
|
|
@rm -rf $(OBJDIR)
|
|
@rm -rf $(BUILDDIR)
|