On Friday, May 1st, 2026 at 6:59 AM, Tim Murphy <[email protected]> wrote:
> Hi,
>
> I did have a reason, which wasn't tied up with GNU make. Trying to explain
> wont help you but there is a other way.
>
> One problem with directories is that their time and date change when anything
> is done on the directory e.g. if a new file is created. I think you might
> need to check that adding a file to one of your directories doesn't trigger
> mıdır on anything below it. Does this matter a lot? Not really in this case.
You recommond a variation to this:
${infdir}: $(docdir)
${hmldir}: ${docdir}
${docdir} ${infdir} ${hmldir}:
mkdir -p $@
> In my unusual situation it causes a very bad performance regression so I had
> to use another scheme.
>
> What was effective for me was a variable that one appended the directory to
> and then at the end of the makefile a for loop that ran something like $(eval
> $$(shell mkdır -p ... ) on batches of about 20 directories at a time.
Right. Followed by the rules to make your targets after making the directories
present in the variable.
> If you're not making 100s of directories you don't need to be too
> sophisticated.
I will only have a few directories. Nothing more.
> Best regards,
>
> Tim Murphy
>
>
> On Thu, 30 Apr 2026, 19:29 Heime, <[email protected]> wrote:
>
> >
> > I made the following makefile, where .info and html files are
> > stored in docs/info and docs/html directories. Whilst single
> > file antares.pdf and antares.dvi are stored in directory docs.
> >
> > Have included order-only prerequisite for directories with the
> > rules defined as shown. Would one rather do something different
> > for making the directories if they don't exist?
> >
> > docdir = ${HOME}/Opfeld/hist/build/${btnver}/docs
> > infdir = ${HOME}/Opfeld/hist/build/${btnver}/docs/info
> > hmldir = ${HOME}/Opfeld/hist/build/${btnver}/docs/html
> >
> > srcs = ${srcdir}/antares.texi
> >
> > opts = --force --enable-encoding -I ${srcdir}
> >
> > $(infdir)/antares.info: $(srcs) | $(infdir)
> > makeinfo $(opts) -o $@ $<
> >
> > $(hmldir)/antares.html: $(srcs) | $(hmldir)
> > makeinfo $(opts) --html -o $@ $<
> >
> > $(docdir)/antares.pdf: $(srcs) | $(docdir)
> > makeinfo $(opts) --pdf -o $@ $<
> >
> > $(docdir)/antares.dvi: $(srcs) | $(docdir)
> > makeinfo $(opts) --dvi -o $@ $<
> >
> > ${infdir}: $(docdir)
> > ${hmldir}: ${docdir}
> > ${docdir} ${infdir} ${hmldir}:
> > mkdir -p $@