make: target-depending prerequisites?
Yves <[email protected]>
| Newsgroups | gmane.comp.gnu.utils |
|---|---|
| Organization | BELNET - The Belgian Research Network |
| Message-ID | <[email protected]> |
Hi, I am trying to make the prerequisites of a target depend on the current target by taking into account the current value of %. In the example below, I have a main (tex) file, with dependencies on a number of included files. These dependencies are indicated in variables with the name of the main file, with '_depend' appended to them. My strategy is then to create a variable DEPEND, depending on %.pdf, which contains the name of the variable that contains these dependencies, and use this variable in the prerequisites. Unfortunately, this does not seem to work: $($(DEPEND)) does contain the right dependency, yet it does not seem to be present in the prerequisites. As a result, 'touching' the dependency does not trigger a rebuild when I run make for the second time. What might I be going wrong and/or is what I want to do even possible? Many thanks! Yves <-- Makefile --> texfiles = main.tex main_depend = section1.tex all_pdf = $(texfiles:.tex=.pdf) all: $(all_pdf) %.pdf: DEPEND = $(@:.pdf=)_depend %.pdf: %.tex $($(DEPEND)) @echo "Extra dependencies:" $($(DEPEND)) @echo "All prerequisites:" $^ touch $@ touch $($(DEPEND)) <-- end Makefile --->