# src/Makefile.  Generated from Makefile.in by configure.

abs_builddir = /usr/lib/sagemath//src
srcdir = .
abs_top_srcdir = /usr/lib/sagemath/

.PHONY: all sage clean

all: sage

## All sagelib-building is done by setup.py.
## This is so that sagelib can be installed by standard Python procedures,
## such as "./setup.py install" or "pip install ."
## BECAUSE OF THIS, DON'T ADD ADDITIONAL STEPS TO THIS MAKEFILE.

## We poison all environment variables that have paths to the sage source and build directories,
## but keep the directories below SAGE_LOCAL intact.
## In this way we make sure that all of the sagelib build's source paths are communicated through
## the current directory (for the source tree).
## Building takes places in the build/ subdirectory.
## The environment variable SAGE_CYTHONIZED needs to point to build/cythonized.
##
## As a special exception, we feed SAGE_PKGS.  This is needed by src/sage_setup/optional_extension.py
## via src/sage/misc/package.py.  Hoping that #20382 will make this unnecessary.
##
## TODO: Do also something about the SAGE_LOCAL stuff:
##  - some of it (our install) should be communicated only through --install-base;
##  - others (installed packages that we pull in) through some configuration mechanism.
##
## TODO: Currently providing --install-base=$(SAGE_LOCAL) leads to this error:
## [sagelib-7.4.beta4] running install
## [sagelib-7.4.beta4] error: install-base or install-platbase supplied, but installation scheme is incomplete
sage:
	(cd $(srcdir)										\
	 && export SAGE_ROOT=/doesnotexist							\
		   SAGE_SRC=/doesnotexist							\
		   SAGE_SRC_ROOT=/doesnotexist							\
		   SAGE_DOC_SRC=/doesnotexist							\
		   SAGE_SCRIPTS_DIR=/doesnotexist						\
		   SAGE_BUILD_DIR=/doesnotexist							\
		   SAGE_PKGS=$(abs_top_srcdir)/build/pkgs					\
		   SAGE_CYTHONIZED=$(abs_builddir)/build/cythonized				\
	 && python -u setup.py build install)

clean:
	@echo "Deleting Sage library build artifacts..."
	rm -rf c_lib .cython_version # from old sage versions
	rm -rf build
	find . -name '*.pyc' | xargs rm -f
	rm -f sage/libs/pari/auto_*
	rm -rf sage/ext/interpreters
