[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make: target-depending prerequisites?

From: Yves
Subject: make: target-depending prerequisites?
Date: Thu, 22 May 2008 12:29:27 +0200
User-agent: Thunderbird (X11/20080505)


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!

<-- 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 --->

reply via email to

[Prev in Thread] Current Thread [Next in Thread]