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

On Sun, Nov 08, 2015 at 03:16:30AM +0100, Szabolcs Nagy wrote:
> * Rich Felker <dalias@...c.org> [2015-11-07 19:43:23 -0500]:
> > On Sat, Nov 07, 2015 at 02:05:37PM +0100, Szabolcs Nagy wrote:
> > > * Petr Hosek <phosek@...omium.org> [2015-11-06 23:40:48 +0000]:
> > > > +ifneq ($(srcdir),.)
> > > > +VPATH = $(srcdir)
> > > > +$(ALL_TOOLS): tools/.dirstamp
> > > > +$(ALL_LIBS): lib/.dirstamp
> > > > +$(CRT_LIBS:lib/%=crt/%): crt/.dirstamp
> > > > +$(OBJS) $(LOBJS): $(patsubst %/,%/.dirstamp,$(sort $(dir $(OBJS))))
> > > > +$(GENH): arch/$(ARCH)/bits/.dirstamp
> > > > +include/bits: include/.dirstamp
> > > > +src/internal/version.h: src/internal/.dirstamp
> > > > +%/.dirstamp:
> > > > +	mkdir -p $*
> > > > +	touch $@
> > > > +endif
> > > > +
> > > 
> > > i guess this works without the ifneq, just
> > > litters the source dir with .dirstamps in
> > > case of an in-tree build.
> > 
> > What is the motive for having these .dirstamps at all?
> > 
> 
> have to create the directories out-of-tree
> 
> but directories cannot be properr make dependencies
> because make works with file mtime
> 
> ...and directory mtime changes whenever something
> happens in the directory, triggering a rebuild
> all the time

Use | before the dependency to add an order-only dependency (ignores
time as long as the target exists).

> > > > +Configuration:
> > > > +  --srcdir=DIR            source directory [detected]
> > > > +
> > 
> > Does this match standard configure behavior?
> > 
> 
> i think so, official configure help is:
> 
> http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=lib/autoconf/general.m4;h=a7f143960de44182a0139f9ab302fd652aaebc32;hb=HEAD#l1033

Actually the source I'm using for the "API" (or maybe this is a "UI"?)
is the GNU Coding Standard. Not a document I like by any means, but it
does have a good implementation-agnostic spec for how configure should
work.

> > > > +# Get the musl source dir for out-of-tree builds
> > > > +#
> > > > +if test -z "$srcdir" ; then
> > > > +srcdir="${0%/configure}"
> > > > +stripdir srcdir
> > > > +fi
> > > > +abs_builddir="$(pwd)" || fail "$0: cannot determine working directory"
> > > > +abs_srcdir="$(cd $srcdir && pwd)" || fail "$0: invalid source directory $srcdir"
> > > > +test "$abs_srcdir" = "$abs_builddir" && srcdir=.
> > > > +ln -sf $srcdir/Makefile .
> > 
> > Is it possible to get a relative path for the srcdir rather than an
> > absolute one here? I really don't like configurations that are not
> > relocatable in the filesystem.
> 
> srcdir is whatever the user used for configure,
> the abs path is only used to make sure we are
> out-of-tree.
> 
> so building with ../musl/configure the srcdir is
> .../musl, i guess it ends up in the debug info,
> to avoid that more complex setup is necessary
> i think

Ah, I see. That's probably fine unless there's some better way
matching inodes that would be portable.

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.