Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
trac 29310: move various ...-clean targets to top-level Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpalmieri committed Oct 29, 2021
1 parent 056b8d4 commit c7cfd31
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 39 deletions.
42 changes: 41 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,45 @@ dist: build/make/Makefile
ssl: all
./sage -i pyopenssl

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

SAGE_ROOT ?= $(shell pwd)
SAGE_SRC ?= $(SAGE_ROOT)/src

clean:
@echo "Deleting package build directories..."
if [ -x "$(SAGE_SRC)"/bin/sage-env-config ]; then \
. "$(SAGE_SRC)"/bin/sage-env-config; \
rm -rf "$(SAGE_LOCAL)/var/tmp/sage/build"; \
fi

# "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..."
if [ -d "$(SAGE_SRC)" ]; then \
(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); \
fi

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

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

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

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

# Deleting src/lib is to get rid of src/lib/pkgconfig
# that was forgotten to clean in #29082.
misc-clean:
Expand Down Expand Up @@ -276,4 +315,5 @@ list:
misc-clean bdist-clean distclean bootstrap-clean maintainer-clean \
test check testoptional testall testlong testoptionallong testallong \
ptest ptestoptional ptestall ptestlong ptestoptionallong ptestallong \
buildbot-python3 list
buildbot-python3 list \
doc-clean clean sagelib-clean build-clean
41 changes: 3 additions & 38 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ SAGE_I_TARGETS = sagelib doc
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
doc-uninstall \
python3_venv _clean-broken-gcc

PYTHON_FOR_VENV = @PYTHON_FOR_VENV@

Expand Down Expand Up @@ -347,43 +347,9 @@ 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:
doc-uninstall:
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)

sage_setup-clean:
(cd "$(SAGE_ROOT)/build/pkgs/sage_setup/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
Expand All @@ -397,7 +363,6 @@ _clean-broken-gcc:
rm -f "$(SAGE_ROOT)/build/make/.clean-broken-gcc"; \
echo "Cleaned up old broken GCC install"; \
fi

#==============================================================================
# Setting SAGE_CHECK... variables
#==============================================================================
Expand Down

0 comments on commit c7cfd31

Please sign in to comment.