View Issue Details

IDProjectCategoryView StatusLast Update
0002328OpenFOAMPatchpublic2016-11-13 22:04
Reporteralexeym Assigned Tohenry  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSFedoraOS Version24
Product Versiondev 
Fixed in Versiondev 
Summary0002328: Silent rules for wmake
DescriptionCompilation logs in general contain lots of information in general rather useless to user: full compiler invocation commands with all flags. Patch introduces WM_SILENT_RULES environment variable, so build log files instead of

$ wmake
$HOME/OpenFOAM/OpenFOAM-dev/applications/solvers/incompressible/icoFoam
Making dependency list for source file icoFoam.C
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I$HOME/OpenFOAM/OpenFOAM-dev/src/finiteVolume/lnInclude -I$HOME/OpenFOAM/OpenFOAM-dev/src/meshTools/lnInclude -IlnInclude -I. -I$HOME/OpenFOAM/OpenFOAM-dev/src/OpenFOAM/lnInclude -I$HOME/OpenFOAM/OpenFOAM-dev/src/OSspecific/POSIX/lnInclude -fPIC -c icoFoam.C -o $HOME/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/applications/solvers/incompressible/icoFoam/icoFoam.o
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -I$HOME/OpenFOAM/OpenFOAM-dev/src/finiteVolume/lnInclude -I$HOME/OpenFOAM/OpenFOAM-dev/src/meshTools/lnInclude -IlnInclude -I. -I$HOME/OpenFOAM/OpenFOAM-dev/src/OpenFOAM/lnInclude -I$HOME/OpenFOAM/OpenFOAM-dev/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed $HOME/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/applications/solvers/incompressible/icoFoam/icoFoam.o -L$HOME/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib \
    -lfiniteVolume -lmeshTools -lOpenFOAM -ldl \
     -lm -o $HOME/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/bin/icoFoam

user gets

$ wmake
$HOME/OpenFOAM/OpenFOAM-dev/applications/solvers/incompressible/icoFoam
   DEP icoFoam.C
    CC icoFoam.C
    LD icoFoam
Additional InformationTo use the feature, set WM_SILENT_RULES to non-empty value.
Tagswmake

Activities

alexeym

2016-11-11 08:40

reporter  

0003-Silent-rules.patch (12,153 bytes)   
From 1996a097d5c41eb5f49bf43d72a886c844e94415 Mon Sep 17 00:00:00 2001
From: Alexey Matveichev <github@matveichev.com>
Date: Fri, 11 Nov 2016 08:52:59 +0100
Subject: [PATCH 3/5] Silent rules

---
 etc/bashrc                    |  2 ++
 wmake/makefiles/general       | 49 ++++++++++++++++++++++++++++++++++++++++++-
 wmake/rules/General/bison     | 13 ++++++++++++
 wmake/rules/General/btyacc    |  8 +++++++
 wmake/rules/General/btyacc++  |  7 +++++++
 wmake/rules/General/byacc     |  7 +++++++
 wmake/rules/General/flex      |  5 +++++
 wmake/rules/General/flex++    |  5 +++++
 wmake/rules/General/moc       |  6 ++++++
 wmake/rules/General/transform | 11 ++++++++++
 wmake/src/Makefile            | 15 +++++++++++++
 wmake/src/wmkdep.l            | 14 +++++++++++--
 wmake/wmakeLnInclude          |  5 +++++
 13 files changed, 144 insertions(+), 3 deletions(-)

diff --git a/etc/bashrc b/etc/bashrc
index e107f57..089e415 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -138,6 +138,8 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
 # Add in preset user or site preferences:
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
 
+[ -n "$WM_SILENT_RULES" ] && export WM_SILENT_RULES
+
 # Evaluate command-line parameters and record settings for later
 # these can be used to set/unset values, or specify alternative pref files
 export FOAM_SETTINGS="$@"
diff --git a/wmake/makefiles/general b/wmake/makefiles/general
index b7f4935..6905b6a 100644
--- a/wmake/makefiles/general
+++ b/wmake/makefiles/general
@@ -130,17 +130,34 @@ LIB_HEADER_DIRS = \
 
 $(EXE): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(EXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(EXE))"
+	@$(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
+	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
+	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
+else
 	$(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
 	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
+endif
 
 exe:    $(SEXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir SEXE)"
+else
 	@echo \'$(SEXE)\' is up to date.
+endif
 
 $(SEXE):$(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(SEXE))"
+	@$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
+	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
+else
 	$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
 	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
+endif
 
 
 #------------------------------------------------------------------------------
@@ -150,29 +167,59 @@ $(SEXE):$(OBJECTS)
 objects: $(OBJECTS)
 
 libso:  $(LIB).$(SO)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).$(SO)"
+else
 	@echo \'$(LIB).$(SO)\' is up to date.
+endif
 
 $(LIB).$(SO): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(LIB)).$(SO)"
+	@$(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
+	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
+else
 	$(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
+endif
 
 lib:    $(LIB).a
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).a"
+else
 	@echo \'$(LIB).a\' is up to date.
+endif
 
 $(LIB).a: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).a
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    AR $(notdir $(LIB))"
+	@$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
+	@echo "RANLIB $(notdir $(LIB))"
+	@$(RANLIB) $(LIB).a
+else
 	$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
 	$(RANLIB) $(LIB).a
+endif
 
 libo:   $(LIB).o
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).o"
+else
 	@echo \'$(LIB).o\' is up to date.
+endif
 
 $(LIB).o: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).o
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(LIB)).o"
+	@$(LD) -r -o $(LIB).o $(OBJECTS)
+else
 	$(LD) -r -o $(LIB).o $(OBJECTS)
+endif
 
 
 #------------------------------------------------------------------------------
@@ -205,4 +252,4 @@ ifeq ($(findstring lnInclude,$(MAKECMDGOALS))$(findstring updatedep,$(MAKECMDGOA
 endif
 
 
-#------------------------------------------------------------------------------
+#----------------------------- vim: set ft=make: ------------------------------
diff --git a/wmake/rules/General/bison b/wmake/rules/General/bison
index 4811b0e..7cb4cb5 100644
--- a/wmake/rules/General/bison
+++ b/wmake/rules/General/bison
@@ -1,5 +1,17 @@
 SUFFIXES += .y .Y
 
+
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).c $(AND) \
+    mv y.tab.h $(@D)/$(<F).h $(AND) \
+    $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+
+Ytoo = @echo "    YY $<"; $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).C $(AND) \
+    mv y.tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c  $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).c $(AND) \
     mv y.tab.h $(@D)/$(<F).h $(AND) \
@@ -9,3 +21,4 @@ Ytoo = $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c  $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/btyacc b/wmake/rules/General/btyacc
index 90124eb..dac790d 100644
--- a/wmake/rules/General/btyacc
+++ b/wmake/rules/General/btyacc
@@ -1,6 +1,14 @@
 SUFFIXES += .y
 
+
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
+    mv y_tab.c $(@D)/$(<F).C $(AND) \
+    mv y_tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/btyacc++ b/wmake/rules/General/btyacc++
index 2aa66cc..a8f4b4c 100644
--- a/wmake/rules/General/btyacc++
+++ b/wmake/rules/General/btyacc++
@@ -1,6 +1,13 @@
 SUFFIXES += .Y
 
+ifneq ("$(WM_SILENT_RULES)","")
+Ytoo = @echo "    YY $<"; $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
+    mv y_tab.c $(@D)/$(<F).C $(AND) \
+    mv y_tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 Ytoo = $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/byacc b/wmake/rules/General/byacc
index 1777338..f150ecc 100644
--- a/wmake/rules/General/byacc
+++ b/wmake/rules/General/byacc
@@ -1,6 +1,13 @@
 SUFFIXES += .y
 
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).C $(AND) \
+    mv y.tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/flex b/wmake/rules/General/flex
index 3f2fe37..850f2f6 100644
--- a/wmake/rules/General/flex
+++ b/wmake/rules/General/flex
@@ -1,4 +1,9 @@
 SUFFIXES += .l
 
+ifneq ("$(WM_SILENT_RULES)","")
+ltoo = @echo "   LEX $<"; $(WM_SCHEDULER) flex -o $(@D)/$(<F).c $< $(AND) \
+    $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+else
 ltoo = $(WM_SCHEDULER) flex -o $(@D)/$(<F).c $< $(AND) \
     $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+endif
diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++
index 4a14062..52afe37 100644
--- a/wmake/rules/General/flex++
+++ b/wmake/rules/General/flex++
@@ -1,4 +1,9 @@
 SUFFIXES += .L
 
+ifneq ("$(WM_SILENT_RULES)","")
+Ltoo = @echo "   LEX $<"; $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
+    $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
+else
 Ltoo = $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
     $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/moc b/wmake/rules/General/moc
index 02a0758..0e139f9 100644
--- a/wmake/rules/General/moc
+++ b/wmake/rules/General/moc
@@ -1,4 +1,10 @@
 SUFFIXES += .qt
 
+ifneq ("$(WM_SILENT_RULES)","")
+qttoo = @echo "   MOC $<"; \
+    $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 qttoo = $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform
index 3fa0152..5787da7 100644
--- a/wmake/rules/General/transform
+++ b/wmake/rules/General/transform
@@ -2,15 +2,26 @@
 
 define DEFINE_TRANSFORM
 $(OBJECTS_DIR)/%.o : %$1
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    CC $(value <F)"
+	@$$($(subst .,,$(1))too)
+else
 	$$($(subst .,,$(1))too)
+endif
 endef
 
 $(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))
 
 $(OBJECTS_DIR)/%.dep : %
 	@$(WM_SCRIPTS)/makeTargetDir $@
+ifneq ("$(WM_SILENT_RULES)","")
 	@$(WMAKE_BIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) $< | \
 		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
 			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+else
+	@$(WMAKE_BIN)/wmkdep -v -I$(*D) $(LIB_HEADER_DIRS) $< | \
+		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
+			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+endif
 
 #------------------------------------------------------------------------------
diff --git a/wmake/src/Makefile b/wmake/src/Makefile
index f14baad..3a04e3c 100644
--- a/wmake/src/Makefile
+++ b/wmake/src/Makefile
@@ -52,6 +52,7 @@ WM_COMPILE_OPTION = Opt
 GENERAL_RULES   = $(WM_DIR)/rules/General
 include $(GENERAL_RULES)/general
 
+cFLAGS += -Wno-unused-function
 
 #------------------------------------------------------------------------------
 # Targets
@@ -60,18 +61,32 @@ include $(GENERAL_RULES)/general
 all:  $(WMAKE_BIN)/dirToString $(WMAKE_BIN)/wmkdep
 
 clean:
+ifneq ("$(WM_SILENT_RULES)","")
+	@rm -f $(WMAKE_BIN)/* 2>/dev/null
+else
 	rm -f $(WMAKE_BIN)/* 2>/dev/null
+endif
 
 
 $(WMAKE_BIN)/dirToString: dirToString.c
 	@mkdir -p $(WMAKE_BIN)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    CC $<"
+	@$(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
+else
 	$(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
+endif
 
 
 $(WMAKE_BIN)/wmkdep: wmkdep.l
 	@mkdir -p $(WMAKE_BIN)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "   LEX $<"; flex wmkdep.l; \
+		$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+else
 	flex wmkdep.l
 	$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+endif
 	@rm -f lex.yy.c 2>/dev/null
 
 
diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index a98a597..9246ab1 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -47,6 +47,7 @@ Usage
 #include <sys/types.h>
 #include <dirent.h>
 #include <errno.h>
+#include <libgen.h>
 
 void nextFile(const char* fileName);
 void importFile(const char* fileName);
@@ -145,7 +146,7 @@ const char* bufferPaths[FILE_STACK_SIZE];
 int main(int argc, char* argv[])
 {
     char *basePos, *dotPos;
-    int i;
+    int i, verbose;
 
     if (argc == 1)
     {
@@ -154,7 +155,16 @@ int main(int argc, char* argv[])
     }
 
     sourceFile = strdup(argv[argc-1]);
-    fprintf(stderr, "Making dependency list for source file %s\n", sourceFile);
+    verbose = (strncmp(argv[1], "-v", 2) == 0);
+    if (verbose)
+    {
+        fprintf(stderr, "Making dependency list for source file %s\n",
+                sourceFile);
+    }
+    else
+    {
+        fprintf(stderr, "   DEP %s\n", basename(sourceFile));
+    }
 
 
     if ((basePos = strrchr(sourceFile, '/')) == NULL)
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index a9195b9..83ac510 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -139,7 +139,12 @@ fi
 cd $incDir || exit 1
 
 [ "$silentOpt" = true ] || {
+if [ -n "$WM_SILENT_RULES" ]
+then
+    echo "    LN $incDir" 1>&2
+else
     echo "$Script: linking include files to $incDir" 1>&2
+fi
 }
 
 
-- 
2.7.4

0003-Silent-rules.patch (12,153 bytes)   

henry

2016-11-11 09:58

manager   ~0007139

I think this functionality would be more useful if wmake/Allwmake have a command-line option to set WM_SILENT_RULES.

alexeym

2016-11-11 21:49

reporter   ~0007162

Added

1. -silent-rules option to wmake.
2. -silentRules option to AllwmakeParseArguments.

and kept ability to enable it globally by setting WM_SILENT_RULES environment variable.

Tried to guess option construction rules and it seems that for wmake it is -an-option, for AllwmakeParseArguments it is -anOption.
Silent-rules.patch (14,639 bytes)   
From 6bd01f3f31b23e965601957beafa1fa4ba1bda35 Mon Sep 17 00:00:00 2001
From: Alexey Matveichev <github@matveichev.com>
Date: Fri, 11 Nov 2016 22:38:56 +0100
Subject: [PATCH] Silent rules

Added WM_SILENT_RULES check to wmake rules to produce compact output:

$ ./Allwmake -silentRules
Enabling silent compilation rules
/home/alexey/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
    LN ./lnInclude
   DEP springRenumber.C
   DEP randomRenumber.C
   DEP OppositeFaceCellWaveName.C
   DEP structuredRenumber.C
   DEP CuthillMcKeeRenumber.C
   DEP manualRenumber.C
   DEP renumberMethod.C
    CC renumberMethod.C
    CC manualRenumber.C
    CC CuthillMcKeeRenumber.C
    CC randomRenumber.C
    CC springRenumber.C
    CC structuredRenumber.C
    CC OppositeFaceCellWaveName.C
    LD librenumberMethods.so
->> librenumberMethods.so

The behavior is enables by

1. WM_SILENT_RULES environment variable.
2. -silent-rules command line option for wmake.
3. -silentRules command line option for Allwmake.
---
 etc/bashrc                           |  2 ++
 wmake/makefiles/general              | 49 +++++++++++++++++++++++++++++++++++-
 wmake/rules/General/bison            | 13 ++++++++++
 wmake/rules/General/btyacc           |  8 ++++++
 wmake/rules/General/btyacc++         |  7 ++++++
 wmake/rules/General/byacc            |  7 ++++++
 wmake/rules/General/flex             |  5 ++++
 wmake/rules/General/flex++           |  5 ++++
 wmake/rules/General/moc              |  6 +++++
 wmake/rules/General/transform        | 11 ++++++++
 wmake/scripts/AllwmakeParseArguments |  7 +++++-
 wmake/src/Makefile                   | 15 +++++++++++
 wmake/src/wmkdep.l                   | 14 +++++++++--
 wmake/wmake                          |  5 ++++
 wmake/wmakeLnInclude                 |  5 ++++
 15 files changed, 155 insertions(+), 4 deletions(-)

diff --git a/etc/bashrc b/etc/bashrc
index 8b59bc2..4457726 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -138,6 +138,8 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
 # Add in preset user or site preferences:
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
 
+[ -n "$WM_SILENT_RULES" ] && export WM_SILENT_RULES
+
 # Evaluate command-line parameters and record settings for later
 # these can be used to set/unset values, or specify alternative pref files
 export FOAM_SETTINGS="$@"
diff --git a/wmake/makefiles/general b/wmake/makefiles/general
index b7f4935..6905b6a 100644
--- a/wmake/makefiles/general
+++ b/wmake/makefiles/general
@@ -130,17 +130,34 @@ LIB_HEADER_DIRS = \
 
 $(EXE): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(EXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(EXE))"
+	@$(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
+	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
+	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
+else
 	$(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
 	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
+endif
 
 exe:    $(SEXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir SEXE)"
+else
 	@echo \'$(SEXE)\' is up to date.
+endif
 
 $(SEXE):$(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(SEXE))"
+	@$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
+	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
+else
 	$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
 	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
+endif
 
 
 #------------------------------------------------------------------------------
@@ -150,29 +167,59 @@ $(SEXE):$(OBJECTS)
 objects: $(OBJECTS)
 
 libso:  $(LIB).$(SO)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).$(SO)"
+else
 	@echo \'$(LIB).$(SO)\' is up to date.
+endif
 
 $(LIB).$(SO): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(LIB)).$(SO)"
+	@$(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
+	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
+else
 	$(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
+endif
 
 lib:    $(LIB).a
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).a"
+else
 	@echo \'$(LIB).a\' is up to date.
+endif
 
 $(LIB).a: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).a
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    AR $(notdir $(LIB))"
+	@$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
+	@echo "RANLIB $(notdir $(LIB))"
+	@$(RANLIB) $(LIB).a
+else
 	$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
 	$(RANLIB) $(LIB).a
+endif
 
 libo:   $(LIB).o
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).o"
+else
 	@echo \'$(LIB).o\' is up to date.
+endif
 
 $(LIB).o: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).o
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(LIB)).o"
+	@$(LD) -r -o $(LIB).o $(OBJECTS)
+else
 	$(LD) -r -o $(LIB).o $(OBJECTS)
+endif
 
 
 #------------------------------------------------------------------------------
@@ -205,4 +252,4 @@ ifeq ($(findstring lnInclude,$(MAKECMDGOALS))$(findstring updatedep,$(MAKECMDGOA
 endif
 
 
-#------------------------------------------------------------------------------
+#----------------------------- vim: set ft=make: ------------------------------
diff --git a/wmake/rules/General/bison b/wmake/rules/General/bison
index 4811b0e..7cb4cb5 100644
--- a/wmake/rules/General/bison
+++ b/wmake/rules/General/bison
@@ -1,5 +1,17 @@
 SUFFIXES += .y .Y
 
+
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).c $(AND) \
+    mv y.tab.h $(@D)/$(<F).h $(AND) \
+    $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+
+Ytoo = @echo "    YY $<"; $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).C $(AND) \
+    mv y.tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c  $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).c $(AND) \
     mv y.tab.h $(@D)/$(<F).h $(AND) \
@@ -9,3 +21,4 @@ Ytoo = $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c  $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/btyacc b/wmake/rules/General/btyacc
index 90124eb..dac790d 100644
--- a/wmake/rules/General/btyacc
+++ b/wmake/rules/General/btyacc
@@ -1,6 +1,14 @@
 SUFFIXES += .y
 
+
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
+    mv y_tab.c $(@D)/$(<F).C $(AND) \
+    mv y_tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/btyacc++ b/wmake/rules/General/btyacc++
index 2aa66cc..a8f4b4c 100644
--- a/wmake/rules/General/btyacc++
+++ b/wmake/rules/General/btyacc++
@@ -1,6 +1,13 @@
 SUFFIXES += .Y
 
+ifneq ("$(WM_SILENT_RULES)","")
+Ytoo = @echo "    YY $<"; $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
+    mv y_tab.c $(@D)/$(<F).C $(AND) \
+    mv y_tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 Ytoo = $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/byacc b/wmake/rules/General/byacc
index 1777338..f150ecc 100644
--- a/wmake/rules/General/byacc
+++ b/wmake/rules/General/byacc
@@ -1,6 +1,13 @@
 SUFFIXES += .y
 
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).C $(AND) \
+    mv y.tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/flex b/wmake/rules/General/flex
index 3f2fe37..850f2f6 100644
--- a/wmake/rules/General/flex
+++ b/wmake/rules/General/flex
@@ -1,4 +1,9 @@
 SUFFIXES += .l
 
+ifneq ("$(WM_SILENT_RULES)","")
+ltoo = @echo "   LEX $<"; $(WM_SCHEDULER) flex -o $(@D)/$(<F).c $< $(AND) \
+    $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+else
 ltoo = $(WM_SCHEDULER) flex -o $(@D)/$(<F).c $< $(AND) \
     $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+endif
diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++
index 4a14062..52afe37 100644
--- a/wmake/rules/General/flex++
+++ b/wmake/rules/General/flex++
@@ -1,4 +1,9 @@
 SUFFIXES += .L
 
+ifneq ("$(WM_SILENT_RULES)","")
+Ltoo = @echo "   LEX $<"; $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
+    $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
+else
 Ltoo = $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
     $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/moc b/wmake/rules/General/moc
index 02a0758..0e139f9 100644
--- a/wmake/rules/General/moc
+++ b/wmake/rules/General/moc
@@ -1,4 +1,10 @@
 SUFFIXES += .qt
 
+ifneq ("$(WM_SILENT_RULES)","")
+qttoo = @echo "   MOC $<"; \
+    $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 qttoo = $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform
index 3fa0152..5787da7 100644
--- a/wmake/rules/General/transform
+++ b/wmake/rules/General/transform
@@ -2,15 +2,26 @@
 
 define DEFINE_TRANSFORM
 $(OBJECTS_DIR)/%.o : %$1
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    CC $(value <F)"
+	@$$($(subst .,,$(1))too)
+else
 	$$($(subst .,,$(1))too)
+endif
 endef
 
 $(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))
 
 $(OBJECTS_DIR)/%.dep : %
 	@$(WM_SCRIPTS)/makeTargetDir $@
+ifneq ("$(WM_SILENT_RULES)","")
 	@$(WMAKE_BIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) $< | \
 		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
 			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+else
+	@$(WMAKE_BIN)/wmkdep -v -I$(*D) $(LIB_HEADER_DIRS) $< | \
+		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
+			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+endif
 
 #------------------------------------------------------------------------------
diff --git a/wmake/scripts/AllwmakeParseArguments b/wmake/scripts/AllwmakeParseArguments
index c8bb3cc..fe396b7 100644
--- a/wmake/scripts/AllwmakeParseArguments
+++ b/wmake/scripts/AllwmakeParseArguments
@@ -59,6 +59,7 @@ USAGE
 
 fromWmake=
 qOpt=
+silentRulesOpt=
 
 for arg in "$@"
 do
@@ -79,6 +80,10 @@ do
             # Permanently remove arg
             continue
             ;;
+        -silentRules)
+            silentRulesOpt="-silent-rules"
+            continue
+            ;;
         # Target type
         lib | libo | libso | dep | objects)
             targetType=$arg
@@ -96,7 +101,7 @@ done
 
 if [ -z "$fromWmake" ]
 then
-    exec wmake -all $qOpt $*
+    exec wmake -all $qOpt $silentRulesOpt $*
 fi
 
 
diff --git a/wmake/src/Makefile b/wmake/src/Makefile
index f14baad..3a04e3c 100644
--- a/wmake/src/Makefile
+++ b/wmake/src/Makefile
@@ -52,6 +52,7 @@ WM_COMPILE_OPTION = Opt
 GENERAL_RULES   = $(WM_DIR)/rules/General
 include $(GENERAL_RULES)/general
 
+cFLAGS += -Wno-unused-function
 
 #------------------------------------------------------------------------------
 # Targets
@@ -60,18 +61,32 @@ include $(GENERAL_RULES)/general
 all:  $(WMAKE_BIN)/dirToString $(WMAKE_BIN)/wmkdep
 
 clean:
+ifneq ("$(WM_SILENT_RULES)","")
+	@rm -f $(WMAKE_BIN)/* 2>/dev/null
+else
 	rm -f $(WMAKE_BIN)/* 2>/dev/null
+endif
 
 
 $(WMAKE_BIN)/dirToString: dirToString.c
 	@mkdir -p $(WMAKE_BIN)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    CC $<"
+	@$(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
+else
 	$(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
+endif
 
 
 $(WMAKE_BIN)/wmkdep: wmkdep.l
 	@mkdir -p $(WMAKE_BIN)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "   LEX $<"; flex wmkdep.l; \
+		$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+else
 	flex wmkdep.l
 	$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+endif
 	@rm -f lex.yy.c 2>/dev/null
 
 
diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index a98a597..9246ab1 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -47,6 +47,7 @@ Usage
 #include <sys/types.h>
 #include <dirent.h>
 #include <errno.h>
+#include <libgen.h>
 
 void nextFile(const char* fileName);
 void importFile(const char* fileName);
@@ -145,7 +146,7 @@ const char* bufferPaths[FILE_STACK_SIZE];
 int main(int argc, char* argv[])
 {
     char *basePos, *dotPos;
-    int i;
+    int i, verbose;
 
     if (argc == 1)
     {
@@ -154,7 +155,16 @@ int main(int argc, char* argv[])
     }
 
     sourceFile = strdup(argv[argc-1]);
-    fprintf(stderr, "Making dependency list for source file %s\n", sourceFile);
+    verbose = (strncmp(argv[1], "-v", 2) == 0);
+    if (verbose)
+    {
+        fprintf(stderr, "Making dependency list for source file %s\n",
+                sourceFile);
+    }
+    else
+    {
+        fprintf(stderr, "   DEP %s\n", basename(sourceFile));
+    }
 
 
     if ((basePos = strrchr(sourceFile, '/')) == NULL)
diff --git a/wmake/wmake b/wmake/wmake
index ebf50cd..9fde68c 100755
--- a/wmake/wmake
+++ b/wmake/wmake
@@ -76,6 +76,7 @@ options:
   -no-scheduler     Compile without wmakeScheduler
   -update           Update lnInclude directories, dep files, remove deprecated
                     files and directories
+  -silent-rules     Use silent compilation rules
   -h | -help        Print the usage
 
 
@@ -166,6 +167,10 @@ do
         -no-scheduler)
             unset WM_SCHEDULER
             ;;
+        -silent-rules)
+            export WM_SILENT_RULES=1
+            echo "Enabling silent compilation rules"
+            ;;
         # Meant to be used following a pull, this will:
         # - remove dep files that depend on deleted files;
         # - remove stale dep files;
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index a9195b9..83ac510 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -139,7 +139,12 @@ fi
 cd $incDir || exit 1
 
 [ "$silentOpt" = true ] || {
+if [ -n "$WM_SILENT_RULES" ]
+then
+    echo "    LN $incDir" 1>&2
+else
     echo "$Script: linking include files to $incDir" 1>&2
+fi
 }
 
 
-- 
2.7.4

Silent-rules.patch (14,639 bytes)   

henry

2016-11-11 22:47

manager   ~0007163

Allwmake command-line options are now handled via wmake:

./Allwmake -help

Usage: Allwmake [OPTIONS]

Executing Allwmake is equivalent to

   wmake -all [OPTIONS]

Usage: wmake [OPTION] [dir]
       wmake [OPTION] target [dir [MakeDir]]

options:
  -s | -silent 'silent' mode (does not echo commands)
  -a | -all wmake all sub-directories, running Allwmake if present
  -q | -queue wmakeQueue all sub-directories, running Allwmake if present
  -k or -non-stop Compile without stopping when errors occur
  -j Compile using all local cores/hyperthreads
  -jN or -j N Compile using N cores/hyperthreads
  -no-scheduler Compile without wmakeScheduler
  -update Update lnInclude directories, dep files, remove deprecated
                    files and directories
  -h | -help Print the usage


A general, easy-to-use make system for multi-platform development
with support for local and network parallel compilation.

The 'target' is a Makefile target:
  e.g., platforms/linux64GccDPOpt/.../fvMesh.o

or a special target:
  all wmake all sub-directories, running Allwmake if present
  queue wmakeQueue all sub-directories, running Allwmake if present
  exe Compile statically linked executable
  lib Compile statically linked archive lib (.a)
  libo Compile statically linked lib (.o)
  libso Compile dynamically linked lib (.so)
  dep Compile lnInclude and dependencies only
  updatedep Compile dependencies only (in case of broken dependencies)
  objects Compile but not link

alexeym

2016-11-12 09:49

reporter   ~0007165

Removed -silentRules in AllwmakeParseArguments. So now it is either -silent-rules in wmake/Allwmake invocation or export WM_SILENT_RULES=Y to enable it globally.
0001-Silent-rules-for-wmake.patch (13,698 bytes)   
From 1e220b033279e199728e2fa3725bb0cb88c2fc22 Mon Sep 17 00:00:00 2001
From: Alexey Matveichev <github@matveichev.com>
Date: Sat, 12 Nov 2016 10:42:00 +0100
Subject: [PATCH] Silent rules for wmake

Added WM_SILENT_RULES check to wmake rules to produce compact output:

$ ./Allwmake -silent-rules
Enabling silent compilation rules
/home/alexey/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
    LN ./lnInclude
   DEP springRenumber.C
   DEP randomRenumber.C
   DEP OppositeFaceCellWaveName.C
   DEP structuredRenumber.C
   DEP CuthillMcKeeRenumber.C
   DEP manualRenumber.C
   DEP renumberMethod.C
    CC renumberMethod.C
    CC manualRenumber.C
    CC CuthillMcKeeRenumber.C
    CC randomRenumber.C
    CC springRenumber.C
    CC structuredRenumber.C
    CC OppositeFaceCellWaveName.C
    LD librenumberMethods.so
->> librenumberMethods.so

The behavior is enables by

1. WM_SILENT_RULES environment variable.
2. -silent-rules command line option for wmake/Allwmake.
---
 etc/bashrc                    |  2 ++
 wmake/makefiles/general       | 49 ++++++++++++++++++++++++++++++++++++++++++-
 wmake/rules/General/bison     | 13 ++++++++++++
 wmake/rules/General/btyacc    |  8 +++++++
 wmake/rules/General/btyacc++  |  7 +++++++
 wmake/rules/General/byacc     |  7 +++++++
 wmake/rules/General/flex      |  5 +++++
 wmake/rules/General/flex++    |  5 +++++
 wmake/rules/General/moc       |  6 ++++++
 wmake/rules/General/transform | 11 ++++++++++
 wmake/src/Makefile            | 15 +++++++++++++
 wmake/src/wmkdep.l            | 14 +++++++++++--
 wmake/wmake                   |  4 ++++
 wmake/wmakeLnInclude          |  5 +++++
 14 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/etc/bashrc b/etc/bashrc
index 8b59bc2..4457726 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -138,6 +138,8 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
 # Add in preset user or site preferences:
 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
 
+[ -n "$WM_SILENT_RULES" ] && export WM_SILENT_RULES
+
 # Evaluate command-line parameters and record settings for later
 # these can be used to set/unset values, or specify alternative pref files
 export FOAM_SETTINGS="$@"
diff --git a/wmake/makefiles/general b/wmake/makefiles/general
index b7f4935..6905b6a 100644
--- a/wmake/makefiles/general
+++ b/wmake/makefiles/general
@@ -130,17 +130,34 @@ LIB_HEADER_DIRS = \
 
 $(EXE): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(EXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(EXE))"
+	@$(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
+	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
+	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
+else
 	$(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
 	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
+endif
 
 exe:    $(SEXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir SEXE)"
+else
 	@echo \'$(SEXE)\' is up to date.
+endif
 
 $(SEXE):$(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(SEXE))"
+	@$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
+	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
+else
 	$(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
 	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
+endif
 
 
 #------------------------------------------------------------------------------
@@ -150,29 +167,59 @@ $(SEXE):$(OBJECTS)
 objects: $(OBJECTS)
 
 libso:  $(LIB).$(SO)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).$(SO)"
+else
 	@echo \'$(LIB).$(SO)\' is up to date.
+endif
 
 $(LIB).$(SO): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(LIB)).$(SO)"
+	@$(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
+	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
+else
 	$(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
+endif
 
 lib:    $(LIB).a
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).a"
+else
 	@echo \'$(LIB).a\' is up to date.
+endif
 
 $(LIB).a: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).a
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    AR $(notdir $(LIB))"
+	@$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
+	@echo "RANLIB $(notdir $(LIB))"
+	@$(RANLIB) $(LIB).a
+else
 	$(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
 	$(RANLIB) $(LIB).a
+endif
 
 libo:   $(LIB).o
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "->> $(notdir $(LIB)).o"
+else
 	@echo \'$(LIB).o\' is up to date.
+endif
 
 $(LIB).o: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).o
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    LD $(notdir $(LIB)).o"
+	@$(LD) -r -o $(LIB).o $(OBJECTS)
+else
 	$(LD) -r -o $(LIB).o $(OBJECTS)
+endif
 
 
 #------------------------------------------------------------------------------
@@ -205,4 +252,4 @@ ifeq ($(findstring lnInclude,$(MAKECMDGOALS))$(findstring updatedep,$(MAKECMDGOA
 endif
 
 
-#------------------------------------------------------------------------------
+#----------------------------- vim: set ft=make: ------------------------------
diff --git a/wmake/rules/General/bison b/wmake/rules/General/bison
index 4811b0e..7cb4cb5 100644
--- a/wmake/rules/General/bison
+++ b/wmake/rules/General/bison
@@ -1,5 +1,17 @@
 SUFFIXES += .y .Y
 
+
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).c $(AND) \
+    mv y.tab.h $(@D)/$(<F).h $(AND) \
+    $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+
+Ytoo = @echo "    YY $<"; $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).C $(AND) \
+    mv y.tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c  $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).c $(AND) \
     mv y.tab.h $(@D)/$(<F).h $(AND) \
@@ -9,3 +21,4 @@ Ytoo = $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c  $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/btyacc b/wmake/rules/General/btyacc
index 90124eb..dac790d 100644
--- a/wmake/rules/General/btyacc
+++ b/wmake/rules/General/btyacc
@@ -1,6 +1,14 @@
 SUFFIXES += .y
 
+
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
+    mv y_tab.c $(@D)/$(<F).C $(AND) \
+    mv y_tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/btyacc++ b/wmake/rules/General/btyacc++
index 2aa66cc..a8f4b4c 100644
--- a/wmake/rules/General/btyacc++
+++ b/wmake/rules/General/btyacc++
@@ -1,6 +1,13 @@
 SUFFIXES += .Y
 
+ifneq ("$(WM_SILENT_RULES)","")
+Ytoo = @echo "    YY $<"; $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
+    mv y_tab.c $(@D)/$(<F).C $(AND) \
+    mv y_tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 Ytoo = $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/byacc b/wmake/rules/General/byacc
index 1777338..f150ecc 100644
--- a/wmake/rules/General/byacc
+++ b/wmake/rules/General/byacc
@@ -1,6 +1,13 @@
 SUFFIXES += .y
 
+ifneq ("$(WM_SILENT_RULES)","")
+ytoo = @echo "    yy $<"; $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
+    mv y.tab.c $(@D)/$(<F).C $(AND) \
+    mv y.tab.h $(@D)/$(<F).H $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 ytoo = $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/flex b/wmake/rules/General/flex
index 3f2fe37..850f2f6 100644
--- a/wmake/rules/General/flex
+++ b/wmake/rules/General/flex
@@ -1,4 +1,9 @@
 SUFFIXES += .l
 
+ifneq ("$(WM_SILENT_RULES)","")
+ltoo = @echo "   LEX $<"; $(WM_SCHEDULER) flex -o $(@D)/$(<F).c $< $(AND) \
+    $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+else
 ltoo = $(WM_SCHEDULER) flex -o $(@D)/$(<F).c $< $(AND) \
     $(cc) $(cFLAGS) -c  $(@D)/$(<F).c -o $@
+endif
diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++
index 4a14062..52afe37 100644
--- a/wmake/rules/General/flex++
+++ b/wmake/rules/General/flex++
@@ -1,4 +1,9 @@
 SUFFIXES += .L
 
+ifneq ("$(WM_SILENT_RULES)","")
+Ltoo = @echo "   LEX $<"; $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
+    $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
+else
 Ltoo = $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
     $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/moc b/wmake/rules/General/moc
index 02a0758..0e139f9 100644
--- a/wmake/rules/General/moc
+++ b/wmake/rules/General/moc
@@ -1,4 +1,10 @@
 SUFFIXES += .qt
 
+ifneq ("$(WM_SILENT_RULES)","")
+qttoo = @echo "   MOC $<"; \
+    $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
+    $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+else
 qttoo = $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
+endif
diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform
index 3fa0152..5787da7 100644
--- a/wmake/rules/General/transform
+++ b/wmake/rules/General/transform
@@ -2,15 +2,26 @@
 
 define DEFINE_TRANSFORM
 $(OBJECTS_DIR)/%.o : %$1
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    CC $(value <F)"
+	@$$($(subst .,,$(1))too)
+else
 	$$($(subst .,,$(1))too)
+endif
 endef
 
 $(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))
 
 $(OBJECTS_DIR)/%.dep : %
 	@$(WM_SCRIPTS)/makeTargetDir $@
+ifneq ("$(WM_SILENT_RULES)","")
 	@$(WMAKE_BIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) $< | \
 		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
 			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+else
+	@$(WMAKE_BIN)/wmkdep -v -I$(*D) $(LIB_HEADER_DIRS) $< | \
+		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
+			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+endif
 
 #------------------------------------------------------------------------------
diff --git a/wmake/src/Makefile b/wmake/src/Makefile
index f14baad..3a04e3c 100644
--- a/wmake/src/Makefile
+++ b/wmake/src/Makefile
@@ -52,6 +52,7 @@ WM_COMPILE_OPTION = Opt
 GENERAL_RULES   = $(WM_DIR)/rules/General
 include $(GENERAL_RULES)/general
 
+cFLAGS += -Wno-unused-function
 
 #------------------------------------------------------------------------------
 # Targets
@@ -60,18 +61,32 @@ include $(GENERAL_RULES)/general
 all:  $(WMAKE_BIN)/dirToString $(WMAKE_BIN)/wmkdep
 
 clean:
+ifneq ("$(WM_SILENT_RULES)","")
+	@rm -f $(WMAKE_BIN)/* 2>/dev/null
+else
 	rm -f $(WMAKE_BIN)/* 2>/dev/null
+endif
 
 
 $(WMAKE_BIN)/dirToString: dirToString.c
 	@mkdir -p $(WMAKE_BIN)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "    CC $<"
+	@$(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
+else
 	$(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
+endif
 
 
 $(WMAKE_BIN)/wmkdep: wmkdep.l
 	@mkdir -p $(WMAKE_BIN)
+ifneq ("$(WM_SILENT_RULES)","")
+	@echo "   LEX $<"; flex wmkdep.l; \
+		$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+else
 	flex wmkdep.l
 	$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+endif
 	@rm -f lex.yy.c 2>/dev/null
 
 
diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index a98a597..9246ab1 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -47,6 +47,7 @@ Usage
 #include <sys/types.h>
 #include <dirent.h>
 #include <errno.h>
+#include <libgen.h>
 
 void nextFile(const char* fileName);
 void importFile(const char* fileName);
@@ -145,7 +146,7 @@ const char* bufferPaths[FILE_STACK_SIZE];
 int main(int argc, char* argv[])
 {
     char *basePos, *dotPos;
-    int i;
+    int i, verbose;
 
     if (argc == 1)
     {
@@ -154,7 +155,16 @@ int main(int argc, char* argv[])
     }
 
     sourceFile = strdup(argv[argc-1]);
-    fprintf(stderr, "Making dependency list for source file %s\n", sourceFile);
+    verbose = (strncmp(argv[1], "-v", 2) == 0);
+    if (verbose)
+    {
+        fprintf(stderr, "Making dependency list for source file %s\n",
+                sourceFile);
+    }
+    else
+    {
+        fprintf(stderr, "   DEP %s\n", basename(sourceFile));
+    }
 
 
     if ((basePos = strrchr(sourceFile, '/')) == NULL)
diff --git a/wmake/wmake b/wmake/wmake
index ebf50cd..672fc00 100755
--- a/wmake/wmake
+++ b/wmake/wmake
@@ -76,6 +76,7 @@ options:
   -no-scheduler     Compile without wmakeScheduler
   -update           Update lnInclude directories, dep files, remove deprecated
                     files and directories
+  -silent-rules     Use silent compilation rules
   -h | -help        Print the usage
 
 
@@ -166,6 +167,9 @@ do
         -no-scheduler)
             unset WM_SCHEDULER
             ;;
+        -silent-rules)
+            export WM_SILENT_RULES=1
+            ;;
         # Meant to be used following a pull, this will:
         # - remove dep files that depend on deleted files;
         # - remove stale dep files;
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index a9195b9..83ac510 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -139,7 +139,12 @@ fi
 cd $incDir || exit 1
 
 [ "$silentOpt" = true ] || {
+if [ -n "$WM_SILENT_RULES" ]
+then
+    echo "    LN $incDir" 1>&2
+else
     echo "$Script: linking include files to $incDir" 1>&2
+fi
 }
 
 
-- 
2.7.4

henry

2016-11-12 12:01

manager   ~0007166

I am working on this at the moment and wondering if both the -s | -silent and -silent-rules are needed, my feeling is that either -silent-rules should replace the current -silent option or they should be combined.

henry

2016-11-12 13:41

manager   ~0007167

I am not happy with the amount of clutter and code duplication this change introduces, for example

 
 $(OBJECTS_DIR)/%.dep : %
        @$(WM_SCRIPTS)/makeTargetDir $@
+ifneq ("$(WM_SILENT_RULES)","")
        @$(WMAKE_BIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) $< | \
                sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
                        -e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+else
+ @$(WMAKE_BIN)/wmkdep -v -I$(*D) $(LIB_HEADER_DIRS) $< | \
+ sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
+ -e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
+endif

where the only difference between the calls to wmkdep appears to be the '-v' option. Would it be better to define this additional argument according to the setting of WM_SILENT_RULES?

Even the duplication in

 define DEFINE_TRANSFORM
 $(OBJECTS_DIR)/%.o : %$1
+ifneq ("$(WM_SILENT_RULES)","")
+ @echo " CC $(value <F)"
+ @$$($(subst .,,$(1))too)
+else
        $$($(subst .,,$(1))too)
+endif
 endef
 
could be avoided by setting a prefix variable which is either '@' or '' depending on the value of WM_SILENT_RULES.

henry

2016-11-12 16:52

manager   ~0007168

This basically hangs together and avoids the code duplication by switching the definitions of E and the function SILENT_MESSAGE. I think it should be renamed QUIET rather than SILENT because it isn't actually silent.

#-------------------------------*- makefile -*---------------------------------

ifeq ("$(WM_SILENT_RULES)","")
    E=

    define SILENT_MESSAGE
        @echo $1
    endef

    SILENT_OP=-s
else
    E=@

    define SILENT_MESSAGE
        @echo $1
    endef

    SILENT_OP=
endif

define DEFINE_TRANSFORM
$(OBJECTS_DIR)/%.o : %$1
    $(call SILENT_MESSAGE, " Compile $(value <F)")
    $E $$($(subst .,,$(1))too)
endef

$(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))

$(OBJECTS_DIR)/%.dep : %
    @$(WM_SCRIPTS)/makeTargetDir $@
    $E $(WMAKE_BIN)/wmkdep $(SILENT_OP) -I$(*D) $(LIB_HEADER_DIRS) $< | \
        sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
            -e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@

#------------------------------------------------------------------------------

henry

2016-11-12 18:41

manager   ~0007169

I have updated most of the wmake files without all the mess and code duplication and can now build with the '-s' option but it interacts badly with the '-q' option which will require more digging, careful testing and tweaking.

Have you tried your version with the '-q' option?

alexeym

2016-11-12 21:40

reporter   ~0007170

The patch originated from 4.x, so it (just like me) does not know anything about -q option. I have checked compatibility and it is awful due to non-propagation of command line options. I will update patch ASAP (not quite sure I will be able to integrate your modifications).

henry

2016-11-12 22:13

manager   ~0007171

I have updated wmakeCollect to handle WM_QUIET and now the behavior is reasonable although there are quite a few other messages generated by wmake which could do with the same treatment. I have changed all of the wmake/rules/General files to use the 'E' and 'QUIET_MESSAGE' macros to avoid the proliferation of conditional statements and the result is much cleaner. I have committed all of the changes so far:

OpenFOAM-dev commit a0094dee381c838314a17bca95c842d4253dbf17

I assumed you were running OpenFOAM-dev given that you opened this patch request for 'dev'. I recommend using the '-q' option which speeds-up compilation on a multi-core machine significantly and is proving very reliable.

alexeym

2016-11-13 09:14

reporter   ~0007172

What I have noticed so far:

1. wmake/src/Makefile: extra $E in front of $(cc) in wmkdep rule. It breaks "make WM_QUIET=1".
2. Is too suffix to be kept in DEFINE_TRANSFORM's QUIET_MESSAGE argument? Or it could be just

$(call QUIET_MESSAGE, " $(subst .,,$(1)): $(value <F)")

3. Quiet additions in rules/General/yacc are missing, guess, in my patch they were also absent.

4. Alignment: I would like to propose align : symbol by longest command (btyacc++ so far), so the output is like:

daphne:renumber$ ./Allwmake -s
$HOME/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
      ln: ./lnInclude
  wmkdep: OppositeFaceCellWaveName.C
  wmkdep: springRenumber.C
  wmkdep: structuredRenumber.C
  wmkdep: randomRenumber.C
  wmkdep: CuthillMcKeeRenumber.C
  wmkdep: manualRenumber.C
  wmkdep: renumberMethod.C
       C: manualRenumber.C
       C: renumberMethod.C
       C: CuthillMcKeeRenumber.C
       C: randomRenumber.C
       C: springRenumber.C
       C: structuredRenumber.C
       C: OppositeFaceCellWaveName.C
      ld: librenumberMethods.so
->> $HOME/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so
wmake-quiet-cosmetic-changes.patch (7,185 bytes)   
diff --git a/wmake/makefiles/general b/wmake/makefiles/general
index 7921ee0..04b5147 100644
--- a/wmake/makefiles/general
+++ b/wmake/makefiles/general
@@ -130,7 +130,7 @@ LIB_HEADER_DIRS = \
 
 $(EXE): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(EXE)
-	$(call QUIET_MESSAGE, "    ld: $(notdir $(EXE))")
+	$(call QUIET_MESSAGE, "      ld: $(notdir $(EXE))")
 	$E $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) \
 	    $(LINK_LIBS) $(GLIBS) -o $(EXE)
@@ -140,7 +140,7 @@ exe:    $(SEXE)
 
 $(SEXE):$(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(SEXE)
-	$(call QUIET_MESSAGE, "    ld: $(notdir $(SEXE))")
+	$(call QUIET_MESSAGE, "      ld: $(notdir $(SEXE))")
 	$E $(LINKEXE) $(OBJECTS) $(EXE_LIBS) \
 	    $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(SEXE)
 
@@ -156,7 +156,7 @@ libso:  $(LIB).$(SO)
 
 $(LIB).$(SO): $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
-	$(call QUIET_MESSAGE, "    ld: $(notdir $(LIB)).$(SO)")
+	$(call QUIET_MESSAGE, "      ld: $(notdir $(LIB)).$(SO)")
 	$E $(LINKLIBSO) $(OBJECTS) -L$(LIB_PLATFORMS) \
 	    $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO)
 
@@ -166,9 +166,9 @@ lib:    $(LIB).a
 $(LIB).a: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).a
-	$(call QUIET_MESSAGE, "    ar: $(notdir $(LIB))")
+	$(call QUIET_MESSAGE, "      ar: $(notdir $(LIB))")
 	$E $(AR) $(ARFLAGS) $(LIB).a $(OBJECTS)
-	$(call QUIET_MESSAGE, "    ranlib: $(notdir $(LIB))")
+	$(call QUIET_MESSAGE, "  ranlib: $(notdir $(LIB))")
 	$E $(RANLIB) $(LIB).a
 
 libo:   $(LIB).o
@@ -177,7 +177,7 @@ libo:   $(LIB).o
 $(LIB).o: $(OBJECTS)
 	@$(WM_SCRIPTS)/makeTargetDir $(LIB)
 	@rm -f $(LIB).o
-	$(call QUIET_MESSAGE, "    ld: $(notdir $(LIB)).o")
+	$(call QUIET_MESSAGE, "      ld: $(notdir $(LIB)).o")
 	$E $(LD) -r -o $(LIB).o $(OBJECTS)
 
 
diff --git a/wmake/rules/General/bison b/wmake/rules/General/bison
index 85ce618..031e90c 100644
--- a/wmake/rules/General/bison
+++ b/wmake/rules/General/bison
@@ -1,6 +1,6 @@
 SUFFIXES += .y .Y
 
-ytoo = $E $(call QUIET_MESSAGE, "    bison: $(<F)) \
+ytoo = $E $(call QUIET_MESSAGE, "   bison: $(<F)) \
     $(WM_SCHEDULER) bison -v -d -y $< $(AND) \
     mv y.tab.c $(@D)/$(<F).c $(AND) \
     mv y.tab.h $(@D)/$(<F).h $(AND) \
diff --git a/wmake/rules/General/btyacc b/wmake/rules/General/btyacc
index 9886c38..b7d86d3 100644
--- a/wmake/rules/General/btyacc
+++ b/wmake/rules/General/btyacc
@@ -1,6 +1,6 @@
 SUFFIXES += .y
 
-ytoo = $E $(call QUIET_MESSAGE, "    btyacc: $(<F)") \
+ytoo = $E $(call QUIET_MESSAGE, "  btyacc: $(<F)") \
     $(WM_SCHEDULER) btyacc -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
diff --git a/wmake/rules/General/btyacc++ b/wmake/rules/General/btyacc++
index 632626a..bdb505d 100644
--- a/wmake/rules/General/btyacc++
+++ b/wmake/rules/General/btyacc++
@@ -1,6 +1,6 @@
 SUFFIXES += .Y
 
-Ytoo = $E $(call QUIET_MESSAGE, "    btyacc++: $(<F)") \
+Ytoo = $E $(call QUIET_MESSAGE, "btyacc++: $(<F)") \
     $(WM_SCHEDULER) btyacc++ -v -d $(SKELETON) $< $(AND) \
     mv y_tab.c $(@D)/$(<F).C $(AND) \
     mv y_tab.h $(@D)/$(<F).H $(AND) \
diff --git a/wmake/rules/General/byacc b/wmake/rules/General/byacc
index bdb0444..6bfdc79 100644
--- a/wmake/rules/General/byacc
+++ b/wmake/rules/General/byacc
@@ -1,6 +1,6 @@
 SUFFIXES += .y
 
-ytoo = $E $(call QUIET_MESSAGE, "    byacc: $(<F)") \
+ytoo = $E $(call QUIET_MESSAGE, "   byacc: $(<F)") \
     $(WM_SCHEDULER) byacc -v $(YYPREFIX) -d $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/$(<F).H $(AND) \
diff --git a/wmake/rules/General/flex++ b/wmake/rules/General/flex++
index 98dfd23..d72ccc4 100644
--- a/wmake/rules/General/flex++
+++ b/wmake/rules/General/flex++
@@ -1,5 +1,5 @@
 SUFFIXES += .L
 
-Ltoo = $E $(call QUIET_MESSAGE, "    flex++: $(<F)") \
+Ltoo = $E $(call QUIET_MESSAGE, "  flex++: $(<F)") \
     $(WM_SCHEDULER) flex -+ -o$(@D)/$(<F).C -f $< $(AND) \
     $(CC) $(c++FLAGS) $(c++LESSWARN) -c $(@D)/$(<F).C -o $@
diff --git a/wmake/rules/General/moc b/wmake/rules/General/moc
index 1ec5cf8..cac92e8 100644
--- a/wmake/rules/General/moc
+++ b/wmake/rules/General/moc
@@ -1,5 +1,5 @@
 SUFFIXES += .qt
 
-qttoo = $E $(call QUIET_MESSAGE, "    moc: $(<F)") \
+qttoo = $E $(call QUIET_MESSAGE, "     moc: $(<F)") \
        $(WM_SCHEDULER) $(QTDIR)/bin/moc -f $< -o $(@D)/$(<F).C $(AND) \
        $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform
index 205368f..fcec11d 100644
--- a/wmake/rules/General/transform
+++ b/wmake/rules/General/transform
@@ -15,7 +15,7 @@ endif
 
 define DEFINE_TRANSFORM
 $(OBJECTS_DIR)/%.o : %$1
-	$(call QUIET_MESSAGE, "    $(subst .,,$(1))too: $(value <F)")
+	$(call QUIET_MESSAGE, "       $(subst .,,$(1)): $(value <F)")
 	$E $$($(subst .,,$(1))too)
 endef
 
diff --git a/wmake/rules/General/yacc b/wmake/rules/General/yacc
index 18d8902..c17a8cc 100644
--- a/wmake/rules/General/yacc
+++ b/wmake/rules/General/yacc
@@ -1,11 +1,13 @@
 SUFFIXES += .y .Y
 
-ytoo = $(WM_SCHEDULER) yacc -v -d $< $(AND) \
+ytoo = $E $(call QUIET_MESSAGE, "    yacc: $(<F)") \
+    	$(WM_SCHEDULER) yacc -v -d $< $(AND) \
     mv y.tab.c $(@D)/$(<F).c $(AND) \
     mv y.tab.h $(@D)/parser.h $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).c -o $@
 
-Ytoo = $(WM_SCHEDULER) yacc -v -d $< $(AND) \
+Ytoo = $E $(call QUIET_MESSAGE, "    yacc: $(<F)") \
+    $(WM_SCHEDULER) yacc -v -d $< $(AND) \
     mv y.tab.c $(@D)/$(<F).C $(AND) \
     mv y.tab.h $(@D)/parser.H $(AND) \
     $(CC) $(c++FLAGS) -c $(@D)/$(<F).C -o $@
diff --git a/wmake/src/Makefile b/wmake/src/Makefile
index c24ac81..d2bc717 100644
--- a/wmake/src/Makefile
+++ b/wmake/src/Makefile
@@ -60,18 +60,18 @@ include $(GENERAL_RULES)/general
 all:  $(WMAKE_BIN)/dirToString $(WMAKE_BIN)/wmkdep
 
 clean:
-	@E rm -f $(WMAKE_BIN)/* 2>/dev/null
+	$(E)rm -f $(WMAKE_BIN)/* 2>/dev/null
 
 $(WMAKE_BIN)/dirToString: dirToString.c
 	@mkdir -p $(WMAKE_BIN)
-	$(call QUIET_MESSAGE, "    compile: $<")
+	$(call QUIET_MESSAGE, "     c: $<")
 	$E $(cc) $(cFLAGS) dirToString.c -o $(WMAKE_BIN)/dirToString
 
 $(WMAKE_BIN)/wmkdep: wmkdep.l
 	@mkdir -p $(WMAKE_BIN)
 	$(call QUIET_MESSAGE, "   lex: $<")
-	$E flex wmkdep.l; \
-	$E $(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
+	$(E) flex wmkdep.l; \
+		$(cc) $(cFLAGS) lex.yy.c -o $(WMAKE_BIN)/wmkdep
 	@rm -f lex.yy.c 2>/dev/null
 
 
diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index 81bede8..941e778 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -158,7 +158,7 @@ int main(int argc, char* argv[])
     silent = (strncmp(argv[1], "-s", 2) == 0);
     if (silent)
     {
-        fprintf(stderr, "    wmkdep: %s\n", basename(sourceFile));
+        fprintf(stderr, "  wmkdep: %s\n", basename(sourceFile));
     }
     else
     {
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index 3db3802..171f7e6 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -140,7 +140,7 @@ cd $incDir || exit 1
 
 if [ "$silentOpt" = true -o -n "$WM_QUIET" ]
 then
-    echo "    ln: $incDir" 1>&2
+    echo "      ln: $incDir" 1>&2
 else
     echo "$Script: linking include files to $incDir" 1>&2
 fi

henry

2016-11-13 09:52

manager   ~0007173

1. I haven't tested

2. The conversion rule is .*too because it converts to '.o'

3. OK, I will make this change.

4. Your proposed alignment looks odd; what is the advantage in having the 'C' align with the 'k' of wmkdep?

alexeym

2016-11-13 10:07

reporter   ~0007174

2. Then wmkdep label should be Ctodep. It is a matter of preferences having Ctoo or just C, so let it be Ctoo.

4. Variable width fonts break alignment in the note, with fixed width fonts output looks more aligned. See attached build.log.
build.log (689 bytes)   
daphne:renumber$ ./Allwmake -s
/home/alexey/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
      ln: ./lnInclude
  wmkdep: OppositeFaceCellWaveName.C
  wmkdep: springRenumber.C
  wmkdep: structuredRenumber.C
  wmkdep: randomRenumber.C
  wmkdep: CuthillMcKeeRenumber.C
  wmkdep: manualRenumber.C
  wmkdep: renumberMethod.C
       C: manualRenumber.C
       C: renumberMethod.C
       C: CuthillMcKeeRenumber.C
       C: randomRenumber.C
       C: springRenumber.C
       C: structuredRenumber.C
       C: OppositeFaceCellWaveName.C
      ld: librenumberMethods.so
->> /home/alexey/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so

Skipping zoltanRenumber

build.log (689 bytes)   

henry

2016-11-13 10:21

manager   ~0007175

2. wmkdep is a conversion command whereas for the conversion of .C to .o the conversion command is actually either g++, clang++, icpc etc, which are wrapped into the Ctoo. It might be possible to work out which compiler is actually being used in the Ctoo macro and print that instead.

Note that wmake is not C++ specific and other langauage files can be converted into .o files so we should not hard-code the message for C++.

4. I don't see this as better than simple left justification, it would be better to use a 2-column format with left justification for the command space then the ':' in a column and the source file. This should not be done with spaces because it would require ALL of the message strings to be changed if a new conversion command is added which longer than the current commands.

alexeym

2016-11-13 11:02

reporter   ~0007176

wmake/rules/General/bison: missing closing " in QUIET_MESSAGE call

4. Initial idea behind silent rules is to reduce cognitive load while looking at build log files. The same reasoning is behind two-column output: first column is WHAT we are doing, second column is WHERE we are doing it. One can use left alignment in both columns and separate them with tabs; or it is possible to use printf command to right-align left column. Former solution needs additional variable: left column width.

henry

2016-11-13 11:15

manager   ~0007177

I found the problem in bison and fixed it while simplifying the QUIET_MESSAGE function

4. I don't have a problem with either left-justified one-column or two-column format but the two-column format would take additional effort.

henry

2016-11-13 11:22

manager   ~0007178

I have pushed the simplified QUIET_MESSAGE function:

commit 2b3f1d6a41b6cbb84d918bfefa70315b9d85dfa4

alexeym

2016-11-13 15:26

reporter   ~0007182

With simplified QUIET_MESSAGE function alignment implementation is rather simple. See my attempt in attachment.

-q flag's behavoiur right now is rather strange:

daphne:renumber$ ./Allwmake -q -s
wmakeLnIncludeAll: starting wmakeLnInclude processes on 4 cores
    searching . for 'Make' directories
        ln: ./SloanRenumber/lnInclude
        ln: ./zoltanRenumber/lnInclude
        ln: ./renumberMethods/lnInclude
$HOME/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
    wmkdep: OppositeFaceCellWaveName.C
    wmkdep: structuredRenumber.C
    wmkdep: randomRenumber.C
    wmkdep: springRenumber.C
    wmkdep: CuthillMcKeeRenumber.C
    wmkdep: manualRenumber.C
    wmkdep: renumberMethod.C
      Ctoo: renumberMethod.C
      Ctoo: manualRenumber.C
      Ctoo: randomRenumber.C
      Ctoo: CuthillMcKeeRenumber.C
      Ctoo: springRenumber.C
      Ctoo: structuredRenumber.C
      Ctoo: OppositeFaceCellWaveName.C

Skipping zoltanRenumber


    compiling: renumberMethod.C
    compiling: randomRenumber.C
    compiling: manualRenumber.C
    compiling: CuthillMcKeeRenumber.C
    compiling: structuredRenumber.C
    compiling: springRenumber.C
    compiling: OppositeFaceCellWaveName.C
/home/alexey/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
        ld: librenumberMethods.so
->> $HOME/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so

without -s flag files are also compiled twice.
0001-Colon-alignment.patch (4,428 bytes)   
From 796b3ef2d579d3364ae91e53ee4ad641bf21454e Mon Sep 17 00:00:00 2001
From: Alexey Matveichev <github@matveichev.com>
Date: Sun, 13 Nov 2016 16:17:35 +0100
Subject: [PATCH] Colon alignment

Align colon in silent rules according to WM_SILENT_LEFT_COLUMN_WIDTH
environment variable or use default value of 10.

1. rightAlign function in wmkdep.
2. RIGHT_ALIGN function in transform.
3. printf for alignment in wmakeLnInclude.
---
 wmake/rules/General/transform |  6 +++++-
 wmake/src/wmkdep.l            | 41 +++++++++++++++++++++++++++++++++++++++--
 wmake/wmakeLnInclude          | 10 ++++++++--
 3 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform
index 427cc25..fa4f3a5 100644
--- a/wmake/rules/General/transform
+++ b/wmake/rules/General/transform
@@ -1,9 +1,13 @@
 #-------------------------------*- makefile -*---------------------------------
 
+WM_SILENT_LEFT_COLUMNT_DEFAULT_WIDTH := 10
+
+RIGHT_ALIGN = $(shell printf "%*s" $(if $(WM_SILENT_LEFT_COLUMN_WIDTH),$(WM_SILENT_LEFT_COLUMN_WIDTH),$(WM_SILENT_LEFT_COLUMNT_DEFAULT_WIDTH)) $(1))
+
 ifneq ("$(WM_QUIET)","")
     E=@
     define QUIET_MESSAGE
-        @echo "    $1: $2";
+        @echo "$(call RIGHT_ALIGN,$1): $2";
     endef
     QUIET_OP=-s
 else
diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index 81bede8..78e83c5 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -41,6 +41,7 @@ Usage
 
 #define FILE_STACK_SIZE 300
 #define HASH_TABLE_SIZE 500
+#define DEFAULT_LEFT_COLUMN_WIDTH 10
 
 #include <stdlib.h>
 #include <string.h>
@@ -52,6 +53,7 @@ Usage
 void nextFile(const char* fileName);
 void importFile(const char* fileName);
 void importDir(const char* dirName);
+char* rightAlign(const char* str);
 
 #undef yywrap        /* sometimes a macro by default */
 
@@ -145,7 +147,7 @@ const char* bufferPaths[FILE_STACK_SIZE];
 
 int main(int argc, char* argv[])
 {
-    char *basePos, *dotPos;
+    char *basePos, *dotPos, *leftColumn = NULL;
     int i, silent;
 
     if (argc == 1)
@@ -158,7 +160,10 @@ int main(int argc, char* argv[])
     silent = (strncmp(argv[1], "-s", 2) == 0);
     if (silent)
     {
-        fprintf(stderr, "    wmkdep: %s\n", basename(sourceFile));
+        leftColumn = rightAlign("wmkdep");
+        fprintf(stderr, "%s: %s\n", leftColumn, basename(sourceFile));
+        if (leftColumn != NULL)
+            free(leftColumn);
     }
     else
     {
@@ -270,6 +275,38 @@ int main(int argc, char* argv[])
 
 
 /*
+ * Write right-aligned str to dst
+ */
+char* rightAlign(const char* str)
+{
+    char *dst;
+    int columnWidth = DEFAULT_LEFT_COLUMN_WIDTH;
+    int len = strlen(str);
+    int didx, sidx;
+    char *lcw = getenv("WM_SILENT_LEFT_COLUMN_WIDTH");
+    if (lcw != NULL)
+    {
+        columnWidth = atoi(lcw);
+    }
+    if (len > columnWidth)
+    {
+        columnWidth = strlen(str);
+    }
+    dst = (char*) calloc(columnWidth, sizeof(char));
+    memset(dst, 32, columnWidth - 1);
+    didx = columnWidth - 1;
+    sidx = len - 1;
+    while (sidx >= 0)
+    {
+        dst[didx] = str[sidx];
+        didx--;
+        sidx--;
+    }
+    return dst;
+}
+
+
+/*
  * Add a directory name to the file name
  */
 char* addDirectoryName(const char* dirName, const char* fileName)
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index 3db3802..fd06a14 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -40,6 +40,8 @@
 #------------------------------------------------------------------------------
 Script=${0##*/}
 
+WM_SILENT_LEFT_COLUMN_DEFAULT_WIDTH=10
+
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -140,7 +142,11 @@ cd $incDir || exit 1
 
 if [ "$silentOpt" = true -o -n "$WM_QUIET" ]
 then
-    echo "    ln: $incDir" 1>&2
+    lnStr=$(printf "%*s" $WM_SILENT_LEFT_COLUMN_DEFAULT_WIDTH "ln")
+    [ -n "$WM_SILENT_LEFT_COLUMN_WIDTH" ] && {
+    lnStr=$(printf "%*s" $WM_SILENT_LEFT_COLUMN_WIDTH "ln")
+    }
+    echo "${lnStr}: $incDir" 1>&2
 else
     echo "$Script: linking include files to $incDir" 1>&2
 fi
@@ -172,7 +178,7 @@ find .. $findOpt \
 # Cleanup local variables and functions
 #------------------------------------------------------------------------------
 
-unset Script usage
+unset Script usage WM_SILENT_LEFT_COLUMN_DEFAULT_WIDTH
 
 
 #------------------------------------------------------------------------------
-- 
2.7.4

0001-Colon-alignment.patch (4,428 bytes)   

henry

2016-11-13 15:39

manager   ~0007185

It is not compiling twice, it first generates a complete Makefile for all the object file compilations by running wmake echo'ing the commands into files which are then collected and the Makefile executed with make. For this second (real compilation) stage it is diffult to get hold of the actual compilation command so I put in "compiling:" instead.

You will notice that the complete build is significantly quicker than without the '-q'.

henry

2016-11-13 15:44

manager   ~0007186

This adds a lot of clutter to wmkdep duplicating in C what is also written in the Makefile. It would probably be better if the messaging from wmkdep.l is removed and the appropriate messages generated in the Makefile.

henry

2016-11-13 15:49

manager   ~0007187

Is the log in your last post generated with the new alignment function?
This alignment looks the same as your original format which does not left-justify the commands but aligns the ':'s which looks awful. My preference would be to either left-justify the commands as is currently done in OpenFOAM-dev or left-justify the commands AND align the ':'s.

henry

2016-11-13 18:14

manager   ~0007192

Cleaned-up the output from the Allwmake scripts:

commit 48e3fb78052699a00f6d1434a8b37c4e4c0d6ddc

alexeym

2016-11-13 18:56

reporter   ~0007193

Question of alignment:

daphne:renumber$ ./Allwmake -s
/home/alexey/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
ln        : ./lnInclude
wmkdep    : OppositeFaceCellWaveName.C
wmkdep    : structuredRenumber.C
wmkdep    : springRenumber.C
wmkdep    : randomRenumber.C
wmkdep    : CuthillMcKeeRenumber.C
wmkdep    : manualRenumber.C
wmkdep    : renumberMethod.C
Ctoo      : renumberMethod.C
Ctoo      : manualRenumber.C
Ctoo      : CuthillMcKeeRenumber.C
Ctoo      : randomRenumber.C
Ctoo      : springRenumber.C
Ctoo      : structuredRenumber.C
Ctoo      : OppositeFaceCellWaveName.C
ld        : librenumberMethods.so
->> /home/alexey/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so

Skipping zoltanRenumber


and

daphne:renumber$ ./Allwmake -s
/home/alexey/OpenFOAM/OpenFOAM-dev/src/renumber/renumberMethods
        ln: ./lnInclude
    wmkdep: OppositeFaceCellWaveName.C
    wmkdep: structuredRenumber.C
    wmkdep: springRenumber.C
    wmkdep: randomRenumber.C
    wmkdep: CuthillMcKeeRenumber.C
    wmkdep: manualRenumber.C
    wmkdep: renumberMethod.C
      Ctoo: renumberMethod.C
      Ctoo: CuthillMcKeeRenumber.C
      Ctoo: manualRenumber.C
      Ctoo: randomRenumber.C
      Ctoo: springRenumber.C
      Ctoo: structuredRenumber.C
      Ctoo: OppositeFaceCellWaveName.C
        ld: librenumberMethods.so
->> /home/alexey/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so

Skipping zoltanRenumber


with -q flag:

daphne:renumber$ ./Allwmake -s -q
Allwmake src/renumber
wmakeLnIncludeAll: starting wmakeLnInclude processes on 4 cores
    searching . for 'Make' directories
        ln: ./SloanRenumber/lnInclude
        ln: ./zoltanRenumber/lnInclude
        ln: ./renumberMethods/lnInclude
wmake objects .
Allwmake objects src/renumber
    skipping zoltanRenumber
wmake objects renumberMethods
    wmkdep: structuredRenumber.C
    wmkdep: OppositeFaceCellWaveName.C
    wmkdep: springRenumber.C
    wmkdep: randomRenumber.C
    wmkdep: CuthillMcKeeRenumber.C
    wmkdep: manualRenumber.C
    wmkdep: renumberMethod.C
      Ctoo: manualRenumber.C
      Ctoo: renumberMethod.C
      Ctoo: CuthillMcKeeRenumber.C
      Ctoo: randomRenumber.C
      Ctoo: structuredRenumber.C
      Ctoo: springRenumber.C
      Ctoo: OppositeFaceCellWaveName.C
 compiling: CuthillMcKeeRenumber.C
 compiling: renumberMethod.C
 compiling: manualRenumber.C
 compiling: randomRenumber.C
 compiling: structuredRenumber.C
 compiling: springRenumber.C
 compiling: OppositeFaceCellWaveName.C
Allwmake src/renumber
    skipping zoltanRenumber
wmake renumberMethods
        ld: librenumberMethods.so
    ->> /home/alexey/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so
0001-Messages-and-alignment.patch (6,352 bytes)   
From f58084d9b719f3325080ba64e1de7adfa216d0da Mon Sep 17 00:00:00 2001
From: Alexey Matveichev <github@matveichev.com>
Date: Sun, 13 Nov 2016 19:51:45 +0100
Subject: [PATCH] Messages and alignment

1. Moved wmkdep message to Makefile.
2. Added alignment wmake shell/make functions.
---
 wmake/rules/General/transform | 11 +++++-
 wmake/scripts/wmakeFunctions  | 86 +++++++++++++++++++++++++++++++++++++++++++
 wmake/src/wmkdep.l            |  6 +--
 wmake/wmakeCollect            |  4 +-
 wmake/wmakeLnInclude          |  6 ++-
 5 files changed, 104 insertions(+), 9 deletions(-)

diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform
index 5ac71a6..54e4b8f 100644
--- a/wmake/rules/General/transform
+++ b/wmake/rules/General/transform
@@ -1,9 +1,17 @@
 #----------------------------*- makefile-gmake -*------------------------------
 
+# Quiet rules left column width
+WM_QUIET_LEFT_COLUMNT_DEFAULT_WIDTH = 10
+
+ALIGN_RIGHT = $(shell printf "%*s" $(if $(WM_QUIET_LEFT_COLUMN_WIDTH),$(WM_QUIET_LEFT_COLUMN_WIDTH),$(WM_QUIET_LEFT_COLUMNT_DEFAULT_WIDTH)) $(1))
+
+ALIGN_LEFT = $(shell printf "%-*s" $(if $(WM_QUIET_LEFT_COLUMN_WIDTH),$(WM_QUIET_LEFT_COLUMN_WIDTH),$(WM_QUIET_LEFT_COLUMNT_DEFAULT_WIDTH)) $(1))
+
+
 ifneq ("$(WM_QUIET)","")
     E=@
     define QUIET_MESSAGE
-        @echo "    $1: $2";
+        @echo "$(call ALIGN_RIGHT,$1): $2";
     endef
     QUIET_OP=-s
 else
@@ -23,6 +31,7 @@ $(foreach s,$(SUFFIXES),$(eval $(call DEFINE_TRANSFORM,$(s))))
 
 $(OBJECTS_DIR)/%.dep : %
 	@$(WM_SCRIPTS)/makeTargetDir $@
+	$(call QUIET_MESSAGE,wmkdep,$(<F))
 	@$(WMAKE_BIN)/wmkdep $(QUIET_OP) -I$(*D) $(LIB_HEADER_DIRS) $< | \
 		sed -e 's,^$(WM_PROJECT_DIR)/,$$(WM_PROJECT_DIR)/,' \
 			-e 's,^$(WM_THIRD_PARTY_DIR)/,$$(WM_THIRD_PARTY_DIR)/,' > $@
diff --git a/wmake/scripts/wmakeFunctions b/wmake/scripts/wmakeFunctions
index 0262350..2df9fd0 100755
--- a/wmake/scripts/wmakeFunctions
+++ b/wmake/scripts/wmakeFunctions
@@ -30,6 +30,92 @@
 #------------------------------------------------------------------------------
 
 #------------------------------------------------------------------------------
+# Align given string
+#------------------------------------------------------------------------------
+
+align()
+{
+    # Arguments:
+    # - str: string to be aligned
+    # - dir: direction of alignment (left/right)
+    # - len: length of string where alignment happens
+
+    # If neither len parameter nor WM_QUIET_COLUMN_WIDTH environment variable
+    # are set.
+    local default_column_width=10
+
+    [ "$#" -lt "2" ] && return 1
+    # Default is to align left
+    local fmt="%-*s"
+    local len=
+    local str="$1"
+    shift
+    local dir="$1"
+    case $dir in
+    right)
+        fmt="%*s"
+        ;;
+    *)
+        ;;
+    esac
+    shift
+    if [ "$#" -gt "1" ]
+    then
+        len="$1"
+    elif [ -n "$WM_QUIET_COLUMN_WIDTH" ]
+    then
+        len=$WM_QUIET_COLUMN_WIDTH
+    else
+        len=$default_column_width
+    fi
+    printf $fmt $len $str
+}
+
+
+#------------------------------------------------------------------------------
+# Right-align given string
+#------------------------------------------------------------------------------
+
+alignRight()
+{
+    # Arguments:
+    # - str: string to be aligned
+    # - len: length of string where alignment happens
+
+    [ "$#" -lt "1" ] && return 1
+    local len=
+    local str="$1"
+    shift
+    if [ "$#" -gt "1" ]
+    then
+        len="$1"
+    fi
+    align $str right $len
+}
+
+#------------------------------------------------------------------------------
+# Left-align given string
+#------------------------------------------------------------------------------
+
+alignLeft()
+{
+    # Arguments:
+    # - str: string to be aligned
+    # - len: length of string where alignment happens
+
+    [ "$#" -lt "1" ] && return 1
+    local len=
+    local str="$1"
+    shift
+    if [ "$#" -gt "1" ]
+    then
+        len="$1"
+    fi
+    align $str left $len
+}
+
+
+#------------------------------------------------------------------------------
 # Check environment variables
 #------------------------------------------------------------------------------
 
diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l
index 81bede8..c89f96a 100644
--- a/wmake/src/wmkdep.l
+++ b/wmake/src/wmkdep.l
@@ -156,11 +156,7 @@ int main(int argc, char* argv[])
 
     sourceFile = strdup(argv[argc-1]);
     silent = (strncmp(argv[1], "-s", 2) == 0);
-    if (silent)
-    {
-        fprintf(stderr, "    wmkdep: %s\n", basename(sourceFile));
-    }
-    else
+    if (!silent)
     {
         fprintf
         (
diff --git a/wmake/wmakeCollect b/wmake/wmakeCollect
index 2aaa2c6..66f761d 100755
--- a/wmake/wmakeCollect
+++ b/wmake/wmakeCollect
@@ -34,6 +34,8 @@
 #-------------------------------------------------------------------------------
 Script=${0##*/}
 
+. ${0%/*}/scripts/wmakeFunctions
+
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -138,7 +140,7 @@ then
     # Add the build rule for the current target
     echo "$object: $makefile" >> $file
     [ -z "$E" ] ||
-        echo -e "\t@echo \"    compiling: ${source##*/}\"" >> $file
+        echo -e "\t@echo \"$(alignRight compiling): ${source##*/}\"" >> $file
     echo -e "\t$E cd $PWD && \\" >> $file
     echo -e "\t${@:1:($#-1)} $object" >> $file
     echo >> $file
diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude
index 3db3802..89862ff 100755
--- a/wmake/wmakeLnInclude
+++ b/wmake/wmakeLnInclude
@@ -40,6 +40,8 @@
 #------------------------------------------------------------------------------
 Script=${0##*/}
 
+. ${0%/*}/scripts/wmakeFunctions
+
 usage() {
     exec 1>&2
     while [ "$#" -ge 1 ]; do echo "$1"; shift; done
@@ -140,7 +142,7 @@ cd $incDir || exit 1
 
 if [ "$silentOpt" = true -o -n "$WM_QUIET" ]
 then
-    echo "    ln: $incDir" 1>&2
+    echo "$(alignRight ln): $incDir" 1>&2
 else
     echo "$Script: linking include files to $incDir" 1>&2
 fi
@@ -172,7 +174,7 @@ find .. $findOpt \
 # Cleanup local variables and functions
 #------------------------------------------------------------------------------
 
-unset Script usage
+unset Script usage WM_SILENT_LEFT_COLUMN_DEFAULT_WIDTH
 
 
 #------------------------------------------------------------------------------
-- 
2.7.4

henry

2016-11-13 20:13

manager   ~0007194

My view is at least the commands should be indented and left justified as they are currently, none of the options above have this.

My preference is for the current arrangement which I think has the simplest implementation, least clutter on the screen and easiest to propagate consistently through the rest of the build scripts. My second choice would be for the first of your options above but with the commands indented.

alexeym

2016-11-13 21:50

reporter   ~0007197

Well, left align, indent (initially ->> has 0 indentation to separate work units ->> was also selected cause initially all compilation/transformation indents was 6 (4 spaces + CC, RANLIB without indent) symbols)

daphne:renumber$ ./Allwmake -s -q
Allwmake src/renumber
wmakeLnIncludeAll: starting wmakeLnInclude processes on 4 cores
    searching . for 'Make' directories
    ln: ./SloanRenumber/lnInclude
    ln: ./renumberMethods/lnInclude
    ln: ./zoltanRenumber/lnInclude
wmake objects .
Allwmake objects src/renumber
    skipping zoltanRenumber
wmake objects renumberMethods
    wmkdep: structuredRenumber.C
    wmkdep: OppositeFaceCellWaveName.C
    wmkdep: springRenumber.C
    wmkdep: randomRenumber.C
    wmkdep: CuthillMcKeeRenumber.C
    wmkdep: manualRenumber.C
    wmkdep: renumberMethod.C
    Ctoo: renumberMethod.C
    Ctoo: manualRenumber.C
    Ctoo: randomRenumber.C
    Ctoo: CuthillMcKeeRenumber.C
    Ctoo: springRenumber.C
    Ctoo: structuredRenumber.C
    Ctoo: OppositeFaceCellWaveName.C
    compiling: renumberMethod.C
    compiling: manualRenumber.C
    compiling: randomRenumber.C
    compiling: CuthillMcKeeRenumber.C
    compiling: springRenumber.C
    compiling: OppositeFaceCellWaveName.C
    compiling: structuredRenumber.C
Allwmake src/renumber
    skipping zoltanRenumber
wmake renumberMethods
    ld: librenumberMethods.so
    ->> /home/alexey/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so


right align:

daphne:renumber$ ./Allwmake -s -q
Allwmake src/renumber
wmakeLnIncludeAll: starting wmakeLnInclude processes on 4 cores
    searching . for 'Make' directories
       ln: ./SloanRenumber/lnInclude
       ln: ./zoltanRenumber/lnInclude
       ln: ./renumberMethods/lnInclude
wmake objects .
Allwmake objects src/renumber
    skipping zoltanRenumber
wmake objects renumberMethods
   wmkdep: OppositeFaceCellWaveName.C
   wmkdep: structuredRenumber.C
   wmkdep: springRenumber.C
   wmkdep: randomRenumber.C
   wmkdep: CuthillMcKeeRenumber.C
   wmkdep: manualRenumber.C
   wmkdep: renumberMethod.C
     Ctoo: renumberMethod.C
     Ctoo: manualRenumber.C
     Ctoo: CuthillMcKeeRenumber.C
     Ctoo: randomRenumber.C
     Ctoo: springRenumber.C
     Ctoo: structuredRenumber.C
     Ctoo: OppositeFaceCellWaveName.C
compiling: renumberMethod.C
compiling: manualRenumber.C
compiling: CuthillMcKeeRenumber.C
compiling: randomRenumber.C
compiling: structuredRenumber.C
compiling: springRenumber.C
compiling: OppositeFaceCellWaveName.C
Allwmake src/renumber
    skipping zoltanRenumber
wmake renumberMethods
       ld: librenumberMethods.so
->> /home/alexey/OpenFOAM/OpenFOAM-dev/platforms/linux64GccDPInt32Opt/lib/librenumberMethods.so


Since our alignment and output preferences are quite different and I need to maintain own patch set anyway (for this, for Scotch/METIS, for other things), I think bug report can be closed, commit mention edited-out.

Issue History

Date Modified Username Field Change
2016-11-11 08:40 alexeym New Issue
2016-11-11 08:40 alexeym File Added: 0003-Silent-rules.patch
2016-11-11 08:40 alexeym Tag Attached: wmake
2016-11-11 09:58 henry Note Added: 0007139
2016-11-11 21:49 alexeym File Added: Silent-rules.patch
2016-11-11 21:49 alexeym Note Added: 0007162
2016-11-11 22:47 henry Note Added: 0007163
2016-11-12 09:49 alexeym File Added: 0001-Silent-rules-for-wmake.patch
2016-11-12 09:49 alexeym Note Added: 0007165
2016-11-12 12:01 henry Note Added: 0007166
2016-11-12 13:41 henry Note Added: 0007167
2016-11-12 16:52 henry Note Added: 0007168
2016-11-12 18:41 henry Note Added: 0007169
2016-11-12 21:40 alexeym Note Added: 0007170
2016-11-12 22:13 henry Note Added: 0007171
2016-11-13 09:14 alexeym File Added: wmake-quiet-cosmetic-changes.patch
2016-11-13 09:14 alexeym Note Added: 0007172
2016-11-13 09:52 henry Note Added: 0007173
2016-11-13 10:07 alexeym File Added: build.log
2016-11-13 10:07 alexeym Note Added: 0007174
2016-11-13 10:21 henry Note Added: 0007175
2016-11-13 11:02 alexeym Note Added: 0007176
2016-11-13 11:15 henry Note Added: 0007177
2016-11-13 11:22 henry Note Added: 0007178
2016-11-13 15:26 alexeym File Added: 0001-Colon-alignment.patch
2016-11-13 15:26 alexeym Note Added: 0007182
2016-11-13 15:39 henry Note Added: 0007185
2016-11-13 15:44 henry Note Added: 0007186
2016-11-13 15:49 henry Note Added: 0007187
2016-11-13 18:14 henry Note Added: 0007192
2016-11-13 18:56 alexeym File Added: 0001-Messages-and-alignment.patch
2016-11-13 18:56 alexeym Note Added: 0007193
2016-11-13 20:13 henry Note Added: 0007194
2016-11-13 21:50 alexeym Note Added: 0007197
2016-11-13 22:04 henry Assigned To => henry
2016-11-13 22:04 henry Status new => resolved
2016-11-13 22:04 henry Resolution open => fixed
2016-11-13 22:04 henry Fixed in Version => dev