[Top][All Lists]

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

Re: Create a custom target

From: Ralf Wildenhues
Subject: Re: Create a custom target
Date: Mon, 7 Jul 2008 07:25:29 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Tavian,

please don't top-post, thank you.

* Tavian Barnes wrote on Sun, Jul 06, 2008 at 07:45:23PM CEST:
> On Sun, Jul 6, 2008 at 1:59 AM, Ralf Wildenhues <address@hidden> wrote:
> >
> > Most of the text is copied verbatim into the
> > (and from there into the Makefile).  So if you want to add custom
> > targets, just write plain make rules:
> >
> > bench: prerequisites...
> >        ... compile
> >        ...
> > .PHONY: bench
> Okay, but how do I then get automake to handle the compilation?  I
> don't want to type in the compilation commands myself; that's what
> automake is for.  If I add the benchmarking program to
> noinst_PROGRAMS, it compiles when 'make' is run, rather than only when
> 'make bench' is run.

Ah, ok.  Then you can use something like:

prog_SOURCES = ...
bench: prog$(EXEEXT)
        execute prog$(EXEEXT)...
.PHONY: bench

> Also, when I wrote a custom target in
> bench/, the root makefile didn't seem to notice, and
> running make bench from the root of the project simply gave "make:
> Nothing to be done for `bench'."

Either you look into nonrecursive Makefiles, or you will have to write a
forwarding target, e.g.:

        cd bench && $(MAKE) $(AM_MAKEFLAGS) bench
.PHONY: bench

If you have several of those nonstandard targets you need to forward,
you may want to copy the (slightly more involved) way automake handles
recursive targets.

Hope that helps.


reply via email to

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