There are some things we can try, and then depending on what works, we may be able to add native support for this in the makefile.
In your Makefile.ini, you might try doing something like this (make sure to use tabs instead of leading spaces):
# make tex files depend on running docstrip - the cookie might
# not be necessary, but it makes it easy to see what's happening.
file1.tex: docstrip.cookie
file2.tex: docstrip.cookie
file3.tex: docstrip.cookie
# The cookie file is generated by a run of latex on the dtx file, which also has the other side effects above.
docstrip.cookie: mydocstripfile.dtx
latex mydocstripfile.dtx && touch docstrip.cookie
# Add clean-docstrip as a clean dependency, so that running "make clean" will also run "make clean-docstrip"
clean: clean-docstrip
# Add the clean-docstrip rule that actually removes the cookie file.
# Note that we should probably remove file?.tex as well, but I don't do that here for safety in this test.
.PHONY: clean-docstrip
clean-docstrip:
rm docstrip.cookie
Now, that should work just fine. Regarding the .tex.sh approach, that should *also* work... I would need a little more detail on how you are using docstrip to give you a good recommendation there, but I'm pretty sure we can do that.
The disadvantage of using the .tex.sh approach is that there is no dependency detection done, so a change to your .dtx will not automatically trigger a rebuild of the .tex files. I get around that by *always* building the .tex files, but that means you lose some of the benefit of the makefile in the first place: incremental builds. So, it's a tradeoff at the moment. We may very well come up with a good solution for this, though.