[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problem with static pattern rules and full path
From: |
Norman Wilson |
Subject: |
RE: Problem with static pattern rules and full path |
Date: |
Fri, 30 Sep 2005 10:22:48 +0100 |
If you are building out of tree - ie you have a separate src_root and
bld_root - then you can say:
$(bld_root)/%.o : $(src_root)/%.o
Where src_root is the root of the source directory hierarchy and
bld_root is the root of a parallel hierarchy for the build products.
This works so long as your targets are expressed as full paths. So say
you're linking a library with a list of .o files. If you specify the
full paths to the .o files make will work out the dependencies to the
.cpp files so long as they are in a corresponding location in the source
tree. To be more explicit, assuming src_root := /src and bld_root :=
/bld, the above rule will match the following:
/bld/foo/bar.o : /src/foo/bar.cpp
/bld/wibble/wah.o : /src/wibble/wah.cpp
etc
This will not work if you want to put all your .o files in the same
directory. However I don't think this is a very good idea anyway.
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Dale King
> Sent: 30 September 2005 04:30
> Cc: address@hidden
> Subject: Re: Problem with static pattern rules and full path
>
> Paul D. Smith wrote:
>
> >%% address@hidden writes:
> >
> > >> >> vpath $(prefix)/%.c ...
> >
> > >> >> where the prefix variable restricts the values to match the
> > >> >> "current" location, whatever that is.
> >
> > dk> That doesn't seem to work either.
> >
> > >> It will definitely work, if you can compute the proper value of
> > >> prefix. Which you may not be able to do, depending on your
> > >> environment.
> >
> > d> # This comes from one directory's included makefile
> > d> objdir := /obj1
> > d> srcs := a.c
> > d> src-dirs := /foo
> >
> > d> # This is the generic rules that cannot be directory specific
> > d> objs := $(addprefix $(objdir)/,$(notdir $(srcs:.c=.o)))
> > d> vpath $(objdir)/%.c $(src-dirs)
> >
> >Er... of course this won't work. The .c file isn't in
> $(objdir), so it
> >will never match the pattern $(objdir)/%.c.
> >
> >You have to use the source directories in the pattern for
> the .c files.
> >
> >
> >The idea is to use a prefix that is "above" the source
> directories. As
> >I said above, depending on your environment this might be
> difficult or
> >even impossible.
> >
> >
> Given the constraints I have already given then, it looks
> like this is
> impossible. I have no clue what the prefix would be because the files
> come from a variable set by the owner of a particular
> directory in the
> tree and can point anywhere (including outside of the tree).
>
> I'll go back to evaluating replacing make with scons, now.
>
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>
>
=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the
intended addressee(s). Unauthorised reproduction, disclosure, modification,
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message do not
necessarily reflect those of Atos Euronext Market Solutions.
L'information contenue dans cet e-mail est confidentielle et uniquement
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee.
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail
vous parvient par erreur, nous vous prions de bien vouloir prevenir
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre
systeme. Le contenu de ce message electronique ne represente pas necessairement
la position ou le point de vue d'Atos Euronext Market Solutions.