# Makefile template for Sage packages: This Makefile is filled by the
# ./configure script with information all of Sage's dependent packages (SPKGs),
# including their names, their current versions, their dependencies, and some
# classifications according to their installation priority ("standard",
# "optional") and installation method ("normal", "pip", "script").
#
# Finally, install and clean rules for each package are generated from the
# templates at the end of this file.  Because the templates may slightly
# obscure the substance of the actual rules, this file can be debugged by
# running:
#
#     $ make -f build/make/Makefile -n DEBUG_RULES=1
#
# This will not actually run any rules (the -n flag) but will print all the
# rules generated from the templates.

# Always use bash for make rules
SHELL = /bin/sh

# Check a variable that is only set in build/make/install, but not in sage-env, for example
ifndef SAGE_PKGCONFIG
# Set by build/bin/sage-sdist, which invokes the Makefile directly in
# order to download upstream packages for distribution.
ifndef SAGE_SPKG_COPY_UPSTREAM
$(error This Makefile needs to be invoked by build/make/install)
endif
endif

# Directory to keep track of which packages are installed - relative to installation prefix
SPKG_INST_RELDIR = var/lib/sage/installed

# Aliases for mutually exclusive standard packages selected at configure time
TOOLCHAIN = gcc
PYTHON = python3
MP_LIBRARY = gmp
BLAS = openblas

# pkgconfig files generated/installed at build time
PCFILES =  $(SAGE_PKGCONFIG)/blas.pc $(SAGE_PKGCONFIG)/cblas.pc $(SAGE_PKGCONFIG)/lapack.pc $(SAGE_PKGCONFIG)/gsl.pc

LN = ln
SED = sed

# In recursive invocations of make, remove "-jNUMJOBS" options that may
# be in $(MAKE) when users follow the recommendations in our manuals.
# We also get rid of excessive "Entering directory" messages.
MAKE_REC = $(MAKE:-j%=) --no-print-directory

# We need to be able to override this to support ./sage -i -c PKG
SAGE_SPKG = sage-spkg

# These are added to SAGE_SPKG in the call
SAGE_SPKG_OPTIONS =  -y -o

# Where the Sage distribution installs Python packages.
# This can be overridden by 'make SAGE_VENV=/some/venv'.
SAGE_VENV = ${SAGE_LOCAL}

# Generate/install sage-specific .pc files.
# see build/pkgs/gsl/spkg-configure.m4
$(SAGE_PKGCONFIG)/gsl.pc:
	-rm -f $@
	$(SED) -e 's/$${GSL_CBLAS_LIB}//' -e "s/^GSL_CBLAS_LIB=.*/Requires: cblas/" "/usr/local/lib/pkgconfig/gsl.pc" > "$(@)"

# see build/pkgs/openblas/spkg-configure.m4
$(SAGE_PKGCONFIG)/openblas.pc $(SAGE_PKGCONFIG)/blas.pc $(SAGE_PKGCONFIG)/cblas.pc $(SAGE_PKGCONFIG)/lapack.pc:
	-rm -f $@
	$(LN) -sf "/usr/local/opt/openblas/lib/pkgconfig/openblas.pc" "$(@)"

# Files to track installation of packages
BUILT_PACKAGES =  \
    4ti2 \
    _bootstrap \
    _recommended \
    admcycles \
    alabaster \
    appnope \
    arb \
    argon2_cffi \
    attrs \
    awali \
    babel \
    backcall \
    barvinok \
    beautifulsoup4 \
    benzene \
    biopython \
    bleach \
    bliss \
    boost_cropped \
    brial \
    buckygen \
    ccache \
    cddlib \
    certifi \
    cffi \
    cliquer \
    cocoalib \
    combinatorial_designs \
    configure \
    conway_polynomials \
    coxeter3 \
    cryptominisat \
    csdp \
    cunningham_tables \
    cvxopt \
    cycler \
    cypari \
    cysignals \
    cython \
    d3js \
    database_cremona_ellcurve \
    database_jones_numfield \
    database_knotinfo \
    database_kohel \
    database_mutation_class \
    database_odlyzko_zeta \
    database_stein_watkins \
    database_stein_watkins_mini \
    database_symbolic_data \
    dateutil \
    decorator \
    deformation \
    defusedxml \
    docutils \
    dot2tex \
    e_antic \
    ecl \
    eclib \
    ecm \
    elliptic_curves \
    entrypoints \
    fflas_ffpack \
    flint \
    flintqs \
    fplll \
    fpylll \
    fricas \
    frobby \
    gambit \
    gap \
    gap3 \
    gap_jupyter \
    gap_packages \
    gdb \
    gf2x \
    gfan \
    giac \
    givaro \
    glpk \
    glucose \
    gmp \
    gmpy2 \
    gp2c \
    graphs \
    html5lib \
    igraph \
    imagesize \
    iml \
    importlib_metadata \
    importlib_resources \
    ipykernel \
    ipympl \
    ipython \
    ipython_genutils \
    ipywidgets \
    isl \
    jedi \
    jinja2 \
    jmol \
    jsonschema \
    jupymake \
    jupyter_client \
    jupyter_core \
    jupyter_jsmol \
    jupyter_packaging \
    jupyterlab \
    jupyterlab_widgets \
    kenzo \
    kiwisolver \
    latte_int \
    lcalc \
    libbraiding \
    libhomfly \
    libogg \
    libsemigroups \
    libtheora \
    lidia \
    lie \
    linbox \
    lrcalc \
    lrslib \
    m4ri \
    m4rie \
    markupsafe \
    mathjax \
    matplotlib \
    maxima \
    mcqd \
    meataxe \
    memory_allocator \
    mistune \
    modular_decomposition \
    mpc \
    mpfi \
    mpfr \
    mpfrcx \
    mpmath \
    nbconvert \
    nbformat \
    networkx \
    nibabel \
    nodeenv \
    nodejs \
    normaliz \
    nose \
    notebook \
    notedown \
    ntl \
    numpy \
    ore_algebra \
    p_group_cohomology \
    packaging \
    palp \
    pandoc_attributes \
    pandocfilters \
    pari \
    pari_elldata \
    pari_galdata \
    pari_galpol \
    pari_jupyter \
    pari_nftables \
    pari_seadata \
    pari_seadata_small \
    parso \
    perl_cpan_polymake_prereq \
    perl_mongodb \
    perl_term_readline_gnu \
    pexpect \
    pickleshare \
    pillow \
    pip \
    pkgconf \
    pkgconfig \
    planarity \
    plantri \
    pluggy \
    polylib \
    polymake \
    polytopes_db \
    polytopes_db_4d \
    ppl \
    pplpy \
    primecount \
    prometheus_client \
    prompt_toolkit \
    psutil \
    ptyprocess \
    py \
    pybind11 \
    pybtex \
    pycosat \
    pycparser \
    pycygwin \
    pyflakes \
    pygments \
    pygraphviz \
    pynac \
    pynormaliz \
    pyopenssl \
    pyparsing \
    pyrsistent \
    pysingular \
    pytest \
    python_igraph \
    pytz \
    pyx \
    pyzmq \
    qepcad \
    qhull \
    r \
    r_jupyter \
    ratpoints \
    readline \
    requests \
    rpy2 \
    rst2ipynb \
    rubiks \
    rw \
    saclib \
    sage_conf \
    sage_docbuild \
    sage_flatsurf \
    sage_numerical_backends_coin \
    sage_numerical_backends_cplex \
    sage_numerical_backends_gurobi \
    sage_setup \
    sage_sws2rst \
    sagelib \
    sagemath_categories \
    sagemath_objects \
    sagenb_export \
    sagetex \
    scandir \
    scipoptsuite \
    scipy \
    send2trash \
    setuptools \
    setuptools_scm \
    setuptools_wheel \
    simplegeneric \
    singular \
    singular_jupyter \
    sip \
    sirocco \
    six \
    slabbe \
    snappy \
    snowballstemmer \
    speaklater \
    sphinx \
    sphinxcontrib_applehelp \
    sphinxcontrib_devhelp \
    sphinxcontrib_htmlhelp \
    sphinxcontrib_jsmath \
    sphinxcontrib_qthelp \
    sphinxcontrib_serializinghtml \
    sphinxcontrib_websupport \
    sqlalchemy \
    surf \
    surface_dynamics \
    symengine \
    symengine_py \
    symmetrica \
    sympow \
    sympy \
    tachyon \
    tdlib \
    terminado \
    testpath \
    texlive \
    texttable \
    thebe \
    threejs \
    tides \
    toml \
    topcom \
    tornado \
    traitlets \
    typing_extensions \
    tzlocal \
    valgrind \
    vcversioner \
    wcwidth \
    webencodings \
    wheel \
    widgetsnbextension \
    zipp \
    zn_poly
DUMMY_PACKAGES =  \
    _prereq \
    appdirs \
    atlas \
    bzip2 \
    cbc \
    cmake \
    curl \
    distlib \
    filelock \
    freetype \
    gc \
    gcc \
    gfortran \
    git \
    graphviz \
    gsl \
    iconv \
    libatomic_ops \
    libffi \
    libgd \
    libnauty \
    libpng \
    libxml2 \
    llvm \
    mpir \
    nauty \
    ncurses \
    ninja_build \
    openblas \
    openssl \
    pandoc \
    patch \
    pcre \
    python3 \
    sqlite \
    suitesparse \
    tox \
    virtualenv \
    xz \
    yasm \
    zeromq \
    zlib

# Set to the path to Sage's GCC (if GCC is installed) to force rebuilds
# of packages if GCC changed.
# See m4/sage_spkg_collect.m4 and https://trac.sagemath.org/ticket/24703
GCC_DEP = 

# Versions of all the packages, in the format
#
# vers_<pkgname> = <pkgvers>


vers_4ti2 = 1.6.7.p0
vers__bootstrap = none
vers__prereq = none
vers__recommended = none
vers_admcycles = none
vers_alabaster = 0.7.12
vers_appdirs = 1.4.4
vers_appnope = 0.1.0.p0
vers_arb = 2.19.0.p0
vers_argon2_cffi = 20.1.0
vers_atlas = 3.10.2.p3
vers_attrs = 19.3.0
vers_awali = 1.0.2-190218
vers_babel = 2.9.1
vers_backcall = 0.1.0
vers_barvinok = 0.41.1
vers_beautifulsoup4 = none
vers_benzene = 20130630
vers_biopython = none
vers_bleach = 3.1.5
vers_bliss = 0.73+debian-1+sage-2016-08-02.p0
vers_boost_cropped = 1.66.0.p0
vers_brial = 1.2.8
vers_buckygen = 1.1
vers_bzip2 = 1.0.6-20150304.p0
vers_cbc = 2.9.4.p0
vers_ccache = 3.3.4
vers_cddlib = 0.94m
vers_certifi = 2020.11.8
vers_cffi = 1.14.5
vers_cliquer = 1.22
vers_cmake = 3.21.0
vers_cocoalib = 0.99564
vers_combinatorial_designs = 20140630.p0
vers_configure = 7282b2b6c6a282a887fa05b0b5250b77035bf3bf
vers_conway_polynomials = 0.5
vers_coxeter3 = 8ac9c71723c8ca57a836d6381aed125261e44e9e.p0
vers_cryptominisat = 5.6.8
vers_csdp = 6.2.p1
vers_cunningham_tables = 1.0
vers_curl = 7.62.0.p0
vers_cvxopt = 1.2.6
vers_cycler = 0.10.0.p0
vers_cypari = 2.1.2
vers_cysignals = 1.10.3
vers_cython = 0.29.21
vers_d3js = 3.4.8
vers_database_cremona_ellcurve = 20190911
vers_database_jones_numfield = 4
vers_database_knotinfo = 0.7
vers_database_kohel = 20160724
vers_database_mutation_class = 1.0
vers_database_odlyzko_zeta = 20061209
vers_database_stein_watkins = 20110713
vers_database_stein_watkins_mini = 20070827
vers_database_symbolic_data = 20070206
vers_dateutil = 2.8.1
vers_decorator = 4.4.2
vers_deformation = 20210503
vers_defusedxml = 0.6.0
vers_distlib = 0.3.1
vers_docutils = 0.17.1
vers_dot2tex = 2.11.3.p0
vers_e_antic = 0.1.9
vers_ecl = 21.2.1
vers_eclib = 20210625
vers_ecm = 7.0.4.p2
vers_elliptic_curves = 0.8.1
vers_entrypoints = 0.3
vers_fflas_ffpack = 2.4.3.p0
vers_filelock = 3.0.12
vers_flint = 2.7.1
vers_flintqs = 1.0.p0
vers_fplll = 5.4.1
vers_fpylll = 0.5.6
vers_freetype = 2.10.4
vers_fricas = 1.3.7.p1
vers_frobby = 0.9.0.p2
vers_gambit = 15.1.1.p0
vers_gap = 4.11.1
vers_gap3 = 04jul17
vers_gap_jupyter = 0.9
vers_gap_packages = 4.11.1
vers_gc = 8.0.4
vers_gcc = 10.3.0
vers_gdb = 8.2
vers_gf2x = 1.3.0
vers_gfan = 0.6.2.p1
vers_gfortran = 10.3.0
vers_giac = 1.6.0.47p3
vers_git = none
vers_givaro = 4.1.1
vers_glpk = 5.0.p0
vers_glucose = 4.1
vers_gmp = 6.2.0
vers_gmpy2 = 2.1.0b5
vers_gp2c = 0.0.10.p0
vers_graphs = 20210214.p0
vers_graphviz = none
vers_gsl = 2.6
vers_html5lib = 1.0.1
vers_iconv = 1.15
vers_igraph = 0.8.3
vers_imagesize = 1.2.0
vers_iml = 1.0.4p1.p2
vers_importlib_metadata = 4.0.1
vers_importlib_resources = 5.1.4
vers_ipykernel = 5.2.1
vers_ipympl = 0.6.3
vers_ipython = 7.16.1
vers_ipython_genutils = 0.2.0
vers_ipywidgets = 7.6.3.p0
vers_isl = 0.20
vers_jedi = 0.17.2
vers_jinja2 = 2.11.2
vers_jmol = 14.29.52
vers_jsonschema = 3.2.0
vers_jupymake = 0.9
vers_jupyter_client = 6.1.6
vers_jupyter_core = 4.6.3
vers_jupyter_jsmol = 0.2.4
vers_jupyter_packaging = 0.7.12
vers_jupyterlab = none
vers_jupyterlab_widgets = 2.0
vers_kenzo = 1.1.10
vers_kiwisolver = 1.0.1
vers_latte_int = 1.7.6
vers_lcalc = 1.23.p20
vers_libatomic_ops = 7.6.10
vers_libbraiding = 1.1
vers_libffi = 3.2.1
vers_libgd = 2.3.2
vers_libhomfly = 1.02r6
vers_libnauty = none
vers_libogg = 1.3.1.p0
vers_libpng = 1.6.29.p1
vers_libsemigroups = 1.1.0
vers_libtheora = 1.1.1
vers_libxml2 = none
vers_lidia = 2.3.0+latte-patches-2019-05-02
vers_lie = 2.2.2
vers_linbox = 1.6.3.p1
vers_llvm = none
vers_lrcalc = 1.2.p1
vers_lrslib = 071b+autotools-2021-07-13
vers_m4ri = 20200115
vers_m4rie = 20200115
vers_markupsafe = 1.1.1
vers_mathjax = 2.7.4.p0
vers_matplotlib = 3.3.4
vers_maxima = 5.45.0
vers_mcqd = 1.0.p0
vers_meataxe = 1.0.1
vers_memory_allocator = 0.1.0
vers_mistune = 0.8.4
vers_modular_decomposition = 20100607
vers_mpc = 1.1.0
vers_mpfi = 1.5.2
vers_mpfr = 4.0.1.p0
vers_mpfrcx = 0.5
vers_mpir = 3.0.0-644faf502c56f97d9accd301965fc57d6ec70868.p0
vers_mpmath = 1.2.1
vers_nauty = 27r1.p1
vers_nbconvert = 5.6.1
vers_nbformat = 5.0.7
vers_ncurses = 6.0.p0
vers_networkx = 2.5.1
vers_nibabel = none
vers_ninja_build = 1.8.2
vers_nodeenv = none
vers_nodejs = 12.18.3
vers_normaliz = 3.8.10
vers_nose = 1.3.7
vers_notebook = 6.1.1
vers_notedown = 1.5.1
vers_ntl = 11.4.3
vers_numpy = 1.20.3
vers_openblas = 0.3.13
vers_openssl = 3.0.0-alpha12
vers_ore_algebra = none
vers_p_group_cohomology = 3.3.2
vers_packaging = 20.9
vers_palp = 2.11
vers_pandoc = none
vers_pandoc_attributes = 8bc82f6d
vers_pandocfilters = 1.4.2
vers_pari = 2.13.1
vers_pari_elldata = 20161017
vers_pari_galdata = 20080411.p0
vers_pari_galpol = 20180625
vers_pari_jupyter = 1.3.2
vers_pari_nftables = 20080929
vers_pari_seadata = 20090618
vers_pari_seadata_small = 20090618.p0
vers_parso = 0.7.0
vers_patch = 2.7.5
vers_pcre = 8.40.p2
vers_perl_cpan_polymake_prereq = none
vers_perl_mongodb = none
vers_perl_term_readline_gnu = 1.35
vers_pexpect = 4.8.0
vers_pickleshare = 0.7.5
vers_pillow = 8.1.2
vers_pip = 21.1.2
vers_pkgconf = 0.9.7.p2
vers_pkgconfig = 1.5.2
vers_planarity = 3.0.1.0
vers_plantri = 4.5
vers_pluggy = 0.13.1
vers_polylib = 5.22.5
vers_polymake = 4.4
vers_polytopes_db = 20170220.p0
vers_polytopes_db_4d = 1.0
vers_ppl = 1.2.p1
vers_pplpy = 0.8.6
vers_primecount = 5.1
vers_prometheus_client = 0.8.0
vers_prompt_toolkit = 3.0.5
vers_psutil = 5.2.0.p2
vers_ptyprocess = 0.5.1.p0
vers_py = 1.10.0
vers_pybind11 = 2.6.0
vers_pybtex = none
vers_pycosat = 0.6.3
vers_pycparser = 2.20
vers_pycygwin = 0.1
vers_pyflakes = none
vers_pygments = 2.3.1.p0
vers_pygraphviz = none
vers_pynac = 0.7.29.p1
vers_pynormaliz = 2.14
vers_pyopenssl = none
vers_pyparsing = 2.4.7
vers_pyrsistent = 0.16.0
vers_pysingular = 0.9.7
vers_pytest = none
vers_python3 = 3.9.5
vers_python_igraph = 0.8.3
vers_pytz = 2020.4
vers_pyx = none
vers_pyzmq = 22.0.3
vers_qepcad = B.1.72
vers_qhull = 2015-src-7.2.0.p1
vers_r = 3.6.3
vers_r_jupyter = none
vers_ratpoints = 2.1.3.p5
vers_readline = 8.0
vers_requests = 2.13.0
vers_rpy2 = 3.3.6
vers_rst2ipynb = 0.2.2.p0
vers_rubiks = 20070912.p21
vers_rw = 0.9
vers_saclib = 2.2.7
vers_sage_conf = 9.4
vers_sage_docbuild = 9.4
vers_sage_flatsurf = none
vers_sage_numerical_backends_coin = 9.0b12
vers_sage_numerical_backends_cplex = 9.0b12
vers_sage_numerical_backends_gurobi = 9.3.1
vers_sage_setup = 9.4
vers_sage_sws2rst = 9.4
vers_sagelib = 9.4
vers_sagemath_categories = 9.4
vers_sagemath_objects = 9.4
vers_sagenb_export = 3.3
vers_sagetex = 3.5
vers_scandir = 1.9.0
vers_scipoptsuite = 5.0.1
vers_scipy = 1.6.3
vers_send2trash = 1.5.0
vers_setuptools = 56.2.0
vers_setuptools_scm = 6.0.1
vers_setuptools_wheel = 56.2.0
vers_simplegeneric = 0.8.1.p0
vers_singular = 4.2.0p3
vers_singular_jupyter = 0.9.7
vers_sip = 4.18
vers_sirocco = 2.0.2
vers_six = 1.15.0
vers_slabbe = none
vers_snappy = none
vers_snowballstemmer = 1.2.1.p0
vers_speaklater = 1.3.p0
vers_sphinx = 4.0.1.p0
vers_sphinxcontrib_applehelp = 1.0.2
vers_sphinxcontrib_devhelp = 1.0.2
vers_sphinxcontrib_htmlhelp = 1.0.3
vers_sphinxcontrib_jsmath = 1.0.1
vers_sphinxcontrib_qthelp = 1.0.3
vers_sphinxcontrib_serializinghtml = 1.1.4
vers_sphinxcontrib_websupport = 1.2.1
vers_sqlalchemy = none
vers_sqlite = 3290000
vers_suitesparse = 5.10.1
vers_surf = 1.0.6-gcc6
vers_surface_dynamics = none
vers_symengine = 0.7.0
vers_symengine_py = 0.7.0.post2
vers_symmetrica = 3.0.1
vers_sympow = 2.023.6
vers_sympy = 1.8
vers_tachyon = 0.98.9.p7
vers_tdlib = 0.3.1.p0
vers_terminado = 0.8.3
vers_testpath = 0.4.4
vers_texlive = none
vers_texttable = 1.6.3
vers_thebe = 9624e0a0.p0
vers_threejs = r122.p0
vers_tides = 2.0.p0
vers_toml = 0.10.2
vers_topcom = 0.17.7
vers_tornado = 6.0.4
vers_tox = 3.23.1
vers_traitlets = 4.3.3
vers_typing_extensions = 3.10.0.0
vers_tzlocal = 2.1
vers_valgrind = 3.14.0
vers_vcversioner = 2.16.0.0.p0
vers_virtualenv = 20.4.7
vers_wcwidth = 0.1.7.p0
vers_webencodings = 0.5.1
vers_wheel = 0.36.2
vers_widgetsnbextension = 3.5.1.p0
vers_xz = 5.2.2.p0
vers_yasm = 1.3.0.p0
vers_zeromq = 4.2.5
vers_zipp = 0.5.2
vers_zlib = 1.2.11.p0
vers_zn_poly = 0.9.2

# Dependencies for all packages, in the format
#
# deps_<pkgname> = <dep1> <dep2> etc...


deps_4ti2 = zlib $(MP_LIBRARY) glpk
deps__bootstrap = 
deps__prereq = 
deps__recommended = 
deps_admcycles = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_alabaster = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_appdirs = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_appnope = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_arb = $(MP_LIBRARY) mpfr flint
deps_argon2_cffi = $(PYTHON) six | $(PYTHON_TOOLCHAIN) cffi
deps_atlas = gfortran | $(PYTHON)
deps_attrs = $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN)
deps_awali = $(PYTHON) cmake cython nbconvert ncurses
deps_babel = $(PYTHON) | $(PYTHON_TOOLCHAIN) pytz
deps_backcall = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_barvinok = ntl isl polylib
deps_beautifulsoup4 = | pip
deps_benzene = 
deps_biopython = | pip
deps_bleach = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_bliss = 
deps_boost_cropped = 
deps_brial = boost_cropped m4ri libpng | pkgconf
deps_buckygen = 
deps_bzip2 = | pkgconf
deps_cbc = readline zlib bzip2 $(BLAS)
deps_ccache = zlib
deps_cddlib = $(MP_LIBRARY)
deps_certifi = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_cffi = $(PYTHON) | $(PYTHON_TOOLCHAIN) pycparser
deps_cliquer = 
deps_cmake = curl zlib bzip2 xz
deps_cocoalib = $(MP_LIBRARY)
deps_combinatorial_designs = 
deps_configure = 
deps_conway_polynomials = $(PYTHON)
deps_coxeter3 = 
deps_cryptominisat = $(PYTHON) m4ri zlib libpng | cmake boost_cropped
deps_csdp = $(BLAS)
deps_cunningham_tables = 
deps_curl = 
deps_cvxopt = $(PYTHON) numpy $(BLAS) gsl glpk suitesparse | $(PYTHON_TOOLCHAIN) pkgconfig nose matplotlib
deps_cycler = $(PYTHON) six | $(PYTHON_TOOLCHAIN)
deps_cypari = $(PYTHON) cython pari cysignals | $(PYTHON_TOOLCHAIN)
deps_cysignals = $(PYTHON) cython pari | $(PYTHON_TOOLCHAIN)
deps_cython = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_d3js = 
deps_database_cremona_ellcurve = 
deps_database_jones_numfield = 
deps_database_knotinfo = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_database_kohel = 
deps_database_mutation_class = 
deps_database_odlyzko_zeta = | $(SAGERUNTIME)
deps_database_stein_watkins = 
deps_database_stein_watkins_mini = 
deps_database_symbolic_data = 
deps_dateutil = $(PYTHON) six | $(PYTHON_TOOLCHAIN)
deps_decorator = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_deformation = $(MP_LIBRARY) mpfr flint
deps_defusedxml = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_distlib = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_docutils = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_dot2tex = $(PYTHON) | $(PYTHON_TOOLCHAIN) pyparsing
deps_e_antic = $(MP_LIBRARY) flint arb
deps_ecl = $(MP_LIBRARY) readline gc libffi
deps_eclib = pari ntl flint
deps_ecm = $(MP_LIBRARY)
deps_elliptic_curves = | $(PYTHON)
deps_entrypoints = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_fflas_ffpack = $(MP_LIBRARY) givaro gsl $(BLAS) | pkgconf
deps_filelock = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_flint = $(MP_LIBRARY) mpfr ntl
deps_flintqs = $(MP_LIBRARY)
deps_fplll = $(MP_LIBRARY) mpfr
deps_fpylll = $(PYTHON) cython cysignals numpy fplll
deps_freetype = libpng bzip2
deps_fricas = ecl
deps_frobby = $(MP_LIBRARY)
deps_gambit = cython | $(PYTHON_TOOLCHAIN)
deps_gap = ncurses readline zlib $(MP_LIBRARY)
deps_gap3 = 
deps_gap_jupyter = $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython gap
deps_gap_packages = gap libsemigroups planarity | $(SAGERUNTIME)
deps_gc = libatomic_ops
deps_gcc = | $(MP_LIBRARY) mpfr mpc zlib xz
deps_gdb = mpfr zlib ncurses $(PYTHON) xz
deps_gf2x = 
deps_gfan = $(MP_LIBRARY) cddlib
deps_gfortran = | $(MP_LIBRARY) mpfr mpc zlib xz
deps_giac = readline libpng $(MP_LIBRARY) mpfr mpfi ntl gsl pari glpk curl
deps_git = 
deps_givaro = $(MP_LIBRARY)
deps_glpk = $(MP_LIBRARY) zlib
deps_glucose = zlib
deps_gmp = xz
deps_gmpy2 = $(PYTHON) $(MP_LIBRARY) mpfr mpc | $(PYTHON_TOOLCHAIN)
deps_gp2c = pari
deps_graphs = 
deps_graphviz = 
deps_gsl = $(BLAS)
deps_html5lib = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_iconv = 
deps_igraph = $(MP_LIBRARY) glpk $(BLAS) libxml2
deps_imagesize = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_iml = $(MP_LIBRARY) $(BLAS) | pkgconf
deps_importlib_metadata = $(PYTHON) zipp typing_extensions | $(PYTHON_TOOLCHAIN) toml
deps_importlib_resources = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_ipykernel = $(PYTHON) | ipython jupyter_client $(PYTHON_TOOLCHAIN) scandir
deps_ipympl = $(PYTHON) | $(PYTHON_TOOLCHAIN) ipywidgets matplotlib ipykernel jupyter_packaging $(findstring jupyterlab,$(OPTIONAL_INSTALLED_PACKAGES))
deps_ipython = $(PYTHON) jinja2 tornado pyzmq pickleshare simplegeneric traitlets | $(PYTHON_TOOLCHAIN) wcwidth prompt_toolkit pygments pexpect appnope backcall jedi
deps_ipython_genutils = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_ipywidgets = $(PYTHON) widgetsnbextension | $(PYTHON_TOOLCHAIN) ipykernel ipython traitlets
deps_isl = $(MP_LIBRARY)
deps_jedi = $(PYTHON) parso | $(PYTHON_TOOLCHAIN)
deps_jinja2 = $(PYTHON) markupsafe docutils | $(PYTHON_TOOLCHAIN)
deps_jmol = 
deps_jsonschema = $(PYTHON) vcversioner attrs importlib_metadata pyrsistent | $(PYTHON_TOOLCHAIN)
deps_jupymake = $(PYTHON) polymake | $(PYTHON_TOOLCHAIN)
deps_jupyter_client = $(PYTHON) jupyter_core | $(PYTHON_TOOLCHAIN) pyzmq dateutil
deps_jupyter_core = $(PYTHON) | $(PYTHON_TOOLCHAIN) traitlets
deps_jupyter_jsmol = ipywidgets $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_jupyter_packaging = $(PYTHON) packaging | $(PYTHON_TOOLCHAIN)
deps_jupyterlab = $(PYTHON) vcversioner jupyter_core jupyter_client | $(PYTHON_TOOLCHAIN)
deps_jupyterlab_widgets = jupyterlab nodejs tornado
deps_kenzo = ecl
deps_kiwisolver = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_latte_int = $(MP_LIBRARY) ntl 4ti2 cddlib lidia $(findstring lrslib,$(OPTIONAL_INSTALLED_PACKAGES))
deps_lcalc = pari mpfr
deps_libatomic_ops = 
deps_libbraiding = 
deps_libffi = 
deps_libgd = libpng freetype xz
deps_libhomfly = gc
deps_libnauty = $(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/nauty-$(vers_nauty)
deps_libogg = 
deps_libpng = zlib
deps_libsemigroups = 
deps_libtheora = libogg libpng
deps_libxml2 = iconv zlib
deps_lidia = $(MP_LIBRARY)
deps_lie = readline ncurses
deps_linbox = $(MP_LIBRARY) ntl givaro mpfr fplll iml flint fflas_ffpack
deps_llvm = 
deps_lrcalc = 
deps_lrslib = $(MP_LIBRARY)
deps_m4ri = libpng
deps_m4rie = m4ri
deps_markupsafe = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_mathjax = 
deps_matplotlib = $(PYTHON) numpy freetype pillow dateutil pyparsing tornado six cycler | $(PYTHON_TOOLCHAIN) pytz kiwisolver certifi
deps_maxima = ecl
deps_mcqd = 
deps_meataxe = 
deps_memory_allocator = $(PYTHON) cython | $(PYTHON_TOOLCHAIN)
deps_mistune = $(PYTHON) cython | $(PYTHON_TOOLCHAIN)
deps_modular_decomposition = 
deps_mpc = $(MP_LIBRARY) mpfr
deps_mpfi = $(MP_LIBRARY) mpfr
deps_mpfr = $(MP_LIBRARY)
deps_mpfrcx = $(MP_LIBRARY) mpfr mpc
deps_mpir = | yasm
deps_mpmath = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_nauty = 
deps_nbconvert = $(PYTHON) | $(PYTHON_TOOLCHAIN) mistune jinja2 pygments traitlets jupyter_core nbformat entrypoints bleach pandocfilters testpath defusedxml
deps_nbformat = $(PYTHON) | $(PYTHON_TOOLCHAIN) jsonschema
deps_ncurses = 
deps_networkx = $(PYTHON) decorator | $(PYTHON_TOOLCHAIN) scipy $(and $(filter-out no,$(SAGE_CHECK_networkx)), nose pytest)
deps_nibabel = | pip
deps_ninja_build = | $(PYTHON)
deps_nodeenv = $(PYTHON) | $(PYTHON_TOOLCHAIN) certifi
deps_nodejs = nodeenv
deps_normaliz = $(MP_LIBRARY) flint e_antic libnauty
deps_nose = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_notebook = $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython jupyter_client ipykernel nbconvert nbformat jinja2 tornado terminado send2trash prometheus_client argon2_cffi
deps_notedown = $(PYTHON) $(PYTHON_TOOLCHAIN) | pip nbformat nbconvert six pandoc_attributes
deps_ntl = $(MP_LIBRARY) gf2x
deps_numpy = $(PYTHON) $(BLAS) gfortran | $(PYTHON_TOOLCHAIN) pkgconfig cython
deps_openblas = gfortran | $(PYTHON)
deps_openssl = 
deps_ore_algebra = $(PYTHON) | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME)
deps_p_group_cohomology = $(PYTHON) cython cysignals singular meataxe $(SAGE_SRC)/sage/matrix/matrix_gfpn_dense.pxd $(SAGE_SRC)/sage/structure/element.pxd $(SAGE_SRC)/sage/matrix/matrix_gfpn_dense.pxd $(SAGE_SRC)/sage/matrix/matrix0.pxd $(SAGE_SRC)/sage/libs/meataxe.pxd $(SAGE_SRC)/sage/rings/morphism.pxd | $(PYTHON_TOOLCHAIN) matplotlib gap xz $(SAGERUNTIME) ipywidgets
deps_packaging = $(PYTHON) | $(PYTHON_TOOLCHAIN) pyparsing six
deps_palp = 
deps_pandoc = 
deps_pandoc_attributes = $(PYTHON) $(PYTHON_TOOLCHAIN) | pip pandocfilters
deps_pandocfilters = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pari = readline $(MP_LIBRARY) | pari_galdata pari_seadata_small
deps_pari_elldata = 
deps_pari_galdata = 
deps_pari_galpol = 
deps_pari_jupyter = $(PYTHON) pari | $(PYTHON_TOOLCHAIN) cython notebook jupyter_core
deps_pari_nftables = 
deps_pari_seadata = 
deps_pari_seadata_small = 
deps_parso = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_patch = 
deps_pcre = bzip2
deps_perl_cpan_polymake_prereq = 
deps_perl_mongodb = 
deps_perl_term_readline_gnu = readline
deps_pexpect = $(PYTHON) ptyprocess | $(PYTHON_TOOLCHAIN)
deps_pickleshare = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pillow = $(PYTHON) zlib freetype | $(PYTHON_TOOLCHAIN) pkgconf
deps_pip = $(PYTHON) setuptools wheel
deps_pkgconf = | patch
deps_pkgconfig = $(PYTHON) | $(PYTHON_TOOLCHAIN) pkgconf
deps_planarity = 
deps_plantri = 
deps_pluggy = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_polylib = $(MP_LIBRARY) mpfr ntl
deps_polymake = $(MP_LIBRARY) bliss cddlib lrslib normaliz perl_term_readline_gnu ppl perl_cpan_polymake_prereq libxml2 | ninja_build
deps_polytopes_db = 
deps_polytopes_db_4d = 
deps_ppl = $(MP_LIBRARY) glpk
deps_pplpy = $(PYTHON) $(MP_LIBRARY) gmpy2 cysignals mpfr mpc ppl | $(PYTHON_TOOLCHAIN) sphinx
deps_primecount = cmake
deps_prometheus_client = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_prompt_toolkit = $(PYTHON) six wcwidth | $(PYTHON_TOOLCHAIN)
deps_psutil = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_ptyprocess = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_py = $(PYTHON) | $(PYTHON_TOOLCHAIN) setuptools_scm
deps_pybind11 = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pybtex = | pip
deps_pycosat = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pycparser = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pycygwin = $(PYTHON) cython | $(PYTHON_TOOLCHAIN)
deps_pyflakes = | pip
deps_pygments = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pygraphviz = $(PYTHON) graphviz | $(PYTHON_TOOLCHAIN)
deps_pynac = $(PYTHON) $(MP_LIBRARY) flint singular | pkgconf
deps_pynormaliz = $(PYTHON) normaliz | $(PYTHON_TOOLCHAIN)
deps_pyopenssl = | pip
deps_pyparsing = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pyrsistent = $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN)
deps_pysingular = $(PYTHON) singular | $(PYTHON_TOOLCHAIN)
deps_pytest = | pip
deps_python3 = zlib readline sqlite libpng bzip2 xz libffi openssl
deps_python_igraph = igraph texttable $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pytz = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_pyx = | pip
deps_pyzmq = $(PYTHON) cython zeromq | $(PYTHON_TOOLCHAIN)
deps_qepcad = readline saclib
deps_qhull = | cmake
deps_r = $(BLAS) gfortran iconv readline bzip2 xz pcre curl | pkgconf
deps_r_jupyter = notebook r
deps_ratpoints = $(MP_LIBRARY)
deps_readline = ncurses
deps_requests = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_rpy2 = $(PYTHON) r cffi tzlocal pytz | $(PYTHON_TOOLCHAIN) pycparser $(and $(filter-out no,$(SAGE_CHECK_rpy2)), pytest numpy ipython)
deps_rst2ipynb = $(PYTHON) pandoc | $(PYTHON_TOOLCHAIN) notedown
deps_rubiks = 
deps_rw = 
deps_saclib = 
deps_sage_conf = $(PYTHON) $(SAGE_ROOT)/pkgs/sage-conf/sage_conf.py $(SAGE_ROOT)/pkgs/sage-conf/setup.cfg $(SAGE_ROOT)/pkgs/sage-conf/bin/sage-env-config | $(PYTHON_TOOLCHAIN)
deps_sage_docbuild = $(PYTHON) sphinx $(SAGE_ROOT)/pkgs/sage-docbuild/sage_docbuild/*.py $(SAGE_ROOT)/pkgs/sage-docbuild/sage_docbuild/ext/*.py | $(PYTHON_TOOLCHAIN) sagelib
deps_sage_flatsurf = $(PYTHON) | $(PYTHON_TOOLCHAIN) surface_dynamics
deps_sage_numerical_backends_coin = cbc cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets
deps_sage_numerical_backends_cplex = cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets
deps_sage_numerical_backends_gurobi = cysignals $(SAGE_SRC)/sage/numerical/backends/generic_backend.pxd $(SAGE_SRC)/sage/cpython/string.pxd $(SAGE_SRC)/sage/cpython/string_impl.h | $(SAGERUNTIME) $(PYTHON_TOOLCHAIN) cython ipywidgets
deps_sage_setup = $(PYTHON) cython pkgconfig | $(PYTHON_TOOLCHAIN)
deps_sage_sws2rst = $(PYTHON) beautifulsoup4 $(SAGE_ROOT)/pkgs/sage-sws2rst/*.py | $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_sage_sws2rst)), tox)
deps_sagelib = FORCE $(SCRIPTS) arb boost_cropped $(BLAS) brial cliquer cypari cysignals cython ecl eclib ecm flint libgd gap giac givaro glpk gmpy2 gsl iml jinja2 jupyter_core lcalc lrcalc libbraiding libhomfly libpng linbox m4ri m4rie memory_allocator mpc mpfi mpfr $(MP_LIBRARY) ntl numpy pari pip pkgconfig planarity ppl pplpy pycygwin pynac $(PYTHON) ratpoints rw sage_conf singular symmetrica zn_poly $(PCFILES) | $(PYTHON_TOOLCHAIN) sage_setup
deps_sagemath_categories = FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig $(and $(filter-out no,$(SAGE_CHECK)), tox)
deps_sagemath_objects = FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig $(and $(filter-out no,$(SAGE_CHECK)), tox)
deps_sagenb_export = $(PYTHON) nbconvert ipython six | $(PYTHON_TOOLCHAIN)
deps_sagetex = $(PYTHON) maxima scipy matplotlib pillow tachyon | $(and $(filter-out no,$(SAGE_CHECK_sagetex)), $(SAGERUNTIME) sympy elliptic_curves jmol)
deps_scandir = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_scipoptsuite = $(MP_LIBRARY) bliss readline | cmake
deps_scipy = $(PYTHON) $(BLAS) gfortran numpy pybind11 | $(PYTHON_TOOLCHAIN)
deps_send2trash = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_setuptools = $(PYTHON)
deps_setuptools_scm = $(PYTHON) | setuptools pip
deps_setuptools_wheel = $(PYTHON) setuptools wheel
deps_simplegeneric = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_singular = $(MP_LIBRARY) ntl flint readline mpfr cddlib
deps_singular_jupyter = $(PYTHON) jupyter_client | $(PYTHON_TOOLCHAIN) pysingular ipython ipywidgets
deps_sip = $(PYTHON)
deps_sirocco = 
deps_six = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_slabbe = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_snappy = $(PYTHON) decorator ipython cypari | $(PYTHON_TOOLCHAIN) sagelib
deps_snowballstemmer = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_speaklater = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinx = $(PYTHON) | $(PYTHON_TOOLCHAIN) docutils jinja2 pygments six snowballstemmer imagesize babel alabaster requests sphinxcontrib_websupport sphinxcontrib_applehelp sphinxcontrib_devhelp sphinxcontrib_htmlhelp sphinxcontrib_jsmath sphinxcontrib_qthelp sphinxcontrib_serializinghtml packaging
deps_sphinxcontrib_applehelp = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinxcontrib_devhelp = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinxcontrib_htmlhelp = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinxcontrib_jsmath = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinxcontrib_qthelp = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinxcontrib_serializinghtml = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sphinxcontrib_websupport = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_sqlalchemy = | pip
deps_sqlite = readline
deps_suitesparse = $(BLAS) gfortran mpfr $(MP_LIBRARY)
deps_surf = $(MP_LIBRARY)
deps_surface_dynamics = $(PYTHON) cysignals pplpy $(SAGE_SRC)/sage/rings/integer.pxd $(SAGE_SRC)/sage/ext/stdsage.pxd | $(PYTHON_TOOLCHAIN) $(SAGERUNTIME)
deps_symengine = $(MP_LIBRARY) arb ecm flint mpc mpfr | cmake
deps_symengine_py = symengine $(PYTHON) | cmake cython $(PYTHON_TOOLCHAIN) $(and $(filter-out no,$(SAGE_CHECK_symengine_py)), nose)
deps_symmetrica = xz
deps_sympow = | pari
deps_sympy = $(PYTHON) mpmath | $(PYTHON_TOOLCHAIN)
deps_tachyon = libpng
deps_tdlib = 
deps_terminado = $(PYTHON) | $(PYTHON_TOOLCHAIN) ptyprocess tornado
deps_testpath = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_texlive = 
deps_texttable = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_thebe = 
deps_threejs = 
deps_tides = $(MP_LIBRARY) mpfr
deps_toml = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_topcom = cddlib
deps_tornado = $(PYTHON) certifi | $(PYTHON_TOOLCHAIN)
deps_tox = $(PYTHON) packaging six filelock pluggy py toml virtualenv importlib_metadata | $(PYTHON_TOOLCHAIN)
deps_traitlets = $(PYTHON) | $(PYTHON_TOOLCHAIN) ipython_genutils decorator six
deps_typing_extensions = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_tzlocal = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_valgrind = 
deps_vcversioner = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_virtualenv = $(PYTHON) appdirs distlib filelock six importlib_metadata importlib_resources | $(PYTHON_TOOLCHAIN)
deps_wcwidth = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_webencodings = $(PYTHON) | $(PYTHON_TOOLCHAIN)
deps_wheel = $(PYTHON) setuptools
deps_widgetsnbextension = $(PYTHON) | $(PYTHON_TOOLCHAIN) jupyter_core
deps_xz = 
deps_yasm = 
deps_zeromq = 
deps_zipp = $(PYTHON) vcversioner | $(PYTHON_TOOLCHAIN)
deps_zlib = 
deps_zn_poly = $(MP_LIBRARY)

# Installation trees for all packages, in the format:
#
# - for a non-Python package:
#
#   trees_<pkgname1> = SAGE_LOCAL
#
# - for a Python package:
#
#   trees_<pkgname2> = SAGE_VENV


trees_4ti2 = SAGE_LOCAL
trees__bootstrap = SAGE_LOCAL
trees__prereq = SAGE_LOCAL
trees__recommended = SAGE_LOCAL
trees_admcycles = SAGE_VENV
trees_alabaster = SAGE_VENV
trees_appdirs = SAGE_VENV
trees_appnope = SAGE_VENV
trees_arb = SAGE_LOCAL
trees_argon2_cffi = SAGE_VENV
trees_atlas = SAGE_LOCAL
trees_attrs = SAGE_VENV
trees_awali = SAGE_LOCAL
trees_babel = SAGE_VENV
trees_backcall = SAGE_VENV
trees_barvinok = SAGE_LOCAL
trees_beautifulsoup4 = SAGE_VENV
trees_benzene = SAGE_LOCAL
trees_biopython = SAGE_VENV
trees_bleach = SAGE_VENV
trees_bliss = SAGE_LOCAL
trees_boost_cropped = SAGE_LOCAL
trees_brial = SAGE_LOCAL
trees_buckygen = SAGE_LOCAL
trees_bzip2 = SAGE_LOCAL
trees_cbc = SAGE_LOCAL
trees_ccache = SAGE_LOCAL
trees_cddlib = SAGE_LOCAL
trees_certifi = SAGE_VENV
trees_cffi = SAGE_VENV
trees_cliquer = SAGE_LOCAL
trees_cmake = SAGE_LOCAL
trees_cocoalib = SAGE_LOCAL
trees_combinatorial_designs = SAGE_LOCAL
trees_configure = SAGE_LOCAL
trees_conway_polynomials = SAGE_LOCAL
trees_coxeter3 = SAGE_LOCAL
trees_cryptominisat = SAGE_LOCAL
trees_csdp = SAGE_LOCAL
trees_cunningham_tables = SAGE_LOCAL
trees_curl = SAGE_LOCAL
trees_cvxopt = SAGE_VENV
trees_cycler = SAGE_VENV
trees_cypari = SAGE_VENV
trees_cysignals = SAGE_VENV
trees_cython = SAGE_VENV
trees_d3js = SAGE_LOCAL
trees_database_cremona_ellcurve = SAGE_LOCAL
trees_database_jones_numfield = SAGE_LOCAL
trees_database_knotinfo = SAGE_VENV
trees_database_kohel = SAGE_LOCAL
trees_database_mutation_class = SAGE_LOCAL
trees_database_odlyzko_zeta = SAGE_LOCAL
trees_database_stein_watkins = SAGE_LOCAL
trees_database_stein_watkins_mini = SAGE_LOCAL
trees_database_symbolic_data = SAGE_LOCAL
trees_dateutil = SAGE_VENV
trees_decorator = SAGE_VENV
trees_deformation = SAGE_LOCAL
trees_defusedxml = SAGE_VENV
trees_distlib = SAGE_VENV
trees_docutils = SAGE_VENV
trees_dot2tex = SAGE_VENV
trees_e_antic = SAGE_LOCAL
trees_ecl = SAGE_LOCAL
trees_eclib = SAGE_LOCAL
trees_ecm = SAGE_LOCAL
trees_elliptic_curves = SAGE_LOCAL
trees_entrypoints = SAGE_VENV
trees_fflas_ffpack = SAGE_LOCAL
trees_filelock = SAGE_VENV
trees_flint = SAGE_LOCAL
trees_flintqs = SAGE_LOCAL
trees_fplll = SAGE_LOCAL
trees_fpylll = SAGE_VENV
trees_freetype = SAGE_LOCAL
trees_fricas = SAGE_LOCAL
trees_frobby = SAGE_LOCAL
trees_gambit = SAGE_LOCAL
trees_gap = SAGE_LOCAL
trees_gap3 = SAGE_LOCAL
trees_gap_jupyter = SAGE_VENV
trees_gap_packages = SAGE_LOCAL
trees_gc = SAGE_LOCAL
trees_gcc = SAGE_LOCAL
trees_gdb = SAGE_LOCAL
trees_gf2x = SAGE_LOCAL
trees_gfan = SAGE_LOCAL
trees_gfortran = SAGE_LOCAL
trees_giac = SAGE_LOCAL
trees_git = SAGE_LOCAL
trees_givaro = SAGE_LOCAL
trees_glpk = SAGE_LOCAL
trees_glucose = SAGE_LOCAL
trees_gmp = SAGE_LOCAL
trees_gmpy2 = SAGE_VENV
trees_gp2c = SAGE_LOCAL
trees_graphs = SAGE_LOCAL
trees_graphviz = SAGE_LOCAL
trees_gsl = SAGE_LOCAL
trees_html5lib = SAGE_VENV
trees_iconv = SAGE_LOCAL
trees_igraph = SAGE_LOCAL
trees_imagesize = SAGE_VENV
trees_iml = SAGE_LOCAL
trees_importlib_metadata = SAGE_VENV
trees_importlib_resources = SAGE_VENV
trees_ipykernel = SAGE_VENV
trees_ipympl = SAGE_VENV
trees_ipython = SAGE_VENV
trees_ipython_genutils = SAGE_VENV
trees_ipywidgets = SAGE_VENV
trees_isl = SAGE_LOCAL
trees_jedi = SAGE_VENV
trees_jinja2 = SAGE_VENV
trees_jmol = SAGE_LOCAL
trees_jsonschema = SAGE_VENV
trees_jupymake = SAGE_VENV
trees_jupyter_client = SAGE_VENV
trees_jupyter_core = SAGE_VENV
trees_jupyter_jsmol = SAGE_VENV
trees_jupyter_packaging = SAGE_VENV
trees_jupyterlab = SAGE_VENV
trees_jupyterlab_widgets = SAGE_LOCAL
trees_kenzo = SAGE_LOCAL
trees_kiwisolver = SAGE_VENV
trees_latte_int = SAGE_LOCAL
trees_lcalc = SAGE_LOCAL
trees_libatomic_ops = SAGE_LOCAL
trees_libbraiding = SAGE_LOCAL
trees_libffi = SAGE_LOCAL
trees_libgd = SAGE_LOCAL
trees_libhomfly = SAGE_LOCAL
trees_libnauty = SAGE_LOCAL
trees_libogg = SAGE_LOCAL
trees_libpng = SAGE_LOCAL
trees_libsemigroups = SAGE_LOCAL
trees_libtheora = SAGE_LOCAL
trees_libxml2 = SAGE_LOCAL
trees_lidia = SAGE_LOCAL
trees_lie = SAGE_LOCAL
trees_linbox = SAGE_LOCAL
trees_llvm = SAGE_LOCAL
trees_lrcalc = SAGE_LOCAL
trees_lrslib = SAGE_LOCAL
trees_m4ri = SAGE_LOCAL
trees_m4rie = SAGE_LOCAL
trees_markupsafe = SAGE_VENV
trees_mathjax = SAGE_LOCAL
trees_matplotlib = SAGE_VENV
trees_maxima = SAGE_LOCAL
trees_mcqd = SAGE_LOCAL
trees_meataxe = SAGE_LOCAL
trees_memory_allocator = SAGE_VENV
trees_mistune = SAGE_VENV
trees_modular_decomposition = SAGE_LOCAL
trees_mpc = SAGE_LOCAL
trees_mpfi = SAGE_LOCAL
trees_mpfr = SAGE_LOCAL
trees_mpfrcx = SAGE_LOCAL
trees_mpir = SAGE_LOCAL
trees_mpmath = SAGE_VENV
trees_nauty = SAGE_LOCAL
trees_nbconvert = SAGE_VENV
trees_nbformat = SAGE_VENV
trees_ncurses = SAGE_LOCAL
trees_networkx = SAGE_VENV
trees_nibabel = SAGE_VENV
trees_ninja_build = SAGE_LOCAL
trees_nodeenv = SAGE_VENV
trees_nodejs = SAGE_LOCAL
trees_normaliz = SAGE_LOCAL
trees_nose = SAGE_VENV
trees_notebook = SAGE_VENV
trees_notedown = SAGE_VENV
trees_ntl = SAGE_LOCAL
trees_numpy = SAGE_VENV
trees_openblas = SAGE_LOCAL
trees_openssl = SAGE_LOCAL
trees_ore_algebra = SAGE_VENV
trees_p_group_cohomology = SAGE_VENV
trees_packaging = SAGE_VENV
trees_palp = SAGE_LOCAL
trees_pandoc = SAGE_LOCAL
trees_pandoc_attributes = SAGE_VENV
trees_pandocfilters = SAGE_VENV
trees_pari = SAGE_LOCAL
trees_pari_elldata = SAGE_LOCAL
trees_pari_galdata = SAGE_LOCAL
trees_pari_galpol = SAGE_LOCAL
trees_pari_jupyter = SAGE_VENV
trees_pari_nftables = SAGE_LOCAL
trees_pari_seadata = SAGE_LOCAL
trees_pari_seadata_small = SAGE_LOCAL
trees_parso = SAGE_VENV
trees_patch = SAGE_LOCAL
trees_pcre = SAGE_LOCAL
trees_perl_cpan_polymake_prereq = SAGE_LOCAL
trees_perl_mongodb = SAGE_LOCAL
trees_perl_term_readline_gnu = SAGE_LOCAL
trees_pexpect = SAGE_VENV
trees_pickleshare = SAGE_VENV
trees_pillow = SAGE_VENV
trees_pip = SAGE_VENV
trees_pkgconf = SAGE_LOCAL
trees_pkgconfig = SAGE_VENV
trees_planarity = SAGE_LOCAL
trees_plantri = SAGE_LOCAL
trees_pluggy = SAGE_VENV
trees_polylib = SAGE_LOCAL
trees_polymake = SAGE_LOCAL
trees_polytopes_db = SAGE_LOCAL
trees_polytopes_db_4d = SAGE_LOCAL
trees_ppl = SAGE_LOCAL
trees_pplpy = SAGE_VENV
trees_primecount = SAGE_LOCAL
trees_prometheus_client = SAGE_VENV
trees_prompt_toolkit = SAGE_VENV
trees_psutil = SAGE_VENV
trees_ptyprocess = SAGE_VENV
trees_py = SAGE_VENV
trees_pybind11 = SAGE_VENV
trees_pybtex = SAGE_VENV
trees_pycosat = SAGE_VENV
trees_pycparser = SAGE_VENV
trees_pycygwin = SAGE_VENV
trees_pyflakes = SAGE_VENV
trees_pygments = SAGE_VENV
trees_pygraphviz = SAGE_VENV
trees_pynac = SAGE_LOCAL
trees_pynormaliz = SAGE_VENV
trees_pyopenssl = SAGE_VENV
trees_pyparsing = SAGE_VENV
trees_pyrsistent = SAGE_VENV
trees_pysingular = SAGE_VENV
trees_pytest = SAGE_VENV
trees_python3 = SAGE_LOCAL
trees_python_igraph = SAGE_VENV
trees_pytz = SAGE_VENV
trees_pyx = SAGE_VENV
trees_pyzmq = SAGE_VENV
trees_qepcad = SAGE_LOCAL
trees_qhull = SAGE_LOCAL
trees_r = SAGE_LOCAL
trees_r_jupyter = SAGE_LOCAL
trees_ratpoints = SAGE_LOCAL
trees_readline = SAGE_LOCAL
trees_requests = SAGE_VENV
trees_rpy2 = SAGE_VENV
trees_rst2ipynb = SAGE_VENV
trees_rubiks = SAGE_LOCAL
trees_rw = SAGE_LOCAL
trees_saclib = SAGE_LOCAL
trees_sage_conf = SAGE_VENV
trees_sage_docbuild = SAGE_VENV
trees_sage_flatsurf = SAGE_VENV
trees_sage_numerical_backends_coin = SAGE_VENV
trees_sage_numerical_backends_cplex = SAGE_VENV
trees_sage_numerical_backends_gurobi = SAGE_VENV
trees_sage_setup = SAGE_VENV
trees_sage_sws2rst = SAGE_VENV
trees_sagelib = SAGE_VENV
trees_sagemath_categories = SAGE_LOCAL
trees_sagemath_objects = SAGE_LOCAL
trees_sagenb_export = SAGE_VENV
trees_sagetex = SAGE_VENV
trees_scandir = SAGE_VENV
trees_scipoptsuite = SAGE_LOCAL
trees_scipy = SAGE_VENV
trees_send2trash = SAGE_VENV
trees_setuptools = SAGE_VENV
trees_setuptools_scm = SAGE_VENV
trees_setuptools_wheel = SAGE_VENV
trees_simplegeneric = SAGE_VENV
trees_singular = SAGE_LOCAL
trees_singular_jupyter = SAGE_VENV
trees_sip = SAGE_LOCAL
trees_sirocco = SAGE_LOCAL
trees_six = SAGE_VENV
trees_slabbe = SAGE_VENV
trees_snappy = SAGE_VENV
trees_snowballstemmer = SAGE_VENV
trees_speaklater = SAGE_VENV
trees_sphinx = SAGE_VENV
trees_sphinxcontrib_applehelp = SAGE_VENV
trees_sphinxcontrib_devhelp = SAGE_VENV
trees_sphinxcontrib_htmlhelp = SAGE_VENV
trees_sphinxcontrib_jsmath = SAGE_VENV
trees_sphinxcontrib_qthelp = SAGE_VENV
trees_sphinxcontrib_serializinghtml = SAGE_VENV
trees_sphinxcontrib_websupport = SAGE_VENV
trees_sqlalchemy = SAGE_VENV
trees_sqlite = SAGE_LOCAL
trees_suitesparse = SAGE_LOCAL
trees_surf = SAGE_LOCAL
trees_surface_dynamics = SAGE_VENV
trees_symengine = SAGE_LOCAL
trees_symengine_py = SAGE_VENV
trees_symmetrica = SAGE_LOCAL
trees_sympow = SAGE_LOCAL
trees_sympy = SAGE_VENV
trees_tachyon = SAGE_LOCAL
trees_tdlib = SAGE_LOCAL
trees_terminado = SAGE_VENV
trees_testpath = SAGE_VENV
trees_texlive = SAGE_LOCAL
trees_texttable = SAGE_VENV
trees_thebe = SAGE_LOCAL
trees_threejs = SAGE_LOCAL
trees_tides = SAGE_LOCAL
trees_toml = SAGE_VENV
trees_topcom = SAGE_LOCAL
trees_tornado = SAGE_VENV
trees_tox = SAGE_VENV
trees_traitlets = SAGE_VENV
trees_typing_extensions = SAGE_VENV
trees_tzlocal = SAGE_VENV
trees_valgrind = SAGE_LOCAL
trees_vcversioner = SAGE_VENV
trees_virtualenv = SAGE_VENV
trees_wcwidth = SAGE_VENV
trees_webencodings = SAGE_VENV
trees_wheel = SAGE_VENV
trees_widgetsnbextension = SAGE_VENV
trees_xz = SAGE_LOCAL
trees_yasm = SAGE_LOCAL
trees_zeromq = SAGE_LOCAL
trees_zipp = SAGE_VENV
trees_zlib = SAGE_LOCAL
trees_zn_poly = SAGE_LOCAL

# All standard/optional/experimental installed packages (triggers the auto-update)
OPTIONAL_INSTALLED_PACKAGES =  \
    _prereq \
    alabaster \
    appdirs \
    appnope \
    arb \
    argon2_cffi \
    attrs \
    babel \
    backcall \
    bleach \
    boost_cropped \
    brial \
    bzip2 \
    cddlib \
    certifi \
    cffi \
    cliquer \
    cmake \
    combinatorial_designs \
    conway_polynomials \
    curl \
    cvxopt \
    cycler \
    cypari \
    cysignals \
    cython \
    dateutil \
    decorator \
    defusedxml \
    distlib \
    docutils \
    ecl \
    eclib \
    ecm \
    elliptic_curves \
    entrypoints \
    fflas_ffpack \
    filelock \
    flint \
    flintqs \
    fplll \
    fpylll \
    freetype \
    gap \
    gc \
    gcc \
    gf2x \
    gfan \
    gfortran \
    giac \
    givaro \
    glpk \
    gmp \
    gmpy2 \
    graphs \
    gsl \
    html5lib \
    iconv \
    imagesize \
    iml \
    importlib_metadata \
    importlib_resources \
    ipykernel \
    ipython \
    ipython_genutils \
    ipywidgets \
    jedi \
    jinja2 \
    jmol \
    jsonschema \
    jupyter_client \
    jupyter_core \
    jupyter_jsmol \
    kiwisolver \
    lcalc \
    libatomic_ops \
    libbraiding \
    libffi \
    libgd \
    libhomfly \
    libpng \
    linbox \
    lrcalc \
    m4ri \
    m4rie \
    markupsafe \
    mathjax \
    matplotlib \
    maxima \
    memory_allocator \
    mistune \
    mpc \
    mpfi \
    mpfr \
    mpir \
    mpmath \
    nauty \
    nbconvert \
    nbformat \
    ncurses \
    networkx \
    nose \
    notebook \
    ntl \
    numpy \
    openblas \
    openssl \
    packaging \
    palp \
    pandocfilters \
    pari \
    pari_galdata \
    pari_seadata_small \
    parso \
    patch \
    pcre \
    pexpect \
    pickleshare \
    pillow \
    pip \
    pkgconf \
    pkgconfig \
    planarity \
    pluggy \
    polytopes_db \
    ppl \
    pplpy \
    prometheus_client \
    prompt_toolkit \
    psutil \
    ptyprocess \
    py \
    pybind11 \
    pycparser \
    pycygwin \
    pygments \
    pynac \
    pyparsing \
    pyrsistent \
    python3 \
    pytz \
    pyzmq \
    r \
    ratpoints \
    readline \
    requests \
    rpy2 \
    rw \
    sage_conf \
    sage_docbuild \
    sage_setup \
    sagelib \
    sagenb_export \
    sagetex \
    scandir \
    scipy \
    send2trash \
    setuptools \
    setuptools_scm \
    setuptools_wheel \
    simplegeneric \
    singular \
    six \
    snowballstemmer \
    sphinx \
    sphinxcontrib_applehelp \
    sphinxcontrib_devhelp \
    sphinxcontrib_htmlhelp \
    sphinxcontrib_jsmath \
    sphinxcontrib_qthelp \
    sphinxcontrib_serializinghtml \
    sphinxcontrib_websupport \
    sqlite \
    suitesparse \
    symmetrica \
    sympow \
    sympy \
    tachyon \
    terminado \
    testpath \
    thebe \
    threejs \
    toml \
    tornado \
    tox \
    traitlets \
    typing_extensions \
    tzlocal \
    vcversioner \
    virtualenv \
    wcwidth \
    webencodings \
    wheel \
    widgetsnbextension \
    xz \
    yasm \
    zeromq \
    zipp \
    zlib \
    zn_poly
INSTALLED_PACKAGES = $(OPTIONAL_INSTALLED_PACKAGES)
INSTALLED_PACKAGE_INSTS = \
    $(foreach pkgname,$(INSTALLED_PACKAGES),$(inst_$(pkgname)))

# All previously installed standard/optional/experimental packages that are to be uninstalled
OPTIONAL_UNINSTALLED_PACKAGES = 
UNINSTALLED_PACKAGES = $(OPTIONAL_UNINSTALLED_PACKAGES)
UNINSTALLED_PACKAGES_CLEANS = $(UNINSTALLED_PACKAGES:%=%-clean)

# All packages which should be downloaded
SDIST_PACKAGES =  \
    alabaster \
    appdirs \
    appnope \
    arb \
    argon2_cffi \
    attrs \
    babel \
    backcall \
    bleach \
    boost_cropped \
    brial \
    bzip2 \
    cddlib \
    certifi \
    cffi \
    cliquer \
    cmake \
    combinatorial_designs \
    conway_polynomials \
    curl \
    cvxopt \
    cycler \
    cypari \
    cysignals \
    cython \
    dateutil \
    decorator \
    defusedxml \
    distlib \
    docutils \
    ecl \
    eclib \
    ecm \
    elliptic_curves \
    entrypoints \
    fflas_ffpack \
    filelock \
    flint \
    flintqs \
    fplll \
    fpylll \
    freetype \
    gap \
    gc \
    gcc \
    gf2x \
    gfan \
    gfortran \
    giac \
    givaro \
    glpk \
    gmp \
    gmpy2 \
    graphs \
    gsl \
    html5lib \
    iconv \
    imagesize \
    iml \
    importlib_metadata \
    importlib_resources \
    ipykernel \
    ipython \
    ipython_genutils \
    ipywidgets \
    jedi \
    jinja2 \
    jmol \
    jsonschema \
    jupyter_client \
    jupyter_core \
    jupyter_jsmol \
    kiwisolver \
    lcalc \
    libatomic_ops \
    libbraiding \
    libffi \
    libgd \
    libhomfly \
    libpng \
    linbox \
    lrcalc \
    m4ri \
    m4rie \
    markupsafe \
    mathjax \
    matplotlib \
    maxima \
    memory_allocator \
    mistune \
    mpc \
    mpfi \
    mpfr \
    mpir \
    mpmath \
    nauty \
    nbconvert \
    nbformat \
    ncurses \
    networkx \
    nose \
    notebook \
    ntl \
    numpy \
    openblas \
    openssl \
    packaging \
    palp \
    pandocfilters \
    pari \
    pari_galdata \
    pari_seadata_small \
    parso \
    patch \
    pcre \
    pexpect \
    pickleshare \
    pillow \
    pip \
    pkgconf \
    pkgconfig \
    planarity \
    pluggy \
    polytopes_db \
    ppl \
    pplpy \
    prometheus_client \
    prompt_toolkit \
    psutil \
    ptyprocess \
    py \
    pybind11 \
    pycparser \
    pycygwin \
    pygments \
    pynac \
    pyparsing \
    pyrsistent \
    python3 \
    pytz \
    pyzmq \
    r \
    ratpoints \
    readline \
    requests \
    rpy2 \
    rw \
    sagenb_export \
    sagetex \
    scandir \
    scipy \
    send2trash \
    setuptools \
    setuptools_scm \
    setuptools_wheel \
    simplegeneric \
    singular \
    six \
    snowballstemmer \
    sphinx \
    sphinxcontrib_applehelp \
    sphinxcontrib_devhelp \
    sphinxcontrib_htmlhelp \
    sphinxcontrib_jsmath \
    sphinxcontrib_qthelp \
    sphinxcontrib_serializinghtml \
    sphinxcontrib_websupport \
    sqlite \
    suitesparse \
    symmetrica \
    sympow \
    sympy \
    tachyon \
    terminado \
    testpath \
    thebe \
    threejs \
    toml \
    tornado \
    tox \
    traitlets \
    typing_extensions \
    tzlocal \
    vcversioner \
    virtualenv \
    wcwidth \
    webencodings \
    wheel \
    widgetsnbextension \
    xz \
    yasm \
    zeromq \
    zipp \
    zlib \
    zn_poly

# Packages that use the 'normal' build rules
NORMAL_PACKAGES =  \
    4ti2 \
    alabaster \
    appdirs \
    appnope \
    arb \
    argon2_cffi \
    atlas \
    attrs \
    awali \
    babel \
    backcall \
    barvinok \
    benzene \
    bleach \
    bliss \
    boost_cropped \
    brial \
    buckygen \
    bzip2 \
    cbc \
    ccache \
    cddlib \
    certifi \
    cffi \
    cliquer \
    cmake \
    cocoalib \
    combinatorial_designs \
    configure \
    conway_polynomials \
    coxeter3 \
    cryptominisat \
    csdp \
    cunningham_tables \
    curl \
    cvxopt \
    cycler \
    cypari \
    cysignals \
    cython \
    d3js \
    database_cremona_ellcurve \
    database_jones_numfield \
    database_knotinfo \
    database_kohel \
    database_mutation_class \
    database_odlyzko_zeta \
    database_stein_watkins \
    database_stein_watkins_mini \
    database_symbolic_data \
    dateutil \
    decorator \
    deformation \
    defusedxml \
    distlib \
    docutils \
    dot2tex \
    e_antic \
    ecl \
    eclib \
    ecm \
    elliptic_curves \
    entrypoints \
    fflas_ffpack \
    filelock \
    flint \
    flintqs \
    fplll \
    fpylll \
    freetype \
    fricas \
    frobby \
    gambit \
    gap \
    gap3 \
    gap_jupyter \
    gap_packages \
    gc \
    gcc \
    gdb \
    gf2x \
    gfan \
    gfortran \
    giac \
    givaro \
    glpk \
    glucose \
    gmp \
    gmpy2 \
    gp2c \
    graphs \
    gsl \
    html5lib \
    iconv \
    igraph \
    imagesize \
    iml \
    importlib_metadata \
    importlib_resources \
    ipykernel \
    ipympl \
    ipython \
    ipython_genutils \
    ipywidgets \
    isl \
    jedi \
    jinja2 \
    jmol \
    jsonschema \
    jupymake \
    jupyter_client \
    jupyter_core \
    jupyter_jsmol \
    jupyter_packaging \
    kenzo \
    kiwisolver \
    latte_int \
    lcalc \
    libatomic_ops \
    libbraiding \
    libffi \
    libgd \
    libhomfly \
    libogg \
    libpng \
    libsemigroups \
    libtheora \
    lidia \
    lie \
    linbox \
    lrcalc \
    lrslib \
    m4ri \
    m4rie \
    markupsafe \
    mathjax \
    matplotlib \
    maxima \
    mcqd \
    meataxe \
    memory_allocator \
    mistune \
    modular_decomposition \
    mpc \
    mpfi \
    mpfr \
    mpfrcx \
    mpir \
    mpmath \
    nauty \
    nbconvert \
    nbformat \
    ncurses \
    networkx \
    ninja_build \
    normaliz \
    nose \
    notebook \
    notedown \
    ntl \
    numpy \
    openblas \
    openssl \
    p_group_cohomology \
    packaging \
    palp \
    pandoc_attributes \
    pandocfilters \
    pari \
    pari_elldata \
    pari_galdata \
    pari_galpol \
    pari_jupyter \
    pari_nftables \
    pari_seadata \
    pari_seadata_small \
    parso \
    patch \
    pcre \
    perl_term_readline_gnu \
    pexpect \
    pickleshare \
    pillow \
    pip \
    pkgconf \
    pkgconfig \
    planarity \
    plantri \
    pluggy \
    polylib \
    polymake \
    polytopes_db \
    polytopes_db_4d \
    ppl \
    pplpy \
    primecount \
    prometheus_client \
    prompt_toolkit \
    psutil \
    ptyprocess \
    py \
    pybind11 \
    pycosat \
    pycparser \
    pycygwin \
    pygments \
    pynac \
    pynormaliz \
    pyparsing \
    pyrsistent \
    pysingular \
    python3 \
    python_igraph \
    pytz \
    pyzmq \
    qepcad \
    qhull \
    r \
    ratpoints \
    readline \
    requests \
    rpy2 \
    rst2ipynb \
    rubiks \
    rw \
    saclib \
    sage_numerical_backends_coin \
    sage_numerical_backends_cplex \
    sage_numerical_backends_gurobi \
    sagenb_export \
    sagetex \
    scandir \
    scipoptsuite \
    scipy \
    send2trash \
    setuptools \
    setuptools_scm \
    setuptools_wheel \
    simplegeneric \
    singular \
    singular_jupyter \
    sip \
    sirocco \
    six \
    snowballstemmer \
    speaklater \
    sphinx \
    sphinxcontrib_applehelp \
    sphinxcontrib_devhelp \
    sphinxcontrib_htmlhelp \
    sphinxcontrib_jsmath \
    sphinxcontrib_qthelp \
    sphinxcontrib_serializinghtml \
    sphinxcontrib_websupport \
    sqlite \
    suitesparse \
    surf \
    symengine \
    symengine_py \
    symmetrica \
    sympow \
    sympy \
    tachyon \
    tdlib \
    terminado \
    testpath \
    texttable \
    thebe \
    threejs \
    tides \
    toml \
    topcom \
    tornado \
    tox \
    traitlets \
    typing_extensions \
    tzlocal \
    valgrind \
    vcversioner \
    virtualenv \
    wcwidth \
    webencodings \
    wheel \
    widgetsnbextension \
    xz \
    yasm \
    zeromq \
    zipp \
    zlib \
    zn_poly

# Packages that use the 'pip' package build rules
PIP_PACKAGES =  \
    admcycles \
    beautifulsoup4 \
    biopython \
    jupyterlab \
    nibabel \
    nodeenv \
    ore_algebra \
    pybtex \
    pyflakes \
    pygraphviz \
    pyopenssl \
    pytest \
    pyx \
    sage_flatsurf \
    slabbe \
    snappy \
    sqlalchemy \
    surface_dynamics

# Packages that use the 'script' package build rules
SCRIPT_PACKAGES =  \
    _bootstrap \
    _prereq \
    _recommended \
    git \
    graphviz \
    jupyterlab_widgets \
    libnauty \
    libxml2 \
    llvm \
    nodejs \
    pandoc \
    perl_cpan_polymake_prereq \
    perl_mongodb \
    r_jupyter \
    sage_conf \
    sage_docbuild \
    sage_setup \
    sage_sws2rst \
    sagelib \
    sagemath_categories \
    sagemath_objects \
    texlive



# Generate the actual inst_<pkgname> variables; for each package that is
# actually built this generates a line like:
#
# inst_<pkgname> = $(INST)/<pkgname>-<pkgvers>
#
# And for 'dummy' package that are not actually built/installed (e.g. because
# configure determined we can use the package from the system):
#
# inst_<pkgname> = $(INST)/.dummy
#
# For example:
#
# inst_python3 = $(INST)/python3-$(vers_python3)
#
# inst_git = $(INST)/.dummy

$(foreach pkgname,$(BUILT_PACKAGES),\
	$(eval inst_$(pkgname) = $(foreach tree, $(trees_$(pkgname)), $($(tree))/$(SPKG_INST_RELDIR)/$(pkgname)-$(vers_$(pkgname)))))
$(foreach pkgname,$(DUMMY_PACKAGES),\
	$(eval inst_$(pkgname) = $(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/.dummy))

# Override this for pip packages, for which we do not keep an installation record
# in addition to what pip is already doing.
$(foreach pkgname,$(PIP_PACKAGES),\
	$(eval inst_$(pkgname) = $(pkgname)))

# Dummy target for packages which are not installed
$(SAGE_LOCAL)/$(SPKG_INST_RELDIR)/.dummy:
	touch $@


# Filtered by installation tree
$(foreach tree,SAGE_LOCAL SAGE_VENV, \
    $(eval $(tree)_INSTALLED_PACKAGE_INSTS = \
               $(foreach pkgname,$(INSTALLED_PACKAGES), \
                         $(if $(findstring $(tree),$(trees_$(pkgname))), \
                              $(inst_$(pkgname))))) \
    $(eval $(tree)_CLEANED_PACKAGE_CLEANS = \
               $(foreach pkgname,$(INSTALLED_PACKAGES), \
                         $(if $(findstring $(tree),$(trees_$(pkgname))), \
                              $(inst_$(pkgname))))))


###############################################################################

# Silent rules
# https://www.gnu.org/software/automake/manual/html_node/Automake-Silent-Rules.html
ifeq ($(V), 0)
AM_V_at = @
else
AM_V_at =
endif

# List of targets that can be run using `sage -i` or `sage -f`
# These should generally have an associated -clean target for `sage -f` to
# work correctly
SAGE_I_TARGETS = sagelib doc

# Tell make not to look for files with these names:
.PHONY: all all-sage all-toolchain all-build all-sageruntime \
	all-start build-start base toolchain toolchain-deps base-toolchain \
	sagelib \
	doc doc-html doc-html-jsmath doc-html-mathjax doc-pdf \
	doc-clean doc-src-clean doc-output-clean \
	clean sagelib-clean build-clean python3_venv _clean-broken-gcc

PYTHON_FOR_VENV = /usr/bin/python3

ifneq ($(PYTHON_FOR_VENV),)
# Special rule for making the Python virtualenv from the system Python (Python
# 3 only).  $(PYTHON) is set in Makefile to python3_venv.
# Thus $(inst_python3_venv) will be the dependency of every Python package.
#
# TODO: If we reconfigure to build our own Python after having used the system
# Python, files installed to create the virtualenv should be *removed*.  That
# could either be done here by the makefile, or in an spkg-preinst for python3
ifeq ($(PYTHON),python3)
PYTHON = python3_venv
endif
inst_python3_venv = $(SAGE_VENV)/pyvenv.cfg

$(inst_python3_venv):
	$(PYTHON_FOR_VENV) $(SAGE_ROOT)/build/bin/sage-venv "$(SAGE_VENV)"
endif

# Build everything and start Sage.
# Note that we put the "doc" target first in the rule below because
# the doc build takes the most time and should be started as soon as
# possible.
all-start: toolchain-deps
	+$(MAKE_REC) doc all-sage

# Build everything except the documentation
all-build: toolchain-deps
	+$(MAKE_REC) all-sage

# This used to do run "sage-starts" script, now it's just an alias
build-start: all-build

# The 2 preliminary build phases: base and toolchain.
base-toolchain: _clean-broken-gcc base
	+$(MAKE_REC) toolchain

# All targets except for the base packages
all-sage: \
		$(INSTALLED_PACKAGE_INSTS) \
                $(UNINSTALLED_PACKAGES_CLEANS)

# Same but filtered by installation trees:
all-build-local: toolchain-deps
	+$(MAKE_REC) all-sage-local

all-sage-local: $(SAGE_LOCAL_INSTALLED_PACKAGE_INSTS) $(SAGE_LOCAL_UNINSTALLED_PACKAGES_CLEANS)

all-build-venv: toolchain-deps
	+$(MAKE_REC) all-sage-venv

all-sage-venv:  $(SAGE_VENV_INSTALLED_PACKAGE_INSTS)  $(SAGE_VENV_UNINSTALLED_PACKAGES_CLEANS)

# Download all packages which should be inside an sdist tarball (the -B
# option to make forces all targets to be built unconditionally)
download-for-sdist:
	+env SAGE_INSTALL_FETCH_ONLY=yes $(MAKE_REC) -B SAGERUNTIME= \
		$(SDIST_PACKAGES)

# TOOLCHAIN consists of dependencies determined by configure.
# These are built after the "base" target but before anything else.
toolchain: $(foreach pkgname,$(TOOLCHAIN),$(inst_$(pkgname))) $(PCFILES)

# Build all packages that GCC links against serially, otherwise this
# leads to race conditions where some library which is used by GCC gets
# reinstalled. Since system GCCs might use Sage's libraries, we do this
# unconditionally. We still use the dependency checking from $(MAKE),
# so this will not trigger useless rebuilds.
# See #14168 and #14232.
#
# Note: This list consists of only the *runtime* dependencies of the toolchain.
TOOLCHAIN_DEPS = zlib $(MP_LIBRARY) mpfr mpc
TOOLCHAIN_DEP_INSTS = \
	$(foreach pkgname,$(TOOLCHAIN_DEPS),$(inst_$(pkgname)))

toolchain-deps:
	+@for target in $(TOOLCHAIN_DEP_INSTS); do \
	    echo $(MAKE_REC) $$target; \
	    $(MAKE_REC) $$target; \
	done

all-toolchain: base-toolchain
	+$(MAKE_REC) toolchain-deps

# All packages needed as a prerequisite to install other Python packages with
# pip or which are otherwise used by the Python build tools; these should be
# given as a prerequisite to any pip-installed packages
PYTHON_TOOLCHAIN = setuptools pip setuptools_scm wheel setuptools_wheel

# Trac #32056: Avoid installed setuptools leaking into the build of python3 by uninstalling it.
# It will have to be reinstalled anyway because of its dependency on $(PYTHON).
python3-SAGE_LOCAL-no-deps: setuptools-clean
python3-SAGE_VENV-no-deps: setuptools-clean

# Everything needed to start up Sage using "./sage".  Of course, not
# every part of Sage will work.  It does not include Maxima for example.
SAGERUNTIME = sagelib $(inst_ipython) $(inst_pexpect) \
		$(inst_psutil)

all-sageruntime: toolchain-deps
	+$(MAKE_REC) $(SAGERUNTIME)


###############################################################################
# Building the base system
#
# This consists of packages which are required for the Sage build system.
###############################################################################
base: $(inst_patch) $(inst_pkgconf)

###############################################################################
# Building the documentation
###############################################################################

# You can choose to have the built HTML version of the documentation link to
# the PDF version. To do so, you need to build both the HTML and PDF versions.
# To have the HTML version link to the PDF version, do
#
# $ ./sage --docbuild all html
# $ ./sage --docbuild all pdf
#
# For more information on the docbuild utility, do
#
# $ ./sage --docbuild -H

# Building the documentation has many dependencies, because all
# documented modules are imported and because we use matplotlib to
# produce plots.
DOC_DEPENDENCIES = sagelib sage_docbuild $(inst_sphinx) \
	| $(SAGERUNTIME) $(inst_maxima) $(inst_networkx) $(inst_scipy) $(inst_sympy) \
	$(inst_matplotlib) $(inst_pillow) $(inst_mathjax) $(inst_mpmath) \
	$(inst_ipykernel) $(inst_jupyter_client) $(inst_conway_polynomials) \
	$(inst_tachyon) $(inst_jmol) $(inst_thebe) $(inst_ipywidgets)

doc: doc-html

doc-html: $(DOC_DEPENDENCIES)
	$(AM_V_at)cd "$(SAGE_SRC)/doc" && sage-logger -p "$(MAKE) doc-html" $(SAGE_ROOT)/logs/dochtml.log

# 'doc-html-no-plot': build docs without building the graphics coming
# from the '.. plot' directive, in case you want to save a few
# megabytes of disk space. 'doc-clean' is a prerequisite because the
# presence of graphics is cached in src/doc/output.
doc-html-no-plot: doc-clean
	$(AM_V_at)sage-logger -p "$(MAKE) SAGE_DOCBUILD_OPTS=\"$(SAGE_DOCBUILD_OPTS) --no-plot\" doc-html" $(SAGE_ROOT)/logs/dochtml.log

doc-html-mathjax:
	$(AM_V_at)sage-logger -p "$(MAKE) SAGE_DOCBUILD_OPTS=\"$(SAGE_DOCBUILD_OPTS) -j\" doc-html" $(SAGE_ROOT)/logs/dochtml.log

# Keep target 'doc-html-jsmath' for backwards compatibility.
doc-html-jsmath: doc-html-mathjax

doc-pdf: $(DOC_DEPENDENCIES)
	$(AM_V_at)cd "$(SAGE_SRC)/doc" && sage-logger -p "$(MAKE) doc-pdf" $(SAGE_ROOT)/logs/docpdf.log

doc-clean: doc-src-clean doc-output-clean

doc-src-clean:
	cd "$(SAGE_SRC)/doc" && $(MAKE) clean

doc-output-clean:
	rm -rf "$(SAGE_SHARE)/doc/sage"


###############################################################################
# Cleaning up
###############################################################################

clean:
	@echo "Deleting package build directories..."
	rm -rf "$(SAGE_LOCAL)/var/tmp/sage/build"

# "c_lib", ".cython_version", "build" in $(SAGE_SRC) are from old sage versions
# Cleaning .so files (and .c and .cpp files associated with .pyx files) is for editable installs.
# Also cython_debug is for editable installs.
sagelib-clean:
	@echo "Deleting Sage library build artifacts..."
	(cd "$(SAGE_SRC)" && \
	 rm -rf c_lib .cython_version cython_debug; \
	 rm -rf build; find . -name '*.pyc' -o -name "*.so" | xargs rm -f; \
	 rm -f $$(find . -name "*.pyx" | sed 's/\(.*\)[.]pyx$$/\1.c \1.cpp/'); \
	 rm -rf sage/ext/interpreters) \
	&& (cd "$(SAGE_ROOT)/build/pkgs/sagelib/src/" && rm -rf build)

sage_docbuild-clean:
	(cd "$(SAGE_ROOT)/build/pkgs/sage_docbuild/src" && rm -rf build)

build-clean: clean doc-clean sagelib-clean sage_docbuild-clean

# Special target for cleaning up a broken GCC install detected by configure
# This should check for the .clean-broken-gcc stamp, and if found clean
# everything up along with the stamp file itself.  This target is then run
# as a prerequisite to installing any other packages.
_clean-broken-gcc:
	@if [ -f "$(SAGE_ROOT)/build/make/.clean-broken-gcc" ]; then \
	   rm -f "$(SAGE_LOCAL)/bin/gcc"; \
	   rm -f "$(SAGE_LOCAL)/gcc-"*; \
	   rm -f "$(SAGE_LOCAL)/bin/g++"; \
	   rm -f "$(SAGE_SPKG_INST)/gcc-"*; \
	   rm -f "$(SAGE_ROOT)/build/make/.clean-broken-gcc"; \
	   echo "Cleaned up old broken GCC install"; \
	fi

#==============================================================================
# Setting SAGE_CHECK... variables
#==============================================================================
ifeq "$(origin SAGE_CHECK)" "undefined"
SAGE_CHECK := no
endif

define SET_SAGE_CHECK
$(eval SAGE_CHECK_$(1) := $(2))
endef
# Set defaults
$(foreach pkgname, $(NORMAL_PACKAGES),\
	$(eval $(call SET_SAGE_CHECK,$(pkgname),$(SAGE_CHECK))))

# Parsing the SAGE_CHECK_PACKAGES variable:
# - if this contains "!pkg", set SAGE_CHECK_pkg=no.
# - if this contains "?pkg", set SAGE_CHECK_pkg=warn.
# - if this contains "pkg",  set SAGE_CHECK_pkg=yes.
#
# We check this now and export SAGE_CHECK_pkg for
# dependencies and the Makefile rules.
#
# Since Python's self-tests seem to fail on all platforms, we disable
# its test suite by default.
# However, if SAGE_CHECK=warn, we do not do that.
SAGE_CHECK_PACKAGES_DEFAULT_yes := !python3
SAGE_CHECK_PACKAGES_DEFAULT_warn :=
SAGE_CHECK_PACKAGES_DEFAULT_no :=
comma := ,
ifeq "$(origin SAGE_CHECK_PACKAGES)" "undefined"
SAGE_CHECK_PACKAGES := $(SAGE_CHECK_PACKAGES_DEFAULT_$(SAGE_CHECK))
endif
SAGE_CHECK_PACKAGES_sep := $(subst $(comma), ,$(SAGE_CHECK_PACKAGES))
SAGE_CHECK_PACKAGES_sep := $(subst :, ,$(SAGE_CHECK_PACKAGES_sep))
$(foreach clause, $(SAGE_CHECK_PACKAGES_sep),					\
     $(if $(findstring !,$(clause)),						\
	  $(eval $(call SET_SAGE_CHECK,$(subst !,,$(clause)),no)),		\
	  $(if $(findstring ?,$(clause)),					\
	       $(eval $(call SET_SAGE_CHECK,$(subst ?,,$(clause)),warn)),	\
	       $(eval $(call SET_SAGE_CHECK,$(clause),yes)))))
debug-check:
	@echo $(foreach pkgname, $(NORMAL_PACKAGES), SAGE_CHECK_$(pkgname) = $(SAGE_CHECK_$(pkgname)))


#==============================================================================
# Rules generated from pkgs/<package>/dependencies files
#==============================================================================

# Define a function for generating the list of a package's dependencies
# as $(inst_<pkgname>) variables.  For example, takes:
#
#     deps_cysignals = python3 cython pari | pip
#
# to:
#
#     $(inst_python3) $(inst_cython) $(inst_pari) | $(inst_pip)
#
# If some value in the dependencies list is not a package name (e.g. it is
# the name of some arbitrary file, or it is the '|' symbol) then it is just
# used verbatim.
#
# As a special case, also adds a special variable GCC_DEP for all packages
# except for gcc itself.  See the definition of GCC_DEP above
#
# Positional arguments:
#     $(1): package name
pkg_deps = \
	$(if $(filter gcc,$(1)),,$$(GCC_DEP))\
	$(foreach dep,$(deps_$(1)),\
        $(if $(value inst_$(dep)),$$(inst_$(dep)),$(dep)))

# ============================= normal packages ==============================
# Generate build rules for 'normal' packages; this template is used to generate
# rules in the form:
#
# $(INST)/<pkgname>-<pkgvers>: <dependencies>
#     $(MAKE) $(1)-no-deps
#
# <pkgname>: $(INST)/<pkgname>-<pkgvers>
#
# <pkgname>-build-deps: <dependencies>
#
# <pkgname>-no-deps:
#     +$(AM_V_at)sage-logger -p '$(SAGE_SPKG) <pkgname>-<pkgvers>' '$(SAGE_LOGS)/<pkgname>-<pkgvers>.log'
#
# <pkgname>-clean:
#     sage-spkg-uninstall <pkgname> '$(SAGE_LOCAL)'
#
# So <pkgname>-build-deps installs just the dependencies, while
# <pkgname>-no-deps tries to install the package without its
# dependencies. This is currently used in SAGE_SRC/bin/sage when
# running 'sage -b' to build the Sage library.
#
# For example, for python3 this will expand to:
#
# $(INST)/python3-3.7.3: $(inst_zlib) $(inst_readline) $(inst_sqlite) $(inst_libpng) $(inst_bzip2) $(inst_xz) $(inst_libffi)
#     +$(AM_V_at)sage-logger -p '$(SAGE_SPKG) python3-3.7.3' '$(SAGE_LOGS)/python3-3.7.3.log'
#
# python3: $(INST)/python3-3.7.3
#
# python3-clean:
#     sage-spkg-uninstall python3 '$(SAGE_LOCAL)'
#
# Note: In these rules the $(INST)/<pkgname>-<pkgvers> target is used
# explicitly, rather than expanding the $(inst_<pkgname>) variable, since
# it may expand to $(INST)/.dummy for packages that were not configured
# for installation by default.  However, we wish to be able to manually
# install those packages later.
#
# For packages listed in $(TOOLCHAIN_DEPS) we also pass --keep-existing to
# sage-spkg, and --keep-files to sage-spkg-uninstall since those packages can
# have a recursive self-dependency, and should not be deleted while upgrading.
# See Trac #25857

# Positional arguments:
#     $(1): package name
#     $(2): package version
#     $(3): package dependencies
#     $(4): package tree variable

define NORMAL_PACKAGE_templ ##########################################

$(1)-build-deps: $(3)

$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2): $(3)
	+$(MAKE_REC) $(1)-$(4)-no-deps

$(1): $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)

$(1)-$(4)-no-deps:
	+$(AM_V_at)sage-logger -p 'SAGE_CHECK=$$(SAGE_CHECK_$(1)) PATH=$$($(4))/bin:$$$$PATH $$(SAGE_SPKG) $$(SAGE_SPKG_OPTIONS) \
		$(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-existing) \
		$(1)-$(2) $$($(4))' '$$(SAGE_LOGS)/$(1)-$(2).log'

$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-clean:
	sage-spkg-uninstall $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-files) \
		$(1) '$$($(4))'

$(1)-clean: $(1)-$(4)-clean

.PHONY: $(1) $(1)-clean $(1)-build-deps $(1)-no-deps
endef #################################################################

$(foreach pkgname, $(NORMAL_PACKAGES),\
    $(foreach tree, $(trees_$(pkgname)), \
	$(eval $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),\
	                                   $(call pkg_deps,$(pkgname)),$(tree)))))

ifdef DEBUG_RULES
$(info # Rules for standard packages)
$(foreach pkgname, $(NORMAL_PACKAGES),\
    $(foreach tree, $(trees_$(pkgname)), \
	$(info $(call NORMAL_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),\
	                                   $(call pkg_deps,$(pkgname)),$(tree)))))
endif

# ================================ pip packages ===============================
# Generate build rules for 'pip' packages; this template is used to generate
# two rules in the form:
#
# <pkgname>: <dependencies>
#     $(AM_V_at)sage-logger -p 'sage --pip install ...' '$(SAGE_LOGS)/<pkgname>.log'
#
# <pkgname>-clean:
#     -sage --pip uninstall -y ...

# Positional arguments:
#     $(1): package name
#     $(2): package dependencies
define PIP_PACKAGE_templ
$(1)-build-deps: $(2)

$(1): $(2)
	+$(MAKE_REC) $(1)-no-deps

$(1)-no-deps:
	$(AM_V_at)sage-logger -p 'sage --pip install -r "$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt"' '$$(SAGE_LOGS)/$(1).log'

$(1)-clean:
	-sage --pip uninstall --isolated --yes --no-input -r '$$(SAGE_ROOT)/build/pkgs/$(1)/requirements.txt'

.PHONY: $(1) $(1)-clean $(1)-build-deps $(1)-no-deps
endef

$(foreach pkgname,$(PIP_PACKAGES),\
	$(eval $(call PIP_PACKAGE_templ,$(pkgname),$(call pkg_deps,$(pkgname)))))

ifdef DEBUG_RULES
$(info # Rules for pip packages)
$(foreach pkgname,$(PIP_PACKAGES),\
	$(info $(call PIP_PACKAGE_templ,$(pkgname),$(call pkg_deps,$(pkgname)))))
endif

# ============================= script packages ==============================
# Generate build rules for 'script' packages; this template is used to generate
# three rules in the form:
#
# $(INST)/<pkgname>-<pkgvers>: <dependencies>
#     $(AM_V_at)cd '$SAGE_ROOT' && \\
#         . '$SAGE_ROOT/src/bin/sage-env-config' && \\
#         . '$SAGE_ROOT/src/bin/sage-env' && \\
#         . '$SAGE_ROOT/build/bin/sage-build-env-config' && \\
#         . '$SAGE_ROOT/build/bin/sage-build-env' && \\
#         sage-logger -p '$SAGE_ROOT/build/pkgs/<pkgname>/spkg-install' '$(SAGE_LOGS)/<pkgname>.log'
#
# <pkgname>: $(INST)/<pkgname>-<pkgvers>
#
# <pkgname>-clean:
#     -$(AM_V_at)cd '$SAGE_ROOT' && \\
#         . '$SAGE_ROOT/src/bin/sage-env-config' && \\
#         . '$SAGE_ROOT/src/bin/sage-env' && \\
#         . '$SAGE_ROOT/build/bin/sage-build-env-config' && \\
#         . '$SAGE_ROOT/build/bin/sage-build-env' && \\
#         '$SAGE_ROOT/build/pkgs/$PKG_NAME/spkg-uninstall'

# Positional arguments:
#     $(1): package name
#     $(2): package version
#     $(3): package dependencies
#     $(4): package tree variable

define SCRIPT_PACKAGE_templ
$(1)-build-deps: $(3)

$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2): $(3)
	+$(MAKE_REC) $(1)-$(4)-no-deps

$(1): $$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)

$(1)-$(4)-no-deps:
	$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
		. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
		. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
		. '$$(SAGE_ROOT)/src/bin/sage-env' && \
		. '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
		. '$$(SAGE_ROOT)/build/bin/sage-build-env' && \
		SAGE_SPKG_WHEELS=$$($(4))/var/lib/sage/wheels \
		SAGE_INST_LOCAL=$$($(4)) \
		sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' '$$(SAGE_LOGS)/$(1)-$(2).log'
	touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"

$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-uninstall:
	-$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \
		. '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \
		. '$$(SAGE_ROOT)/src/bin/sage-env-config' && \
		. '$$(SAGE_ROOT)/src/bin/sage-env' && \
		. '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \
		. '$$(SAGE_ROOT)/build/bin/sage-build-env' && \
		'$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-uninstall'
	-rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"

$(1)-uninstall: $(1)-$(4)-uninstall

.PHONY: $(1) $(1)-uninstall $(1)-build-deps $(1)-no-deps $(1)-clean
endef

$(foreach pkgname,$(SCRIPT_PACKAGES),\
    $(foreach tree, $(trees_$(pkgname)), \
	$(eval $(call SCRIPT_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname)),$(tree)))))

ifdef DEBUG_RULES
$(info # Rules for script packages)
$(foreach pkgname,$(SCRIPT_PACKAGES),\
    $(foreach tree, $(trees_$(pkgname)), \
	$(info $(call SCRIPT_PACKAGE_templ,$(pkgname),$(vers_$(pkgname)),$(call pkg_deps,$(pkgname)),$(tree)))))
endif

# sagelib depends on this so that its install script is always executed
FORCE:

# Use this target to list common targets of this Makefile (in particular for
# installation with `sage -i`.
list:
	@for pkg in $(SAGE_I_TARGETS) $(NORMAL_PACKAGES) $(PIP_PACKAGES) $(SCRIPT_PACKAGES); do\
		echo $$pkg;\
	done


.PHONY: list
