Re: make: target-depending prerequisites?
Henrik Carlqvist <[email protected]>
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | SunSITE.dk - Supporting Open source |
| Message-ID | <[email protected]> |
Yves <[email protected]> wrote: >> But maybe you have some other reason to have your variable main_depend not >> shown in your example? > > The main reason for trying to do what I am trying to do is the situation > where I have multiple main-documents, each with its own dependencies. Again, do you really need those variables? > If one of the depending files is updated, I only want the relevant > main-documents to be recompiled, and not all of them. Thats what make is good for. > The following solution does the job, however, this means duplication of > the commands inside the main1.pdf and main2.pdf block. My intent was > thus to try to avoid this and parametrize into a single %.pdf block. > > -8<----------------------------------------- > texfiles = main1.tex main2.tex > > main1_depend = section1.tex section3.tex > main2_depend = section2.tex section1.tex > > all_pdf = $(texfiles:.tex=.pdf) > > all: $(all_pdf) > > main1.pdf: main1.tex $(main1_depend) > @echo "All prerequisites:" $^ > touch $@ > > main2.pdf: main2.tex $(main2_depend) > @echo "All prerequisites:" $^ > touch $@ > -8<----------------------------------------- > > Maybe there exist better solutions to achieve the desired effect? I think it would be a cleaner solution if you skipped those variables and instead wrote something like this: -8<----------------------------------------- texfiles = main1.tex main2.tex all_pdf = $(texfiles:.tex=.pdf) all: $(all_pdf) main1.pdf: section1.tex section3.tex main2.pdf: section2.tex section1.tex $(all_pdf): main%.pdf: main%.tex @echo "All prerequisites:" $^ touch $@ -8<----------------------------------------- regards Henrik -- The address in the header is only to prevent spam. My real address is: hc3(at)poolhem.se Examples of addresses which go to spammers: root@localhost postmaster@localhost