* [PATCH] makefile: Make default output compact and similar to Linux kernel.
@ 2012-03-15 8:25 Georgi Chorbadzhiyski
2012-03-15 16:42 ` Rich Felker
2012-03-15 16:47 ` Igmar Palsenberg
0 siblings, 2 replies; 5+ messages in thread
From: Georgi Chorbadzhiyski @ 2012-03-15 8:25 UTC (permalink / raw)
To: musl
This patch changes default make output to be similar to Linux kernel.
An example output looks like this:
ASM crt/i386/crt1.s
COPY crt/crt1.o lib/crt1.o
MKBITS i386
MKTYPES include/bits/alltypes.h.sh
CC src/aio/aio_cancel.c
CC src/unistd/write.c
LD lib/libc.so
BUILD tools/musl-gcc
INSTALL /usr/local/musl/lib/libc.a
INSTALL /usr/local/bin/musl-gcc
If you want to see the executed commands use make V=1 or export V=1
before running make.
---
Makefile | 83 +++++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 53 insertions(+), 30 deletions(-)
diff --git a/Makefile b/Makefile
index 7aa6c4f..62e5416 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,13 @@ ALL_TOOLS = tools/musl-gcc
LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
+ifndef V
+Q = @
+SAY = echo
+else
+SAY = @true
+endif
+
-include config.mak
all: $(ALL_LIBS) $(ALL_TOOLS)
@@ -48,70 +55,86 @@ 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
+ $(Q)$(SAY) "CLEAN all"
+ $(Q)rm -f crt/*.o
+ $(Q)rm -f $(OBJS)
+ $(Q)rm -f $(LOBJS)
+ $(Q)rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so
+ $(Q)rm -f $(ALL_TOOLS)
+ $(Q)rm -f $(GENH)
+ $(Q)rm -f include/bits
include/bits:
- @test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
- ln -sf ../arch/$(ARCH)/bits $@
+ $(Q)$(SAY) "MKBITS $(ARCH)"
+ @test "$(ARCH)" || { $(SAY) "Please set ARCH in config.mak before running make." ; exit 1 ; }
+ $(Q)ln -sf ../arch/$(ARCH)/bits $@
include/bits/alltypes.h.sh: include/bits
include/bits/alltypes.h: include/bits/alltypes.h.sh
- sh $< > $@
+ $(Q)$(SAY) "MKTYPES $<"
+ $(Q)sh $< > $@
%.o: $(ARCH)/%.s
- $(CC) $(CFLAGS) $(INC) -c -o $@ $<
+ $(Q)$(SAY) "ASM $<"
+ $(Q)$(CC) $(CFLAGS) $(INC) -c -o $@ $<
%.o: %.c $(GENH)
- $(CC) $(CFLAGS) $(INC) -c -o $@ $<
+ $(Q)$(SAY) "CC $<"
+ $(Q)$(CC) $(CFLAGS) $(INC) -c -o $@ $<
%.lo: $(ARCH)/%.s
- $(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
+ $(Q)$(SAY) "ASM $<"
+ $(Q)$(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
%.lo: %.c $(GENH)
- $(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
+ $(Q)$(SAY) "CC $<"
+ $(Q)$(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
lib/libc.so: $(LOBJS)
- $(CC) $(LDFLAGS) -Wl,-soname=libc.so -o $@ $(LOBJS) -lgcc
- $(OBJCOPY) --weaken $@
+ $(Q)$(SAY) "LD $@"
+ $(Q)$(CC) $(LDFLAGS) -Wl,-soname=libc.so -o $@ $(LOBJS) -lgcc
+ $(Q)$(OBJCOPY) --weaken $@
lib/libc.a: $(OBJS)
- rm -f $@
- $(AR) rc $@ $(OBJS)
- $(RANLIB) $@
+ $(Q)$(SAY) "AR $@"
+ $(Q)rm -f $@
+ $(Q)$(AR) rc $@ $(OBJS)
+ $(Q)$(RANLIB) $@
$(EMPTY_LIBS):
- rm -f $@
- $(AR) rc $@
+ $(Q)rm -f $@
+ $(Q)$(AR) rc $@
lib/%.o: crt/%.o
- cp $< $@
+ $(Q)$(SAY) "COPY $< $@"
+ $(Q)cp $< $@
tools/musl-gcc: tools/gen-musl-gcc.sh config.mak
- sh $< "$(prefix)" "$(LDSO_PATHNAME)" > $@ || { rm -f $@ ; exit 1 ; }
- chmod +x $@
+ $(Q)$(SAY) "BUILD $@"
+ $(Q)sh $< "$(prefix)" "$(LDSO_PATHNAME)" > $@ || { rm -f $@ ; exit 1 ; }
+ $(Q)chmod +x $@
$(DESTDIR)$(bindir)/%: tools/%
- install -D $< $@
+ $(Q)$(SAY) "INSTALL $@"
+ $(Q)install -D $< $@
$(DESTDIR)$(libdir)/%.so: lib/%.so
- install -D -m 755 $< $@
+ $(Q)$(SAY) "INSTALL $@"
+ $(Q)install -D -m 755 $< $@
$(DESTDIR)$(libdir)/%: lib/%
- install -D -m 644 $< $@
+ $(Q)$(SAY) "INSTALL $@"
+ $(Q)install -D -m 644 $< $@
$(DESTDIR)$(includedir)/%: include/%
- install -D -m 644 $< $@
+ $(Q)$(SAY) "INSTALL $@"
+ $(Q)install -D -m 644 $< $@
$(DESTDIR)$(LDSO_PATHNAME): lib/libc.so
- install -d -m 755 $(DESTDIR)$(syslibdir)
- ln -sf $(libdir)/libc.so $@ || true
+ $(Q)$(SAY) "INSTALL $@"
+ $(Q)install -d -m 755 $(DESTDIR)$(syslibdir)
+ $(Q)ln -sf $(libdir)/libc.so $@ || true
.PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
--
1.7.5.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] makefile: Make default output compact and similar to Linux kernel.
2012-03-15 8:25 [PATCH] makefile: Make default output compact and similar to Linux kernel Georgi Chorbadzhiyski
@ 2012-03-15 16:42 ` Rich Felker
2012-03-16 18:00 ` Isaac Dunham
2012-03-15 16:47 ` Igmar Palsenberg
1 sibling, 1 reply; 5+ messages in thread
From: Rich Felker @ 2012-03-15 16:42 UTC (permalink / raw)
To: musl
On Thu, Mar 15, 2012 at 10:25:23AM +0200, Georgi Chorbadzhiyski wrote:
> This patch changes default make output to be similar to Linux kernel.
> An example output looks like this:
>
> ASM crt/i386/crt1.s
> COPY crt/crt1.o lib/crt1.o
> MKBITS i386
> MKTYPES include/bits/alltypes.h.sh
> CC src/aio/aio_cancel.c
> CC src/unistd/write.c
> LD lib/libc.so
> BUILD tools/musl-gcc
> INSTALL /usr/local/musl/lib/libc.a
> INSTALL /usr/local/bin/musl-gcc
>
> If you want to see the executed commands use make V=1 or export V=1
> before running make.
Any opinions on this? I really dislike this kind of output, but if
there's a demand for it I'll consider it.
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] makefile: Make default output compact and similar to Linux kernel.
2012-03-15 8:25 [PATCH] makefile: Make default output compact and similar to Linux kernel Georgi Chorbadzhiyski
2012-03-15 16:42 ` Rich Felker
@ 2012-03-15 16:47 ` Igmar Palsenberg
1 sibling, 0 replies; 5+ messages in thread
From: Igmar Palsenberg @ 2012-03-15 16:47 UTC (permalink / raw)
To: musl
I'm agains it. I really don't see the added value of this.
Just my 4$
Regards,
Igmar
On Mar 15, 2012, at 9:25, Georgi Chorbadzhiyski <gf@unixsol.org> wrote:
> This patch changes default make output to be similar to Linux kernel.
> An example output looks like this:
>
> ASM crt/i386/crt1.s
> COPY crt/crt1.o lib/crt1.o
> MKBITS i386
> MKTYPES include/bits/alltypes.h.sh
> CC src/aio/aio_cancel.c
> CC src/unistd/write.c
> LD lib/libc.so
> BUILD tools/musl-gcc
> INSTALL /usr/local/musl/lib/libc.a
> INSTALL /usr/local/bin/musl-gcc
>
> If you want to see the executed commands use make V=1 or export V=1
> before running make.
> ---
> Makefile | 83 +++++++++++++++++++++++++++++++++++++++----------------------
> 1 files changed, 53 insertions(+), 30 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 7aa6c4f..62e5416 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -41,6 +41,13 @@ ALL_TOOLS = tools/musl-gcc
>
> LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
>
> +ifndef V
> +Q = @
> +SAY = echo
> +else
> +SAY = @true
> +endif
> +
> -include config.mak
>
> all: $(ALL_LIBS) $(ALL_TOOLS)
> @@ -48,70 +55,86 @@ 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
> + $(Q)$(SAY) "CLEAN all"
> + $(Q)rm -f crt/*.o
> + $(Q)rm -f $(OBJS)
> + $(Q)rm -f $(LOBJS)
> + $(Q)rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so
> + $(Q)rm -f $(ALL_TOOLS)
> + $(Q)rm -f $(GENH)
> + $(Q)rm -f include/bits
>
> include/bits:
> - @test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
> - ln -sf ../arch/$(ARCH)/bits $@
> + $(Q)$(SAY) "MKBITS $(ARCH)"
> + @test "$(ARCH)" || { $(SAY) "Please set ARCH in config.mak before running make." ; exit 1 ; }
> + $(Q)ln -sf ../arch/$(ARCH)/bits $@
>
> include/bits/alltypes.h.sh: include/bits
>
> include/bits/alltypes.h: include/bits/alltypes.h.sh
> - sh $< > $@
> + $(Q)$(SAY) "MKTYPES $<"
> + $(Q)sh $< > $@
>
> %.o: $(ARCH)/%.s
> - $(CC) $(CFLAGS) $(INC) -c -o $@ $<
> + $(Q)$(SAY) "ASM $<"
> + $(Q)$(CC) $(CFLAGS) $(INC) -c -o $@ $<
>
> %.o: %.c $(GENH)
> - $(CC) $(CFLAGS) $(INC) -c -o $@ $<
> + $(Q)$(SAY) "CC $<"
> + $(Q)$(CC) $(CFLAGS) $(INC) -c -o $@ $<
>
> %.lo: $(ARCH)/%.s
> - $(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
> + $(Q)$(SAY) "ASM $<"
> + $(Q)$(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
>
> %.lo: %.c $(GENH)
> - $(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
> + $(Q)$(SAY) "CC $<"
> + $(Q)$(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
>
> lib/libc.so: $(LOBJS)
> - $(CC) $(LDFLAGS) -Wl,-soname=libc.so -o $@ $(LOBJS) -lgcc
> - $(OBJCOPY) --weaken $@
> + $(Q)$(SAY) "LD $@"
> + $(Q)$(CC) $(LDFLAGS) -Wl,-soname=libc.so -o $@ $(LOBJS) -lgcc
> + $(Q)$(OBJCOPY) --weaken $@
>
> lib/libc.a: $(OBJS)
> - rm -f $@
> - $(AR) rc $@ $(OBJS)
> - $(RANLIB) $@
> + $(Q)$(SAY) "AR $@"
> + $(Q)rm -f $@
> + $(Q)$(AR) rc $@ $(OBJS)
> + $(Q)$(RANLIB) $@
>
> $(EMPTY_LIBS):
> - rm -f $@
> - $(AR) rc $@
> + $(Q)rm -f $@
> + $(Q)$(AR) rc $@
>
> lib/%.o: crt/%.o
> - cp $< $@
> + $(Q)$(SAY) "COPY $< $@"
> + $(Q)cp $< $@
>
> tools/musl-gcc: tools/gen-musl-gcc.sh config.mak
> - sh $< "$(prefix)" "$(LDSO_PATHNAME)" > $@ || { rm -f $@ ; exit 1 ; }
> - chmod +x $@
> + $(Q)$(SAY) "BUILD $@"
> + $(Q)sh $< "$(prefix)" "$(LDSO_PATHNAME)" > $@ || { rm -f $@ ; exit 1 ; }
> + $(Q)chmod +x $@
>
> $(DESTDIR)$(bindir)/%: tools/%
> - install -D $< $@
> + $(Q)$(SAY) "INSTALL $@"
> + $(Q)install -D $< $@
>
> $(DESTDIR)$(libdir)/%.so: lib/%.so
> - install -D -m 755 $< $@
> + $(Q)$(SAY) "INSTALL $@"
> + $(Q)install -D -m 755 $< $@
>
> $(DESTDIR)$(libdir)/%: lib/%
> - install -D -m 644 $< $@
> + $(Q)$(SAY) "INSTALL $@"
> + $(Q)install -D -m 644 $< $@
>
> $(DESTDIR)$(includedir)/%: include/%
> - install -D -m 644 $< $@
> + $(Q)$(SAY) "INSTALL $@"
> + $(Q)install -D -m 644 $< $@
>
> $(DESTDIR)$(LDSO_PATHNAME): lib/libc.so
> - install -d -m 755 $(DESTDIR)$(syslibdir)
> - ln -sf $(libdir)/libc.so $@ || true
> + $(Q)$(SAY) "INSTALL $@"
> + $(Q)install -d -m 755 $(DESTDIR)$(syslibdir)
> + $(Q)ln -sf $(libdir)/libc.so $@ || true
>
> .PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
>
> --
> 1.7.5.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] makefile: Make default output compact and similar to Linux kernel.
2012-03-15 16:42 ` Rich Felker
@ 2012-03-16 18:00 ` Isaac Dunham
2012-03-16 22:55 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Isaac Dunham @ 2012-03-16 18:00 UTC (permalink / raw)
To: musl
On Thu, 15 Mar 2012 12:42:09 -0400
Rich Felker <dalias@aerifal.cx> wrote:
> On Thu, Mar 15, 2012 at 10:25:23AM +0200, Georgi Chorbadzhiyski wrote:
> > This patch changes default make output to be similar to Linux kernel.
> > An example output looks like this:
> > CC src/unistd/write.c
> > LD lib/libc.so
> > BUILD tools/musl-gcc
> > INSTALL /usr/local/musl/lib/libc.a
..
>
> Any opinions on this? I really dislike this kind of output, but if
> there's a demand for it I'll consider it.
>
On the plus side, it makes spotting warnings/errors easier.
It does look a little cleaner, as well.
On the down side
-it complicates makefiles
-it hides what's happening (and often the flags gcc gets are the biggest problem)
-you can review the errors in full context later with
make 2>&1 | tee errors.log -
So my vote is that it isn't worth the effort.
--
Isaac Dunham <idunham@lavabit.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] makefile: Make default output compact and similar to Linux kernel.
2012-03-16 18:00 ` Isaac Dunham
@ 2012-03-16 22:55 ` Rich Felker
0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2012-03-16 22:55 UTC (permalink / raw)
To: musl
On Fri, Mar 16, 2012 at 11:00:23AM -0700, Isaac Dunham wrote:
> On Thu, 15 Mar 2012 12:42:09 -0400
> Rich Felker <dalias@aerifal.cx> wrote:
>
> > On Thu, Mar 15, 2012 at 10:25:23AM +0200, Georgi Chorbadzhiyski wrote:
> > > This patch changes default make output to be similar to Linux kernel.
> > > An example output looks like this:
> > > CC src/unistd/write.c
> > > LD lib/libc.so
> > > BUILD tools/musl-gcc
> > > INSTALL /usr/local/musl/lib/libc.a
> ...
> >
> > Any opinions on this? I really dislike this kind of output, but if
> > there's a demand for it I'll consider it.
> >
> On the plus side, it makes spotting warnings/errors easier.
> It does look a little cleaner, as well.
For warnings, I agree. For errors, they should stop compilation
anyway. As for myself, I always build with -Werror but with a
carefully tuned set of warning options that disable a number of
warnings which I consider broken by design (e.g. ones that necessarily
have false positives that can't be "fixed", like unused function
arguments) or which impose style rules I disagree with. :-)
> On the down side
> -it complicates makefiles
Indeed. A feature like this really belongs in make itself (e.g. make
--pretty or something) rather than in every single program's makefile.
> -it hides what's happening (and often the flags gcc gets are the
> biggest problem)
With most programs, the reason I dislike the "V=0" style is that it
makes it impossible to re-run just the command that failed after
changing something in the source, or to rerun it with slightly
different compiler options. Often re-running make will recurse through
10 different directories before getting back to where it stopped, and
of course the situation is even worse trying to find where in the
makefile to override CFLAGS for just one source file (e.g. when gcc is
OOM'ing building some gigantic file with -O3 and you want to retry
with -O0 just to get a working build).
For musl this is not such a big deal since the makefile is sane.
> -you can review the errors in full context later with
> make 2>&1 | tee errors.log -
>
> So my vote is that it isn't worth the effort.
My view is that it wouldn't be as harmful in musl as in many other
projects, but I still find it mildly annoying at best and slightly
problematic at worst.
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-16 22:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-15 8:25 [PATCH] makefile: Make default output compact and similar to Linux kernel Georgi Chorbadzhiyski
2012-03-15 16:42 ` Rich Felker
2012-03-16 18:00 ` Isaac Dunham
2012-03-16 22:55 ` Rich Felker
2012-03-15 16:47 ` Igmar Palsenberg
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).