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

Commit

Permalink
Have the makefile itself provide a list of the valid targets that can…
Browse files Browse the repository at this point in the history
… be used with sage -i, for example.

Could provide some others as well, though I don't think every conceivable
make target is necessarily useful in this context.
  • Loading branch information
embray committed Apr 5, 2018
1 parent fb9f38a commit a72231b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -150,8 +150,12 @@ install: all
@echo "from https://github.com/sagemath/binary-pkg"
@echo "******************************************************************"

list:
@$(MAKE) build/make/Makefile >&2
@$(MAKE) -s -f build/make/Makefile SAGE_SPKG_INST=local $@

.PHONY: default build install micro_release \
misc-clean bdist-clean distclean bootstrap-clean maintainer-clean \
test check testoptional testall testlong testoptionallong testallong \
ptest ptestoptional ptestall ptestlong ptestoptionallong ptestallong \
buildbot-python3
buildbot-python3 list
12 changes: 11 additions & 1 deletion build/make/Makefile.in
Expand Up @@ -257,6 +257,16 @@ $(foreach pkgname,$(SCRIPT_PACKAGES),\
$(info $(call SCRIPT_PACKAGE_templ,$(pkgname),$(call pkg_deps,$(pkgname)))))
endif


# 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: $(NORMAL_PACKAGES) $(addsuffix -clean,$(NORMAL_PACKAGES)) \
$(PIP_PACKAGES) $(addsuffix -clean,$(PIP_PACKAGES)) \
$(SCRIPT_PACKAGES) $(addsuffix -clean,$(SCRIPT_PACKAGES))
$(SCRIPT_PACKAGES) $(addsuffix -clean,$(SCRIPT_PACKAGES)) \
list
6 changes: 6 additions & 0 deletions build/make/deps
Expand Up @@ -14,8 +14,14 @@ endif
# We need to be able to override this to support ./sage -i -c PKG
SAGE_SPKG = sage-spkg

# 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

STARTED = $(SAGE_LOCAL)/etc/sage-started.txt


# Tell make not to look for files with these names:
.PHONY: all all-sage all-toolchain all-build start \
base toolchain toolchain-deps sagelib \
Expand Down
8 changes: 4 additions & 4 deletions src/bin/sage
Expand Up @@ -351,14 +351,14 @@ if [ "$1" = '-i' ]; then
# (which is a dependency of every package)
$MAKE all-toolchain

ALL_TARGETS="$($MAKE list 2>/dev/null)"

# Now install the packages
for PKG in $PACKAGES; do
echo
# First check that $PKG is actually a Makefile target
# Since https://trac.sagemath.org/ticket/21524 there is not explicitly
# a target for the package, but if it has a vers_<pkgname> variable
# there will also be a generated rule for it
if ! grep "^vers_$PKG = " build/make/Makefile >/dev/null; then
# See https://trac.sagemath.org/ticket/25078
if ! echo $ALL_TARGETS | grep "$PKG" >/dev/null; then
echo >&2 "Error: package '$PKG' not found"
echo >&2 "Note: if it is an old-style package, use -p instead of -i to install it"
exit 1
Expand Down

0 comments on commit a72231b

Please sign in to comment.