[Top][All Lists]

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

Re: builddir vs. srcdir

From: Stepan Kasal
Subject: Re: builddir vs. srcdir
Date: Fri, 11 Mar 2005 09:29:35 +0100
User-agent: Mutt/1.4.1i


On Thu, Mar 10, 2005 at 10:05:51PM +0200, Paul Pogonyshev wrote:
> I'm not sure which one comes first. [...] 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?

Correct, of course.

About the side topic of suffixes:

> Well, I also need something like `echo "$*" | sed 's/\.h$/.c/'`

No, $* is the base without the suffix.

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

One option is to change the suffix for your parser, of course.

Or you could do something like:
LIST_H_CMDS = if $(BUILD_THEM_FILES) $*.list $*.h $*.c; then    \
          touch $*.c;                                           \
        else                                                    \
          (rm -f $*.c $*.h; exit 1)                             \
BUILD_THEM_FILES = case $* in \
        *marshal*) $(GENMARSHAL_CMD) $*.list ...  ;; \
        *) $(PARSE) $*.list ... ;; \

All the variables in the commands, are expanded just before execution,
so the usage of $* ``outside of a rule'' is correct here.

But when I recall that all this is done just to be able to do

xx_SOURCES = foo.list ...

intead of

xx_SOURCES = ...
nodist_xx_SOURCES = foo.c
EXTRA_DIST = foo.list

then I agree it's not worth it.
(Setting CLEANFILES = foo.c foo.h; BUILT_SOURCES = foo.h is necessary
in both cases.)

Have a nice day,

reply via email to

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