From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8825 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Support for out-of-tree build Date: Sat, 7 Nov 2015 21:29:20 -0500 Message-ID: <20151108022920.GL3818@brightrain.aerifal.cx> References: <20151107130537.GC8500@port70.net> <20151108004323.GE3818@brightrain.aerifal.cx> <20151108021630.GG8500@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1446949782 17234 80.91.229.3 (8 Nov 2015 02:29:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Nov 2015 02:29:42 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8838-gllmg-musl=m.gmane.org@lists.openwall.com Sun Nov 08 03:29:36 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZvFja-0002XH-WA for gllmg-musl@m.gmane.org; Sun, 08 Nov 2015 03:29:35 +0100 Original-Received: (qmail 11474 invoked by uid 550); 8 Nov 2015 02:29:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11454 invoked from network); 8 Nov 2015 02:29:32 -0000 Content-Disposition: inline In-Reply-To: <20151108021630.GG8500@port70.net> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:8825 Archived-At: On Sun, Nov 08, 2015 at 03:16:30AM +0100, Szabolcs Nagy wrote: > * Rich Felker [2015-11-07 19:43:23 -0500]: > > On Sat, Nov 07, 2015 at 02:05:37PM +0100, Szabolcs Nagy wrote: > > > * Petr Hosek [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