Optimizing directory creation

Heime <[email protected]> Thu, 30 Apr 2026 18:28:21 +0000
Newsgroups gmane.comp.gnu.make.general
Message-ID <lPxkEYA93z9U7o1Um9VFxsaaO067lh-p-ZNllDuv10CUY9RulDUxV6z5_J6CucP0IGeMCWc7ggo1m79tP8DLYYBGSs5vPoMI_QM6BmOHOYs=@protonmail.com>
I made the following makefile, where .info and html files are=20
stored in docs/info and docs/html directories.  Whilst single=20
file antares.pdf and antares.dvi are stored in directory docs.

Have included order-only prerequisite for directories with the=20
rules defined as shown.  Would one rather do something different
for making the directories if they don't exist?

docdir =3D ${HOME}/Opfeld/hist/build/${btnver}/docs
infdir =3D ${HOME}/Opfeld/hist/build/${btnver}/docs/info
hmldir =3D ${HOME}/Opfeld/hist/build/${btnver}/docs/html

srcs =3D ${srcdir}/antares.texi

opts =3D --force --enable-encoding -I ${srcdir}

$(infdir)/antares.info: $(srcs) | $(infdir)
=09makeinfo $(opts) -o $@ $<

$(hmldir)/antares.html: $(srcs) | $(hmldir)
=09makeinfo $(opts) --html -o $@ $<

$(docdir)/antares.pdf: $(srcs) | $(docdir)
=09makeinfo $(opts) --pdf -o $@ $<

$(docdir)/antares.dvi: $(srcs) | $(docdir)
=09makeinfo $(opts) --dvi -o $@ $<

${infdir}: $(docdir)
${hmldir}: ${docdir}
${docdir} ${infdir} ${hmldir}:
=09mkdir -p $@