Re: make: target-depending prerequisites?

Yves <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization BELNET - The Belgian Research Network
Message-ID <[email protected]>
> 
> 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. If 
one of the depending files is updated, I only want the relevant 
main-documents to be recompiled, and not all of them.

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?

Best regards,
Yves
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.