I’m trying to edit a make file that controls the generation of pdf files form text files (Sphinx, if you are familiar with it). It is currently set up so that there is one make file per document (where you have one source directory and one build directory), but I’d like to tweak the directory structure, and also have just one global makefile that, when the make command is called ‘make latexpdf’, the pdfs are generated for all documents.
I believe this can be done by using some kind of wildcard system when defining the variables, but I’m having trouble with this.
At the moment it’s set up like this: (I’ve included the relevant lines only)
BUILDDIR = builddir
SOURCEDIR = sourcedir
$(SPHINXBUILD) some options $(SOURCEDIR) $(BUILDDIR)/latex
$(MAKE) -C $(BUILDDIR)/latex all-pdf
But to be able to make it go through each subdirectory in source directory, and get it to build into the subdirectories with the same name, I thought I could do something like:
EACHDIR = {"subdir 1","subdir 2"} #This is the line that I need help with.
#subdir refers to each document that I'm making
BUILDDIR = builddir/$(EACHDIR)
SOURCEDIR = sourcedir/$(EACHDIR)
$(SPHINXBUILD) some options $(SOURCEDIR) $(BUILDDIR)/latex
$(MAKE) -C $(BUILDDIR)/latex all-pdf
This isn’t working for me, though. Any guidance would be appreciated.
Thanks
I would do something like this:
This should work (typos notwithstanding).
However, in general you should avoid the recursive calls to Make (see Recursive Make Considered Harmful). Basically, it prevents the top-level Make from tracking the entire dependency tree, which can lead to a sub-optimal build process, and/or inconsistent rebuilds.