chiark / gitweb /
Makefile: Silent-rules stuff.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 19 Jun 2010 20:05:01 +0000 (21:05 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 19 Jun 2010 20:14:25 +0000 (21:14 +0100)
Not completely successful, because some of the build machinery underneath
is still somewhat noisy.  Oh, well.

Makefile

index d08ed09cc36ee96e169cb4a96cfa5012f4592fb0..11e3da608cd9e1de478e112176c6fadd31405e24 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,19 @@ CLEANFILES            = $(TARGETS)
 all::
 clean::; rm -f $(CLEANFILES)
 
+###--------------------------------------------------------------------------
+### Silent rules stuff.
+
+## Default verbosity setting.
+V                       = 0
+
+## Infrastructure.
+v_echo                  = $(call v_echo_$V,$1)
+v_echo_1                =
+v_echo_0                = @printf "  %-6s %s\n" "$1" "$@";
+V_HIDE                  = $(V_HIDE_$V)
+V_HIDE_0                = @
+
 ###--------------------------------------------------------------------------
 ### Testing.
 
@@ -59,12 +72,12 @@ CC                   = gcc
 CFLAGS                  = -O2 -g -pedantic -Wall
 CLEANFILES             += *.o
 .SUFFIXES: .c
-.c.o:; $(CC) -c $(CFLAGS) -o $@ $<
+.c.o:; $(call v_echo,CC)$(CC) -c $(CFLAGS) -o $@ $<
 
 LANGS                  += c
 SOURCES                        += c-fringe.c
 c-fringe: c-fringe.o
-       $(CC) -o $@ $^
+       $(call v_echo,CCLD)$(CC) -o $@ $^
 
 ###--------------------------------------------------------------------------
 ### Haskell.
@@ -73,12 +86,12 @@ HC                   = ghc
 HFLAGS                  = -O2
 CLEANFILES             += *.hi *.hc
 .SUFFIXES: .hs
-.hs.o:; $(HC) -c $(HFLAGS) -o $@ $<
+.hs.o:; $(call v_echo,HC)$(HC) -c $(HFLAGS) -o $@ $<
 
 LANGS                  += haskell
 SOURCES                        += haskell-fringe.hs
 haskell-fringe: haskell-fringe.o
-       $(HC) -o $@ $^
+       $(call v_echo,HCLD)$(HC) -o $@ $^
 
 ###--------------------------------------------------------------------------
 ### Icon.
@@ -89,7 +102,7 @@ IFLAGS                        = -u -fa
 LANGS                  += icon
 SOURCES                        += icon-fringe.icn
 icon-fringe: icon-fringe.icn
-       $(ICONT) -o $@ $^
+       $(call v_echo,ICONT)$(ICONT) -o $@ $^
 
 ###--------------------------------------------------------------------------
 ### Common Lisp.
@@ -97,13 +110,15 @@ icon-fringe: icon-fringe.icn
 CLEANFILES             += *.core *.fasl
 
 .SUFFIXES: .lisp .fasl
-.lisp.fasl:; sbcl --eval '(quit :unix-status (if (compile-file "$<") 0 1))'
+.lisp.fasl:
+       $(call v_echo,CL)sbcl --eval \
+               '(quit :unix-status (if (compile-file "$<") 0 1))'
 
 LANGS                  += cl
 SOURCES                        += cl-fringe.lisp
 cl-fringe: cl-fringe.fasl
-       cp $< $@.new && chmod +x $@.new && mv $@.new $@
-##     cl-launch -o $@ -f `pwd`/$^ +I -r launch -d $@.core
+       $(call v_echo,CP)cp $< $@.new && chmod +x $@.new && mv $@.new $@
+##     $(call v_echo,CL)cl-launch -o $@ -f `pwd`/$^ +I -r launch -d $@.core
 
 ###--------------------------------------------------------------------------
 ### F#.
@@ -111,13 +126,12 @@ cl-fringe: cl-fringe.fasl
 FSC                     = fsc
 CLEANFILES             += *.exe
 .SUFFIXES: .fs .exe
-.fs.exe:; fsc -o $@ $<
+.fs.exe:; $(call v_echo,FSC)$(FSC) -o $@ $<
 
 LANGS                  += f\#
 SOURCES                        += f\#-fringe.fs
 f\#-fringe: f\#-fringe.exe
-       chmod +x $<
-       cp $< $@
+       $(call v_echo,CP)chmod +x $< && cp $< $@
 
 ###--------------------------------------------------------------------------
 ### Scheme.
@@ -125,12 +139,12 @@ f\#-fringe: f\#-fringe.exe
 SCMC                    = csc
 SCMFLAGS                = -c -O2 
 .SUFFIXES: .scm
-.scm.o:; $(SCMC) $(SCMFLAGS) -o $@ $<
+.scm.o:; $(call v_echo,SCMC)$(SCMC) $(SCMFLAGS) -o $@ $<
 
 LANGS                  += scheme
 SOURCES                        += scheme-fringe.scm
 scheme-fringe: scheme-fringe.o
-       $(SCMC) -o $@ $^
+       $(call v_echo,SCMLD)$(SCMC) -o $@ $^
 
 ###--------------------------------------------------------------------------
 ### Go.
@@ -140,12 +154,12 @@ GOC                        = $(GOOBJ)g
 GOLINK                  = $(GOOBJ)l
 CLEANFILES             += *.$(GOOBJ)
 .SUFFIXES: .$(GOOBJ) .go
-.go.$(GOOBJ):; $(GOC) $(GOFLAGS) $<
+.go.$(GOOBJ):; $(call v_echo,GOC)$(GOC) $(GOFLAGS) $<
 
 LANGS                  += go
 SOURCES                        += go-fringe.go
 go-fringe: go-fringe.$(GOOBJ)
-       $(GOLINK) -o $@ $^
+       $(call v_echo,GOLD)$(GOLINK) -o $@ $^
 
 ###--------------------------------------------------------------------------
 ### Smalltalk.
@@ -154,15 +168,14 @@ LANGS                     += smalltalk
 TARGETS                        += smalltalk-fringe.im
 SOURCES                        += smalltalk-fringe.st
 smalltalk-fringe.im: smalltalk-fringe.st
-       echo "ObjectMemory snapshot: '$@.new'" | gst $^ -
-       mv $@.new $@
+       $(call v_echo,GSTIM)echo "ObjectMemory snapshot: '$@.new'" | gst $^ -
+       $(V_HIDE)mv $@.new $@
 smalltalk-fringe:
-       { echo '#! /bin/sh';                                            \
+       $(call v_echo,GENSH){ echo '#! /bin/sh';                        \
          echo '"exec" "gst" "-I" "$@.im" "-f" "$$0" "$$@"';            \
          echo 'ObjectMemory quit: (Node main: Smalltalk arguments)';   \
        } >$@.new
-       chmod +x $@.new
-       mv $@.new $@
+       $(V_HIDE)chmod +x $@.new && mv $@.new $@
 
 ###----- That's all, folks --------------------------------------------------