automake
[Top][All Lists]
Advanced

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

Re: builddir vs. srcdir


From: Paul Pogonyshev
Subject: Re: builddir vs. srcdir
Date: Thu, 10 Mar 2005 22:05:51 +0200
User-agent: KMail/1.4.3

> Hi,
>
> On Wed, Mar 09, 2005 at 11:21:35PM +0200, Paul Pogonyshev wrote:
> > > And I'd like to suggest that you use SUFFIXES to handle the .list
> > > source.  Please look at the following example:
> >
> > Well, my generator is even more non-standard, since I need to pass an
> > additional command-line parameter sometimes.  So, `SUFFIXES' are not an
> > option, although I agree it would have been nicer to use them.
>
> well, in the example I cited, I had several .list sources, but only one
> in each directory.  Thus I was able to have different rules in different
> directories.
>
> This is not usable for you, but you can make the .list.h rule general:
>
>       $(PARSE) `case "$*" in *this.list) echo "this options";; \
>       *that.list) echo "that opt";; *) echo "default opt";;esac` $<
>
> ($* is substituted by make)

Well, I also need something like `echo "$*" | sed 's/\.h$/.c/'` (not
tested), so using suffix rules seems like too much trouble.  Besides,
in one directory I have two `.list' files, one of which is processed
by my parser, while the other---by `glib-genmarshal' (I chose my
suffix before I even started with GTK+ GUI.)

> Or you can place the options at the first line of the .list source
> and grep for them.

Then I could just make the parser read them as well.  That might be
a good idea, actually, since these options are more like modes that
are absolutely necessary to be set correctly to parse anything.

> And if your generator creates *.c file after *.h file, you should
> define the dependency:
>       foo.c: foo.h
> and vice versa if the generator creates .h after .c.
> That will make make happy and you won't observe repeated re-generation
> of the .c file.

I'm not sure which one comes first.  They are generated on-the-fly in
parallel (i.e. fprintf's to both files are mixed.)  I assume in this
case I can just do


foo.c : foo.h

foo.c foo.h : ...
        if $(BUILD_THEM_FILES) foo.list foo.h foo.c; then       \
          touch foo.c;                                          \
        else                                                    \
          (rm -f foo.c foo.h; exit 1)                           \
        fi


right?

BTW, I have just built everything in a separate directory for the
first time :)  I need to sort out that parallel building stuff, but
otherwise all works perfectly.  Thanks for your help.

Paul





reply via email to

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