mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 1/3] makefile: add silent rules
@ 2012-08-16 16:18 Luca Barbato
  2012-08-16 16:18 ` [PATCH 2/3] cosmetic: remove trailing whitespace Luca Barbato
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Luca Barbato @ 2012-08-16 16:18 UTC (permalink / raw)
  To: musl

make V=0 to enable them
---

I forgot to resend it long ago once fixed, sorry

 Makefile |   62 ++++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index 683850d..fa44829 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,8 @@ CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED -O3
 
 AR      = $(CROSS_COMPILE)ar
 RANLIB  = $(CROSS_COMPILE)ranlib
+INSTALL = install
+LN      = ln -sf
 
 ALL_INCLUDES = $(sort $(wildcard include/*.h include/*/*.h) $(GENH))
 
@@ -48,6 +50,22 @@ TOOL_LIBS = lib/musl-gcc.specs
 ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
 ALL_TOOLS = tools/musl-gcc
 
+V ?= 1
+
+ifeq ($(strip $(V)), 0)
+Q      = @
+ECHO   = printf "$(1)\t%s\n" $(2)
+BRIEF  = CC AS AR LD HOSTCC SH LN
+SILENT = DEPCC RM RANLIB
+MSG    = $@
+M      = @$(call ECHO,$(TAG),$@);
+$(foreach VAR,$(BRIEF), \
+    $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
+$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
+$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
+endif
+
+
 LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
 
 -include config.mak
@@ -57,25 +75,25 @@ all: $(ALL_LIBS) $(ALL_TOOLS)
 install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
 
 clean:
-	rm -f crt/*.o
-	rm -f $(OBJS)
-	rm -f $(LOBJS)
-	rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so
-	rm -f $(ALL_TOOLS)
-	rm -f $(GENH) 
-	rm -f include/bits
+	$(RM) crt/*.o
+	$(RM) $(OBJS)
+	$(RM) $(LOBJS)
+	$(RM) $(ALL_LIBS) lib/*.[ao] lib/*.so
+	$(RM) $(ALL_TOOLS)
+	$(RM) $(GENH)
+	$(RM) include/bits
 
 distclean: clean
-	rm -f config.mak
+	$(RM) config.mak
 
 include/bits:
 	@test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
-	ln -sf ../arch/$(ARCH)/bits $@
+	$(Q)ln -sf ../arch/$(ARCH)/bits $@
 
 include/bits/alltypes.h.sh: include/bits
 
 include/bits/alltypes.h: include/bits/alltypes.h.sh
-	sh $< > $@
+	$(Q)sh $< > $@
 
 src/ldso/dynlink.lo: arch/$(ARCH)/reloc.h
 
@@ -97,41 +115,41 @@ lib/libc.so: $(LOBJS)
 	-Wl,-soname=libc.so -o $@ $(LOBJS) $(LIBCC)
 
 lib/libc.a: $(OBJS)
-	rm -f $@
+	$(RM) $@
 	$(AR) rc $@ $(OBJS)
 	$(RANLIB) $@
 
 $(EMPTY_LIBS):
-	rm -f $@
+	$(RM) $@
 	$(AR) rc $@
 
 lib/%.o: crt/%.o
-	cp $< $@
+	$(Q)cp $< $@
 
 lib/musl-gcc.specs: tools/musl-gcc.specs.sh config.mak
-	sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
+	$(Q)sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
 
 tools/musl-gcc: config.mak
-	printf '#!/bin/sh\nexec gcc "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
-	chmod +x $@
+	$(Q)printf '#!/bin/sh\nexec gcc "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
+	$(Q)chmod +x $@
 
 $(DESTDIR)$(bindir)/%: tools/%
-	install -D $< $@
+	$(INSTALL) -D $< $@
 
 $(DESTDIR)$(libdir)/%.so: lib/%.so
-	install -D -m 755 $< $@
+	$(INSTALL) -D -m 755 $< $@
 
 $(DESTDIR)$(libdir)/%: lib/%
-	install -D -m 644 $< $@
+	$(INSTALL) -D -m 644 $< $@
 
 $(DESTDIR)$(includedir)/%: include/%
-	install -D -m 644 $< $@
+	$(INSTALL) -D -m 644 $< $@
 
 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(syslibdir)
-	ln -sf $(libdir)/libc.so $@ || true
+	$(LN) $(libdir)/libc.so $@ || true
 
 $(DESTDIR)$(syslibdir):
-	install -d -m 755 $(DESTDIR)$(syslibdir)
+	$(INSTALL) -d -m 755 $(DESTDIR)$(syslibdir)
 
 .PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
 
-- 
1.7.8.rc1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/3] cosmetic: remove trailing whitespace
  2012-08-16 16:18 [PATCH 1/3] makefile: add silent rules Luca Barbato
@ 2012-08-16 16:18 ` Luca Barbato
  2012-08-16 16:18 ` [PATCH 3/3] makefile: split install target Luca Barbato
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Luca Barbato @ 2012-08-16 16:18 UTC (permalink / raw)
  To: musl

---

Just rebased 

 Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fa44829..9d43559 100644
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,11 @@ LOBJS = $(OBJS:.o=.lo)
 GENH = include/bits/alltypes.h
 IMPH = src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h
 
-LDFLAGS = 
+LDFLAGS =
 LIBCC = -lgcc
 CPPFLAGS =
 CFLAGS = -Os -pipe
-CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc 
+CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
 
 CFLAGS_ALL = $(CFLAGS_C99FSE)
 CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I./arch/$(ARCH) -I./src/internal -I./include
-- 
1.7.8.rc1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3] makefile: split install target
  2012-08-16 16:18 [PATCH 1/3] makefile: add silent rules Luca Barbato
  2012-08-16 16:18 ` [PATCH 2/3] cosmetic: remove trailing whitespace Luca Barbato
@ 2012-08-16 16:18 ` Luca Barbato
  2012-08-17 23:33   ` Rich Felker
  2012-08-16 16:51 ` [PATCH 1/3] makefile: add silent rules orc
  2012-08-16 23:03 ` idunham
  3 siblings, 1 reply; 11+ messages in thread
From: Luca Barbato @ 2012-08-16 16:18 UTC (permalink / raw)
  To: musl

Introduce install-headers, install-libs, install-tools
---
 Makefile |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 9d43559..6beb42c 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
 
 all: $(ALL_LIBS) $(ALL_TOOLS)
 
-install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+install: install-libs install-headers install-tools
 
 clean:
 	$(RM) crt/*.o
@@ -151,6 +151,14 @@ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(syslibdir)
 $(DESTDIR)$(syslibdir):
 	$(INSTALL) -d -m 755 $(DESTDIR)$(syslibdir)
 
+install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+
+install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
+
+install-tools: $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%)
+
+
+
 .PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
 
-.PHONY: all clean install
+.PHONY: all clean install install-libs install-headers install-tools
-- 
1.7.8.rc1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] makefile: add silent rules
  2012-08-16 16:18 [PATCH 1/3] makefile: add silent rules Luca Barbato
  2012-08-16 16:18 ` [PATCH 2/3] cosmetic: remove trailing whitespace Luca Barbato
  2012-08-16 16:18 ` [PATCH 3/3] makefile: split install target Luca Barbato
@ 2012-08-16 16:51 ` orc
  2012-08-16 17:05   ` Luca Barbato
  2012-08-16 23:03 ` idunham
  3 siblings, 1 reply; 11+ messages in thread
From: orc @ 2012-08-16 16:51 UTC (permalink / raw)
  To: musl

> add silent rules

wow. This one already was discussed... 2 times or more?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] makefile: add silent rules
  2012-08-16 16:51 ` [PATCH 1/3] makefile: add silent rules orc
@ 2012-08-16 17:05   ` Luca Barbato
  0 siblings, 0 replies; 11+ messages in thread
From: Luca Barbato @ 2012-08-16 17:05 UTC (permalink / raw)
  To: musl

On 08/16/2012 06:51 PM, orc wrote:
>> add silent rules
> 
> wow. This one already was discussed... 2 times or more?
> 

Yes and the agreement was to add them default off.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] makefile: add silent rules
  2012-08-16 16:18 [PATCH 1/3] makefile: add silent rules Luca Barbato
                   ` (2 preceding siblings ...)
  2012-08-16 16:51 ` [PATCH 1/3] makefile: add silent rules orc
@ 2012-08-16 23:03 ` idunham
  2012-08-16 23:06   ` Gregor Richards
  2012-08-17  0:10   ` Luca Barbato
  3 siblings, 2 replies; 11+ messages in thread
From: idunham @ 2012-08-16 23:03 UTC (permalink / raw)
  To: musl

> make V=0 to enable them
> ---
Remind me what the _benefit_ is?
I remember there were several advantages to standard full output, so the
verdict was that *if* they're added, they get disabled by default.
While this patch does respect that, I'd like to know whether there's a
better reason for the added ugliness than "Some folks don't like to see
what's happening"...

Also, I note that you're also making a couple other changes: RM, LN, and
INSTALL...
Last time, Rich said he didn't see a reason to use $(RM), since rm is
POSIX. Same can be said of ln/$(LN).
install appears (per man 1p) to not be POSIX, but is fairly widespread. I
can see this helping with the occasional broken version of install.

Patch 3/3 is the most valuable part of the series, I think.
I can see merging that, and patch 2/3 is trivial.

> +LN      = ln -sf
>  ALL_INCLUDES = $(sort $(wildcard include/*.h include/*/*.h) $(GENH))

> +V ?= 1
> +
> +ifeq ($(strip $(V)), 0)
> +Q      = @
> +ECHO   = printf "$(1)\t%s\n" $(2)
> +BRIEF  = CC AS AR LD HOSTCC SH LN
> +SILENT = DEPCC RM RANLIB
> +MSG    = $@
> +M      = @$(call ECHO,$(TAG),$@);
> +$(foreach VAR,$(BRIEF), \
> +    $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
> +$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
> +$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL))
> +endif

>  -include config.mak
Umm.... Is this an accident?

>  clean:
> -	rm -f crt/*.o
> -	rm -f $(OBJS)
> -	rm -f $(LOBJS)
> -	rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so
> -	rm -f $(ALL_TOOLS)
> -	rm -f $(GENH)
> -	rm -f include/bits
> +	$(RM) crt/*.o
> +	$(RM) $(OBJS)
> +	$(RM) $(LOBJS)
> +	$(RM) $(ALL_LIBS) lib/*.[ao] lib/*.so
> +	$(RM) $(ALL_TOOLS)
> +	$(RM) $(GENH)
> +	$(RM) include/bits
Axe this part (see above)
>  distclean: clean
> -	rm -f config.mak
> +	$(RM) config.mak

> -	ln -sf $(libdir)/libc.so $@ || true
> +	$(LN) $(libdir)/libc.so $@ || true
See above.
>  $(DESTDIR)$(syslibdir):
> -	install -d -m 755 $(DESTDIR)$(syslibdir)
> +	$(INSTALL) -d -m 755 $(DESTDIR)$(syslibdir)





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] makefile: add silent rules
  2012-08-16 23:03 ` idunham
@ 2012-08-16 23:06   ` Gregor Richards
  2012-08-17  0:10   ` Luca Barbato
  1 sibling, 0 replies; 11+ messages in thread
From: Gregor Richards @ 2012-08-16 23:06 UTC (permalink / raw)
  To: musl

On 08/16/2012 07:03 PM, idunham@lavabit.com wrote:
> I can see this helping with the occasional broken version of install.

I actually had to use a similar patch for an odd port of musl. install 
isn't POSIX, and install -D isn't universal, so make INSTALL=ginstall is 
very helpful. But I have no statement on the value of the rest of this 
patch just for INSTALL.

With valediction,
  - Gregor Richards



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] makefile: add silent rules
  2012-08-16 23:03 ` idunham
  2012-08-16 23:06   ` Gregor Richards
@ 2012-08-17  0:10   ` Luca Barbato
  2012-08-17  1:21     ` Rich Felker
  1 sibling, 1 reply; 11+ messages in thread
From: Luca Barbato @ 2012-08-17  0:10 UTC (permalink / raw)
  To: musl

On 08/17/2012 01:03 AM, idunham@lavabit.com wrote:
>> make V=0 to enable them
>> ---
> Remind me what the _benefit_ is?

An in between make -s and normal make.

> I remember there were several advantages to standard full output, so the
> verdict was that *if* they're added, they get disabled by default.

It is disabled by default.

> While this patch does respect that, I'd like to know whether there's a
> better reason for the added ugliness than "Some folks don't like to see
> what's happening"...

It is faster, you see the warnings w/out useless clutter. You do not
care about seeing what the clean target is doing most of the times and such.

> Also, I note that you're also making a couple other changes: RM, LN, and
> INSTALL...
> Last time, Rich said he didn't see a reason to use $(RM), since rm is
> POSIX. Same can be said of ln/$(LN).
> install appears (per man 1p) to not be POSIX, but is fairly widespread. I
> can see this helping with the occasional broken version of install.

It is used for the quiet machinery

> Patch 3/3 is the most valuable part of the series, I think.
> I can see merging that, and patch 2/3 is trivial.

Indeed, but since I did the work and since at least for few people is
useful I tried to rebase it.

>>  -include config.mak
> Umm.... Is this an accident?

Uhm? " -include config.mak" is just that line, see the leading space.

> Axe this part (see above)
> See above.

It is part of the quiet rule.

lu


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] makefile: add silent rules
  2012-08-17  0:10   ` Luca Barbato
@ 2012-08-17  1:21     ` Rich Felker
  0 siblings, 0 replies; 11+ messages in thread
From: Rich Felker @ 2012-08-17  1:21 UTC (permalink / raw)
  To: musl

On Fri, Aug 17, 2012 at 02:10:36AM +0200, Luca Barbato wrote:
> > I remember there were several advantages to standard full output, so the
> > verdict was that *if* they're added, they get disabled by default.
> 
> It is disabled by default.

There was never any agreement to add this stuff, just a consensus
that, if it does get added despite the overwhelming opinions against
it, it be off-by-default.

> > While this patch does respect that, I'd like to know whether there's a
> > better reason for the added ugliness than "Some folks don't like to see
> > what's happening"...
> 
> It is faster, you see the warnings w/out useless clutter. You do not
> care about seeing what the clean target is doing most of the times and such.

The speed issue is the only somewhat compelling one; musl's build does
take several times longer on slow terminals merely because the
terminal sucks. It's really sad when it takes more time to display 2-3
lines of text than to compile and assemble a whole .c file...

> > Patch 3/3 is the most valuable part of the series, I think.
> > I can see merging that, and patch 2/3 is trivial.
> 
> Indeed, but since I did the work and since at least for few people is
> useful I tried to rebase it.

I'm still undecided. My leaning is towards simplicity in the build
system. This sort of feature really belongs in make itself, not
re-implemented in every makefile (i.e. make could just print something
like "$< -> $@" for every rule it runs and suppress the printing of
the commands).

Rich


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] makefile: split install target
  2012-08-16 16:18 ` [PATCH 3/3] makefile: split install target Luca Barbato
@ 2012-08-17 23:33   ` Rich Felker
  0 siblings, 0 replies; 11+ messages in thread
From: Rich Felker @ 2012-08-17 23:33 UTC (permalink / raw)
  To: musl

On Thu, Aug 16, 2012 at 06:18:07PM +0200, Luca Barbato wrote:
> Introduce install-headers, install-libs, install-tools

No objection to this; committed.

Rich


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3] makefile: split install target
  2012-06-13  5:22 Build system tweaks Luca Barbato
@ 2012-06-13  5:22 ` Luca Barbato
  0 siblings, 0 replies; 11+ messages in thread
From: Luca Barbato @ 2012-06-13  5:22 UTC (permalink / raw)
  To: musl

Introduce install-headers, install-libs, install-tools
---
 Makefile |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 4bc1b63..0c2b0d5 100644
--- a/Makefile
+++ b/Makefile
@@ -69,7 +69,7 @@ LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
 
 all: $(ALL_LIBS) $(ALL_TOOLS)
 
-install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+install: install-libs install-headers install-tools
 
 clean:
 	$(RM) crt/*.o
@@ -146,6 +146,14 @@ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(syslibdir)
 $(DESTDIR)$(syslibdir):
 	$(INSTALL) -d -m 755 $(DESTDIR)$(syslibdir)
 
+install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+
+install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
+
+install-tools: $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%)
+
+
+
 .PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
 
-.PHONY: all clean install
+.PHONY: all clean install install-libs install-headers install-tools
-- 
1.7.8.rc1



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-08-17 23:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-16 16:18 [PATCH 1/3] makefile: add silent rules Luca Barbato
2012-08-16 16:18 ` [PATCH 2/3] cosmetic: remove trailing whitespace Luca Barbato
2012-08-16 16:18 ` [PATCH 3/3] makefile: split install target Luca Barbato
2012-08-17 23:33   ` Rich Felker
2012-08-16 16:51 ` [PATCH 1/3] makefile: add silent rules orc
2012-08-16 17:05   ` Luca Barbato
2012-08-16 23:03 ` idunham
2012-08-16 23:06   ` Gregor Richards
2012-08-17  0:10   ` Luca Barbato
2012-08-17  1:21     ` Rich Felker
  -- strict thread matches above, loose matches on Subject: below --
2012-06-13  5:22 Build system tweaks Luca Barbato
2012-06-13  5:22 ` [PATCH 3/3] makefile: split install target Luca Barbato

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).