Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331799923-14402-1-git-send-email-gf@unixsol.org>
Date: Thu, 15 Mar 2012 10:25:23 +0200
From: Georgi Chorbadzhiyski <gf@...xsol.org>
To: musl@...ts.openwall.com
Subject: [PATCH] makefile: Make default output compact and similar to Linux kernel.

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.