On Mon, 2011-05-30 at 15:50 +0000, Greg Chicares wrote:
> Chapter%:
>         pdflatex $*
>         bibtex $*.bib

You want $@ not $* I believe (Anja: see the GNU make manual section on
automatic variables).

You can't think of a makefile like a programming language, where the
rules are subroutines that are called from other subroutines with
arguments, etc.

A makefile is a database of rules that can be used to build individual
targets.  make itself has the logic to decide which rules are invoked in
which order: you don't explicitly define the flow of what is invoked.
So there's no real concept of "calling one rule from another rule".
Rather you defined the dependency relationships, and make runs things in
the right order by itself.


GNU make has a concept of "pattern rules", which Greg uses above, that
lets you define a template of commands that can be used to build any
target that matches the pattern.  That sounds kind of like what you
want.

Using $(call ....) is a way to go as well but that's not really taking
advantage of make's strengths and conceptual model.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[email protected]>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist


_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to