]> gitweb.michael.orlitzky.com - mjotex.git/commitdiff
GNUmakefile.mjo: store converted sage listings under $(BUILDDIR)
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 26 Feb 2026 00:50:34 +0000 (19:50 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 26 Feb 2026 01:27:54 +0000 (20:27 -0500)
GNUmakefile.mjo

index c13e7d38d6ac62123010b3836f2276422dd2b49c..c284273d2efed7bbcbac6dfa42c0f0eea1e4b722 100644 (file)
@@ -19,7 +19,7 @@ PN ?= $(patsubst %.git,%,$(notdir $(realpath .)))
 # MJOTEX  = mjotex.sty
 
 # Compile a list of raw source code listings (*.listing) and their
-# associated output files (*.py) that will be tested by check-sage.
+# associated output files (*.sage.py) that will be tested by check-sage.
 #
 # SAGE_LISTING_SRCS = $(wildcard sage_listings/*.listing)
 
@@ -73,7 +73,9 @@ MJOTEXPATHS = $(shell kpsewhich $(MJOTEX))
 SRCS += $(MJOTEXPATHS)
 endif
 ifdef SAGE_LISTING_SRCS
-SAGE_LISTING_DSTS = $(patsubst %.listing,%.py,$(SAGE_LISTING_SRCS))
+SAGE_LISTING_DSTS = $(patsubst %.listing,\
+                               $(BUILDDIR)/%.sage.py,\
+                               $(SAGE_LISTING_SRCS))
 SRCS += $(SAGE_LISTING_DSTS)
 endif
 
@@ -175,8 +177,11 @@ $(BUILDDIR)/$(PN).log: $(SRCS)
 # How do we convert a raw listing into something testable by sage? We
 # append/prepend triple quotes to make the whole thing into a doctest,
 # strip all comment lines (only outside of a sage: prompt), and then
-# we replace any blank lines by "<BLANKLINE>".
-sage_listings/%.py: sage_listings/%.listing
+# we replace any blank lines by "<BLANKLINE>". The "mkdir -p" is there
+# so that we can organize our *.listing files into subdirectories
+# without messing up the build.
+$(BUILDDIR)/%.sage.py: %.listing
+       mkdir -p $$(dirname "$@")
        echo '"""' > $@
        cat $< >> $@
        echo '"""' >> $@