Re: Optimizing directory creation
Tim Murphy <[email protected]> Thu, 30 Apr 2026 19:58:57 +0100
| Newsgroups | gmane.comp.gnu.make.general |
|---|---|
| Message-ID | <CACJSg6=ERHBBw2qMMmhX6vvaD+oxBt8aAQXpqGV3QHQrGHwfgQ@mail.gmail.com> |
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=C4=B1d=C4=B1r on anything below it. Does this matter a lo= t? Not really in this case. 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=C4=B1r -p ... ) on batches of about 20 directories at = a time. If you're not making 100s of directories you don't need to be too sophisticated. 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 =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) > 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 $@ > > > > > >