Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151118001955.GI3818@brightrain.aerifal.cx>
Date: Tue, 17 Nov 2015 19:19:55 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Support for out-of-tree build

On Tue, Nov 17, 2015 at 11:54:23PM +0000, Petr Hosek wrote:
> This'll work if we remove the .sub files as discussed, with .sub files it
> becomes more complicated.

Are you sure? I think the only complicated part for the *.sub files is
the automatic dependency generation to make sure the .o files get
rebuild when the potentially-pointed-to .s files change. Otherwise
they are just like .s files in how they're handled except that you use
`cat $<` in place of $<.

BTW could you refrain from top posting on the list? Even if you just
have a short reply that's in regards to the whole quoted message
rather than specific points to address inline, things get awkward to
follow in a hurry (just like now) when somebody else replies to you
but also wants to keep the quoted content you were replying to as
context (like below).

> On Tue, Nov 17, 2015 at 3:43 PM Rich Felker <dalias@...c.org> wrote:
> 
> > On Tue, Nov 17, 2015 at 06:27:11PM -0500, Rich Felker wrote:
> > > Assuming .o files in arch dirs are ok, does the following work
> > > (non-VPATH)?
> > >
> > > %.o: $(srcdir)/%.sub
> > >       ...
> > > %.o: $(srcdir)/%.s
> > >       ...
> > > %.o: $(srcdir)/%.c
> > >       ...
> > >
> > > (with appropriate commands, of course). If so, I think I like it a
> > > lot, because it factors the rules for file *types* separately from the
> > > rules for which files to select (the "tricky" $(OBJS) setting). The
> > > only big concern is whether this "tricky" setting is too costly in
> > > runtime performance or complexity.
> >
> > Here's my idea for the 'tricky' setting of OBJS and it actually looks
> > very simple and efficient:
> >
> > ARCH_OBJS = $(wildcard ...)
> > BASE_OBJS = $(wildcard ...)
> > OBJS = $(ARCH_OBJS) $(filter-out $(ARCH_OBJS:/$(ARCH)/=/),$(BASE_OBJS))

Discussion on irc, along with some basic testing, showed that this
does not work. The obvious solution with $(subst ...) also does not
work because it's plausible that $(srcdir) also contains the substring
/$(ARCH)/, in which case it would get messed up. However I did find a
form that seems to work reliably and that's not hideous:

$(patsubst %,$(srcdir)/%,$(subst /$(ARCH)/,/,$(patsubst $(srcdir)/%,%,$(ARCH_OBJS))))

That yields the list of object files to filter out, which can then be
passed into $(filter-out ...).

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.