mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Georgi Chorbadzhiyski <gf@unixsol.org>
To: musl@lists.openwall.com
Subject: [PATCH] makefile: Make default output compact and similar to Linux kernel.
Date: Thu, 15 Mar 2012 10:25:23 +0200	[thread overview]
Message-ID: <1331799923-14402-1-git-send-email-gf@unixsol.org> (raw)

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



             reply	other threads:[~2012-03-15  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15  8:25 Georgi Chorbadzhiyski [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331799923-14402-1-git-send-email-gf@unixsol.org \
    --to=gf@unixsol.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).