From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8845 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: Support for out-of-tree build Date: Thu, 12 Nov 2015 15:50:26 +0100 Message-ID: <20151112145026.GB18372@port70.net> References: <20151107130537.GC8500@port70.net> <20151108004323.GE3818@brightrain.aerifal.cx> <20151108021630.GG8500@port70.net> <20151108022920.GL3818@brightrain.aerifal.cx> <20151111230848.GZ3818@brightrain.aerifal.cx> 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 1447339852 11338 80.91.229.3 (12 Nov 2015 14:50:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Nov 2015 14:50:52 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8858-gllmg-musl=m.gmane.org@lists.openwall.com Thu Nov 12 15:50:47 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 1ZwtD0-0002C7-Q9 for gllmg-musl@m.gmane.org; Thu, 12 Nov 2015 15:50:43 +0100 Original-Received: (qmail 26049 invoked by uid 550); 12 Nov 2015 14:50:38 -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 26028 invoked from network); 12 Nov 2015 14:50:38 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:8845 Archived-At: * Petr Hosek [2015-11-12 00:28:44 +0000]: > On Wed, Nov 11, 2015 at 3:09 PM Rich Felker wrote: > > On Wed, Nov 11, 2015 at 10:02:50PM +0000, Petr Hosek wrote: > > > MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c > > src/string/memcmp.c src/string/memset.c > > > $(MEMOPS_SRCS:%.c=%.o) $(MEMOPS_SRCS:%.c=%.lo): CFLAGS_ALL += > > $(CFLAGS_MEMOPS) > > > @@ -119,34 +144,35 @@ $(CRT_LIBS:lib/%=crt/%): CFLAGS_ALL += -DCRT > > > # force the corresponding object file to be rebuilt, even if the > > implicit > > > # rule below goes indirectly through a .sub file. > > > define mkasmdep > > > -$(dir $(patsubst %/,%,$(dir $(1))))$(notdir $(1:.s=.o)): $(1) > > > +$(dir $(patsubst $(srcdir)/%/,%,$(dir $(1))))$(notdir $(1:.s=.o)): $(1) > > > +$(dir $(patsubst $(srcdir)/%/,%,$(dir $(1))))$(notdir $(1:.s=.lo)): $(1) > > > endef > > > -$(foreach s,$(wildcard src/*/$(ARCH)*/*.s),$(eval $(call > > mkasmdep,$(s)))) > > > +$(foreach s,$(wildcard $(srcdir)/src/*/$(ARCH)*/*.s),$(eval $(call > > mkasmdep,$(s)))) > > > > Was this missing the dep rules for .lo files? > > > > I'm not sure how this worked before, I was getting build errors without the > explicit dep rule for .lo files. > > > > > -%.o: $(ARCH)$(ASMSUBARCH)/%.sub > > > +$(OBJS_SUB): %.o: > > > $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$(shell cat $<) > > > > > > -%.o: $(ARCH)/%.s > > > +$(OBJS_S): %.o: > > > $(AS_CMD) $(CFLAGS_ALL_STATIC) > > > > > > -%.o: %.c $(GENH) $(IMPH) > > > +$(OBJS_C): %.o: $(srcdir)/%.c $(GENH) $(IMPH) > > > $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $< > > > > > > -%.lo: $(ARCH)$(ASMSUBARCH)/%.sub > > > +$(LOBJS_SUB): %.lo: > > > $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $(dir $<)$(shell cat $<) > > > > > > -%.lo: $(ARCH)/%.s > > > +$(LOBJS_S): %.lo: > > > $(AS_CMD) $(CFLAGS_ALL_SHARED) > > > > > > -%.lo: %.c $(GENH) $(IMPH) > > > +$(LOBJS_C): %.lo: $(srcdir)/%.c $(GENH) $(IMPH) > > > $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $< > > > > I don't understand these rules with two :'s. I assume it's some trick > > I don't yet know. But in the case of the %.s ones, the new rules have > > no %.s in them... this looks wrong, no? > > > > This is bit of hack which uses the static rules. I think we might be able > to get rid of those if we remove the *.sub system as mentioned earlier, but > this is the only way I got it to work without having a per file rule in the > current setup. i'm fine with VPATH + a make time check that in/out is not mixed this second approach is ok if there is some solution for the %.o: %.s rules (i guess AS_CMD only works without %.s because mkasmdeps adds the deps). the .sub approach is not flexible and i don't see an easy way to encode all configury bits in the directory tree (e.g. if we ever want to allow musl to be compiled for sse4, avx, or other more finegrained arch extensions.. maybe .S with #ifdefs for subarch is more flexible)