From c3a03105c43cdc8162f80773ab8be5f17af3171c Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Sun, 24 Jan 2016 14:10:07 +0000
Subject: [PATCH] wmake: Add support for compiler type default rules which may
 be optionally overridden by version-specific rules.

For example the default rules for gcc on GNU/Linux x86_64 are in the
wmake/rules/linux64Gcc directory.  If there is a need to change any of
the rules for a specific version of gcc, e.g. gcc-4.8.4 the directory
wmake/rules/linux64Gcc48 may be created into which any of the language
files may be provided containing the rules to override the defaults.
---
 wmake/makefiles/files               | 20 +++++++++---------
 wmake/makefiles/general             | 32 ++++++++++++-----------------
 wmake/rules/General/general         | 13 ++++++++++++
 wmake/rules/linux64Clang/c          |  2 +-
 wmake/rules/linux64Clang/c++        |  2 +-
 wmake/rules/linux64Clang/general    |  4 ++--
 wmake/rules/linux64Gcc/c            |  2 +-
 wmake/rules/linux64Gcc/c++          |  2 +-
 wmake/rules/linux64Gcc/general      |  4 ++--
 wmake/rules/linux64Gcc45            |  1 -
 wmake/rules/linux64Gcc46            |  1 -
 wmake/rules/linux64Gcc47            |  1 -
 wmake/rules/linux64Gcc48            |  1 -
 wmake/rules/linux64Gcc49            |  1 -
 wmake/rules/linux64Gcc51            |  1 -
 wmake/rules/linux64Icc/c            |  2 +-
 wmake/rules/linux64Icc/c++          |  2 +-
 wmake/rules/linux64Icc/general      |  4 ++--
 wmake/rules/linuxARM7Gcc/c          |  2 +-
 wmake/rules/linuxARM7Gcc/c++        |  2 +-
 wmake/rules/linuxARM7Gcc/general    |  4 ++--
 wmake/rules/linuxClang/c            |  2 +-
 wmake/rules/linuxClang/c++          |  2 +-
 wmake/rules/linuxClang/general      |  4 ++--
 wmake/rules/linuxGcc/c              |  2 +-
 wmake/rules/linuxGcc/c++            |  2 +-
 wmake/rules/linuxGcc/general        |  4 ++--
 wmake/rules/linuxGcc45              |  1 -
 wmake/rules/linuxGcc46              |  1 -
 wmake/rules/linuxGcc47              |  1 -
 wmake/rules/linuxGcc48              |  1 -
 wmake/rules/linuxGcc49              |  1 -
 wmake/rules/linuxGcc51              |  1 -
 wmake/rules/linuxIA64Gcc/c          |  2 +-
 wmake/rules/linuxIA64Gcc/c++        |  2 +-
 wmake/rules/linuxIA64Gcc/general    |  6 +++---
 wmake/rules/linuxIA64Icc/c          |  2 +-
 wmake/rules/linuxIA64Icc/c++        |  2 +-
 wmake/rules/linuxIA64Icc/general    |  6 +++---
 wmake/rules/linuxIcc/c              |  2 +-
 wmake/rules/linuxIcc/c++            |  2 +-
 wmake/rules/linuxIcc/general        |  4 ++--
 wmake/rules/linuxPPC64Gcc/c         |  2 +-
 wmake/rules/linuxPPC64Gcc/c++       |  2 +-
 wmake/rules/linuxPPC64Gcc/general   |  6 +++---
 wmake/rules/linuxPPC64leGcc/c       |  2 +-
 wmake/rules/linuxPPC64leGcc/c++     |  2 +-
 wmake/rules/linuxPPC64leGcc/general |  6 +++---
 wmake/rules/solaris64Gcc/c          |  2 +-
 wmake/rules/solaris64Gcc/c++        |  2 +-
 wmake/rules/solaris64Gcc/general    |  6 +++---
 wmake/rules/solarisGcc/c            |  2 +-
 wmake/rules/solarisGcc/c++          |  2 +-
 wmake/rules/solarisGcc/general      |  6 +++---
 wmake/src/Makefile                  | 14 +++++--------
 55 files changed, 99 insertions(+), 108 deletions(-)
 delete mode 120000 wmake/rules/linux64Gcc45
 delete mode 120000 wmake/rules/linux64Gcc46
 delete mode 120000 wmake/rules/linux64Gcc47
 delete mode 120000 wmake/rules/linux64Gcc48
 delete mode 120000 wmake/rules/linux64Gcc49
 delete mode 120000 wmake/rules/linux64Gcc51
 delete mode 120000 wmake/rules/linuxGcc45
 delete mode 120000 wmake/rules/linuxGcc46
 delete mode 120000 wmake/rules/linuxGcc47
 delete mode 120000 wmake/rules/linuxGcc48
 delete mode 120000 wmake/rules/linuxGcc49
 delete mode 120000 wmake/rules/linuxGcc51

diff --git a/wmake/makefiles/files b/wmake/makefiles/files
index 91bff6265e9..22c6a05f5ea 100644
--- a/wmake/makefiles/files
+++ b/wmake/makefiles/files
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -29,24 +29,23 @@
 #
 #------------------------------------------------------------------------------
 
-GENERAL_RULES = $(WM_DIR)/rules/General
-RULES         = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
-OBJECTS_DIR   = $(MAKE_DIR)/$(WM_OPTIONS)
-
+GENERAL_RULES   = $(WM_DIR)/rules/General
 include $(GENERAL_RULES)/general
-include $(RULES)/general
+
 
 #------------------------------------------------------------------------------
 # declare names of make system control files derived from file 'files'
 #------------------------------------------------------------------------------
 
-OPTIONS = $(OBJECTS_DIR)/options
-FILES   = $(OBJECTS_DIR)/files
-VARS    = $(OBJECTS_DIR)/variables
-SFILES  = $(OBJECTS_DIR)/sourceFiles
+OBJECTS_DIR     = $(MAKE_DIR)/$(WM_OPTIONS)
+OPTIONS         = $(OBJECTS_DIR)/options
+FILES           = $(OBJECTS_DIR)/files
+VARS            = $(OBJECTS_DIR)/variables
+SFILES          = $(OBJECTS_DIR)/sourceFiles
 
 -include $(OPTIONS)
 
+
 #------------------------------------------------------------------------------
 # Declare dependecy of all make system files on FILES
 # Causes all derived files to be remade if any are changed or missing
@@ -74,4 +73,5 @@ $(SFILES): $(MAKE_DIR)/files
 
 $(VARS): $(SFILES)
 
+
 #------------------------------------------------------------------------------
diff --git a/wmake/makefiles/general b/wmake/makefiles/general
index 2fc320de19c..580e96c7b2e 100644
--- a/wmake/makefiles/general
+++ b/wmake/makefiles/general
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -33,7 +33,7 @@
 # The Makefile uses a POSIX shell
 #------------------------------------------------------------------------------
 
-SHELL      = /bin/sh
+SHELL           = /bin/sh
 
 
 #------------------------------------------------------------------------------
@@ -47,29 +47,29 @@ SHELL      = /bin/sh
 # Set the directory containing the wmake scripts
 #------------------------------------------------------------------------------
 
-WM_SCRIPTS   = $(WM_DIR)/scripts
+WM_SCRIPTS      = $(WM_DIR)/scripts
 
 
 #------------------------------------------------------------------------------
 # Declare default paths
 #------------------------------------------------------------------------------
 
-LIB_SRC            = $(WM_PROJECT_DIR)/src
-LIB_PLATFORMS      = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib
-OBJECTS_DIR        = $(MAKE_DIR)/$(WM_OPTIONS)
+LIB_SRC         = $(WM_PROJECT_DIR)/src
+LIB_PLATFORMS   = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib
+OBJECTS_DIR     = $(MAKE_DIR)/$(WM_OPTIONS)
 
-SYS_INC            =
-SYS_LIBS           =
+SYS_INC         =
+SYS_LIBS        =
 
-PROJECT_INC        = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude \
+PROJECT_INC     = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude \
 		     -I$(LIB_SRC)/OSspecific/$(WM_OSTYPE)/lnInclude
 
-PROJECT_LIBS       = -l$(WM_PROJECT)
+PROJECT_LIBS    = -l$(WM_PROJECT)
 
-EXE_INC            =
-EXE_LIBS           =
+EXE_INC         =
+EXE_LIBS        =
 
-LIB_LIBS           =
+LIB_LIBS        =
 
 
 #------------------------------------------------------------------------------
@@ -94,13 +94,7 @@ SEXE            = a.out
 #------------------------------------------------------------------------------
 
 GENERAL_RULES = $(WM_DIR)/rules/General
-RULES         = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
-WMAKE_BIN     = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)
-
 include $(GENERAL_RULES)/general
-include $(RULES)/general
-include $(RULES)/$(WM_LINK_LANGUAGE)
-include $(GENERAL_RULES)/transform
 
 
 #------------------------------------------------------------------------------
diff --git a/wmake/rules/General/general b/wmake/rules/General/general
index 062c704f13b..b3f20b48e86 100644
--- a/wmake/rules/General/general
+++ b/wmake/rules/General/general
@@ -12,4 +12,17 @@ GINC       =
 GLIBS      = -lm
 GLIB_LIBS  =
 
+
+COMPILER_TYPE   = $(shell echo $(WM_COMPILER) | tr -d [:digit:])
+DEFAULT_RULES   = $(WM_DIR)/rules/$(WM_ARCH)$(COMPILER_TYPE)
+RULES           = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
+WMAKE_BIN       = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)
+
+include $(DEFAULT_RULES)/general
+include $(DEFAULT_RULES)/$(WM_LINK_LANGUAGE)
+-include $(RULES)/general
+-include $(RULES)/$(WM_LINK_LANGUAGE)
+include $(GENERAL_RULES)/transform
+
+
 #------------------------------------------------------------------------------
diff --git a/wmake/rules/linux64Clang/c b/wmake/rules/linux64Clang/c
index e882186177c..b743e3f68cb 100644
--- a/wmake/rules/linux64Clang/c
+++ b/wmake/rules/linux64Clang/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = clang -m64
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linux64Clang/c++ b/wmake/rules/linux64Clang/c++
index 2e09ff8827d..84ed0f41078 100644
--- a/wmake/rules/linux64Clang/c++
+++ b/wmake/rules/linux64Clang/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-tautological-u
 
 CC          = clang++ -std=c++0x -m64
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linux64Clang/general b/wmake/rules/linux64Clang/general
index 243cb7d8c76..1002cb169b5 100644
--- a/wmake/rules/linux64Clang/general
+++ b/wmake/rules/linux64Clang/general
@@ -4,5 +4,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linux64Gcc/c b/wmake/rules/linux64Gcc/c
index 66435ccf057..1097b3a594c 100644
--- a/wmake/rules/linux64Gcc/c
+++ b/wmake/rules/linux64Gcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc -m64
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linux64Gcc/c++ b/wmake/rules/linux64Gcc/c++
index 7c7af702e28..a47d0d499ae 100644
--- a/wmake/rules/linux64Gcc/c++
+++ b/wmake/rules/linux64Gcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
 
 CC          = g++ -std=c++0x -m64
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linux64Gcc/general b/wmake/rules/linux64Gcc/general
index 243cb7d8c76..1002cb169b5 100644
--- a/wmake/rules/linux64Gcc/general
+++ b/wmake/rules/linux64Gcc/general
@@ -4,5 +4,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linux64Gcc45 b/wmake/rules/linux64Gcc45
deleted file mode 120000
index 7a0c1a85050..00000000000
--- a/wmake/rules/linux64Gcc45
+++ /dev/null
@@ -1 +0,0 @@
-linux64Gcc
\ No newline at end of file
diff --git a/wmake/rules/linux64Gcc46 b/wmake/rules/linux64Gcc46
deleted file mode 120000
index 7a0c1a85050..00000000000
--- a/wmake/rules/linux64Gcc46
+++ /dev/null
@@ -1 +0,0 @@
-linux64Gcc
\ No newline at end of file
diff --git a/wmake/rules/linux64Gcc47 b/wmake/rules/linux64Gcc47
deleted file mode 120000
index 7a0c1a85050..00000000000
--- a/wmake/rules/linux64Gcc47
+++ /dev/null
@@ -1 +0,0 @@
-linux64Gcc
\ No newline at end of file
diff --git a/wmake/rules/linux64Gcc48 b/wmake/rules/linux64Gcc48
deleted file mode 120000
index 7a0c1a85050..00000000000
--- a/wmake/rules/linux64Gcc48
+++ /dev/null
@@ -1 +0,0 @@
-linux64Gcc
\ No newline at end of file
diff --git a/wmake/rules/linux64Gcc49 b/wmake/rules/linux64Gcc49
deleted file mode 120000
index 7a0c1a85050..00000000000
--- a/wmake/rules/linux64Gcc49
+++ /dev/null
@@ -1 +0,0 @@
-linux64Gcc
\ No newline at end of file
diff --git a/wmake/rules/linux64Gcc51 b/wmake/rules/linux64Gcc51
deleted file mode 120000
index 7a0c1a85050..00000000000
--- a/wmake/rules/linux64Gcc51
+++ /dev/null
@@ -1 +0,0 @@
-linux64Gcc
\ No newline at end of file
diff --git a/wmake/rules/linux64Icc/c b/wmake/rules/linux64Icc/c
index 97da5c28f0a..14a3a231d54 100644
--- a/wmake/rules/linux64Icc/c
+++ b/wmake/rules/linux64Icc/c
@@ -4,7 +4,7 @@ cWARN        =
 
 cc          = icc
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linux64Icc/c++ b/wmake/rules/linux64Icc/c++
index 85b976ae4f4..03bee61dcef 100644
--- a/wmake/rules/linux64Icc/c++
+++ b/wmake/rules/linux64Icc/c++
@@ -8,7 +8,7 @@ c++LESSWARN = -diag-disable 1224,2026,2305
 
 CC          = icpc -std=c++0x -fp-trap=common -fp-model precise
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository
 
diff --git a/wmake/rules/linux64Icc/general b/wmake/rules/linux64Icc/general
index 45c285f1eee..52b0e177d7a 100644
--- a/wmake/rules/linux64Icc/general
+++ b/wmake/rules/linux64Icc/general
@@ -4,5 +4,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxARM7Gcc/c b/wmake/rules/linuxARM7Gcc/c
index d7bda5d1df8..dfae4adda05 100644
--- a/wmake/rules/linuxARM7Gcc/c
+++ b/wmake/rules/linuxARM7Gcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxARM7Gcc/c++ b/wmake/rules/linuxARM7Gcc/c++
index b647cc85e66..80fccf2710a 100644
--- a/wmake/rules/linuxARM7Gcc/c++
+++ b/wmake/rules/linuxARM7Gcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
 
 CC          = g++ -std=c++0x
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linuxARM7Gcc/general b/wmake/rules/linuxARM7Gcc/general
index 376c6148463..1e51dcc403c 100644
--- a/wmake/rules/linuxARM7Gcc/general
+++ b/wmake/rules/linuxARM7Gcc/general
@@ -5,5 +5,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxClang/c b/wmake/rules/linuxClang/c
index 7d67b4c0223..2c8e8a7f9c2 100644
--- a/wmake/rules/linuxClang/c
+++ b/wmake/rules/linuxClang/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = clang -m32
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxClang/c++ b/wmake/rules/linuxClang/c++
index 216cc67f7bf..b029fbcfd79 100644
--- a/wmake/rules/linuxClang/c++
+++ b/wmake/rules/linuxClang/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedef -Wno-tautological-un
 
 CC          = clang++ -std=c++0x -m32
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linuxClang/general b/wmake/rules/linuxClang/general
index fa1eb5b925f..e3427c3181a 100644
--- a/wmake/rules/linuxClang/general
+++ b/wmake/rules/linuxClang/general
@@ -5,5 +5,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxGcc/c b/wmake/rules/linuxGcc/c
index 81c64cf710b..8eddde0490d 100644
--- a/wmake/rules/linuxGcc/c
+++ b/wmake/rules/linuxGcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc -m32
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxGcc/c++ b/wmake/rules/linuxGcc/c++
index b115000d956..c1c34a8419b 100644
--- a/wmake/rules/linuxGcc/c++
+++ b/wmake/rules/linuxGcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
 
 CC          = g++ -std=c++0x -m32
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linuxGcc/general b/wmake/rules/linuxGcc/general
index fa1eb5b925f..e3427c3181a 100644
--- a/wmake/rules/linuxGcc/general
+++ b/wmake/rules/linuxGcc/general
@@ -5,5 +5,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxGcc45 b/wmake/rules/linuxGcc45
deleted file mode 120000
index e30dec7be4a..00000000000
--- a/wmake/rules/linuxGcc45
+++ /dev/null
@@ -1 +0,0 @@
-linuxGcc
\ No newline at end of file
diff --git a/wmake/rules/linuxGcc46 b/wmake/rules/linuxGcc46
deleted file mode 120000
index e30dec7be4a..00000000000
--- a/wmake/rules/linuxGcc46
+++ /dev/null
@@ -1 +0,0 @@
-linuxGcc
\ No newline at end of file
diff --git a/wmake/rules/linuxGcc47 b/wmake/rules/linuxGcc47
deleted file mode 120000
index e30dec7be4a..00000000000
--- a/wmake/rules/linuxGcc47
+++ /dev/null
@@ -1 +0,0 @@
-linuxGcc
\ No newline at end of file
diff --git a/wmake/rules/linuxGcc48 b/wmake/rules/linuxGcc48
deleted file mode 120000
index e30dec7be4a..00000000000
--- a/wmake/rules/linuxGcc48
+++ /dev/null
@@ -1 +0,0 @@
-linuxGcc
\ No newline at end of file
diff --git a/wmake/rules/linuxGcc49 b/wmake/rules/linuxGcc49
deleted file mode 120000
index e30dec7be4a..00000000000
--- a/wmake/rules/linuxGcc49
+++ /dev/null
@@ -1 +0,0 @@
-linuxGcc
\ No newline at end of file
diff --git a/wmake/rules/linuxGcc51 b/wmake/rules/linuxGcc51
deleted file mode 120000
index e30dec7be4a..00000000000
--- a/wmake/rules/linuxGcc51
+++ /dev/null
@@ -1 +0,0 @@
-linuxGcc
\ No newline at end of file
diff --git a/wmake/rules/linuxIA64Gcc/c b/wmake/rules/linuxIA64Gcc/c
index d7bda5d1df8..dfae4adda05 100644
--- a/wmake/rules/linuxIA64Gcc/c
+++ b/wmake/rules/linuxIA64Gcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxIA64Gcc/c++ b/wmake/rules/linuxIA64Gcc/c++
index d07854e0640..6d152ecd1a2 100644
--- a/wmake/rules/linuxIA64Gcc/c++
+++ b/wmake/rules/linuxIA64Gcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
 
 CC          = g++ -std=c++0x
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linuxIA64Gcc/general b/wmake/rules/linuxIA64Gcc/general
index 480ea1b9c41..182ee7f9019 100644
--- a/wmake/rules/linuxIA64Gcc/general
+++ b/wmake/rules/linuxIA64Gcc/general
@@ -4,6 +4,6 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/X
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/X
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxIA64Icc/c b/wmake/rules/linuxIA64Icc/c
index 3952de58fbd..2b19596b1a0 100644
--- a/wmake/rules/linuxIA64Icc/c
+++ b/wmake/rules/linuxIA64Icc/c
@@ -4,7 +4,7 @@ cWARN        =
 
 cc          = icc
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxIA64Icc/c++ b/wmake/rules/linuxIA64Icc/c++
index 4d24538e976..a8a9341e1ae 100644
--- a/wmake/rules/linuxIA64Icc/c++
+++ b/wmake/rules/linuxIA64Icc/c++
@@ -8,7 +8,7 @@ c++LESSWARN = -diag-disable 1224,2026,2305
 
 CC          = icpc -std=c++0x
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository
 
diff --git a/wmake/rules/linuxIA64Icc/general b/wmake/rules/linuxIA64Icc/general
index 9dc446d4b28..09a38966561 100644
--- a/wmake/rules/linuxIA64Icc/general
+++ b/wmake/rules/linuxIA64Icc/general
@@ -4,6 +4,6 @@ GLIBS      =
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/X
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/X
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxIcc/c b/wmake/rules/linuxIcc/c
index a6441bcbd06..c9f75c90217 100644
--- a/wmake/rules/linuxIcc/c
+++ b/wmake/rules/linuxIcc/c
@@ -4,7 +4,7 @@ cWARN        =
 
 cc          = icc -gcc-version=400
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -KPIC
 
diff --git a/wmake/rules/linuxIcc/c++ b/wmake/rules/linuxIcc/c++
index 48fdb9f6b1b..88976144c15 100644
--- a/wmake/rules/linuxIcc/c++
+++ b/wmake/rules/linuxIcc/c++
@@ -8,7 +8,7 @@ c++LESSWARN = -diag-disable 1224,2026,2305
 
 CC          = icpc -std=c++0x -fp-trap=common -fp-model precise
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository
 
diff --git a/wmake/rules/linuxIcc/general b/wmake/rules/linuxIcc/general
index 8a38ddf6d47..5c94cad44af 100644
--- a/wmake/rules/linuxIcc/general
+++ b/wmake/rules/linuxIcc/general
@@ -5,5 +5,5 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxPPC64Gcc/c b/wmake/rules/linuxPPC64Gcc/c
index 1fa057876c1..f973417062e 100644
--- a/wmake/rules/linuxPPC64Gcc/c
+++ b/wmake/rules/linuxPPC64Gcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc -m64 -mcpu=power5+
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxPPC64Gcc/c++ b/wmake/rules/linuxPPC64Gcc/c++
index c5dcaa4d960..7c330793840 100644
--- a/wmake/rules/linuxPPC64Gcc/c++
+++ b/wmake/rules/linuxPPC64Gcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
 
 CC          = g++ -std=c++0x -m64 -mcpu=power5+
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linuxPPC64Gcc/general b/wmake/rules/linuxPPC64Gcc/general
index fa717f9645b..a590cc29c8d 100644
--- a/wmake/rules/linuxPPC64Gcc/general
+++ b/wmake/rules/linuxPPC64Gcc/general
@@ -5,6 +5,6 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/X
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/X
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/linuxPPC64leGcc/c b/wmake/rules/linuxPPC64leGcc/c
index d9aa80f726f..c5e3c73ebab 100644
--- a/wmake/rules/linuxPPC64leGcc/c
+++ b/wmake/rules/linuxPPC64leGcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc -m64 -mcpu=power8
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/linuxPPC64leGcc/c++ b/wmake/rules/linuxPPC64leGcc/c++
index 76c49471833..805f821822f 100644
--- a/wmake/rules/linuxPPC64leGcc/c++
+++ b/wmake/rules/linuxPPC64leGcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs -Wno-array-bounds
 
 CC          = g++ -std=c++0x -m64 -mcpu=power8
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/linuxPPC64leGcc/general b/wmake/rules/linuxPPC64leGcc/general
index f800e09afcb..7867cbde8f4 100644
--- a/wmake/rules/linuxPPC64leGcc/general
+++ b/wmake/rules/linuxPPC64leGcc/general
@@ -5,6 +5,6 @@ PROJECT_LIBS = -l$(WM_PROJECT) -ldl
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/X
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/X
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/solaris64Gcc/c b/wmake/rules/solaris64Gcc/c
index 66435ccf057..1097b3a594c 100644
--- a/wmake/rules/solaris64Gcc/c
+++ b/wmake/rules/solaris64Gcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc -m64
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/solaris64Gcc/c++ b/wmake/rules/solaris64Gcc/c++
index e7f16f4d46f..324522f10b1 100644
--- a/wmake/rules/solaris64Gcc/c++
+++ b/wmake/rules/solaris64Gcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN =
 
 CC          = g++ -std=c++0x -m64
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/solaris64Gcc/general b/wmake/rules/solaris64Gcc/general
index 83b7ebf4e0b..bbf1b69bc2b 100644
--- a/wmake/rules/solaris64Gcc/general
+++ b/wmake/rules/solaris64Gcc/general
@@ -5,6 +5,6 @@ PROJECT_LIBS = -l$(WM_PROJECT) -lnsl -lsocket -L$(FOAM_LIBBIN)/dummy -lPstream
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/X
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/X
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/rules/solarisGcc/c b/wmake/rules/solarisGcc/c
index d7bda5d1df8..dfae4adda05 100644
--- a/wmake/rules/solarisGcc/c
+++ b/wmake/rules/solarisGcc/c
@@ -4,7 +4,7 @@ cWARN        = -Wall
 
 cc          = gcc
 
-include $(RULES)/c$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
 
 cFLAGS      = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
 
diff --git a/wmake/rules/solarisGcc/c++ b/wmake/rules/solarisGcc/c++
index d6bf189010d..d8e968fb9ff 100644
--- a/wmake/rules/solarisGcc/c++
+++ b/wmake/rules/solarisGcc/c++
@@ -7,7 +7,7 @@ c++LESSWARN =
 
 CC          = g++ -std=c++0x
 
-include $(RULES)/c++$(WM_COMPILE_OPTION)
+include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
 
 ptFLAGS     = -DNoRepository -ftemplate-depth-100
 
diff --git a/wmake/rules/solarisGcc/general b/wmake/rules/solarisGcc/general
index cda7ba86730..2e6e7b1f40b 100644
--- a/wmake/rules/solarisGcc/general
+++ b/wmake/rules/solarisGcc/general
@@ -4,6 +4,6 @@ PROJECT_LIBS = -l$(WM_PROJECT) -lnsl -lsocket -L$(FOAM_LIBBIN)/dummy -lPstream
 
 include $(GENERAL_RULES)/standard
 
-include $(RULES)/X
-include $(RULES)/c
-include $(RULES)/c++
+include $(DEFAULT_RULES)/X
+include $(DEFAULT_RULES)/c
+include $(DEFAULT_RULES)/c++
diff --git a/wmake/src/Makefile b/wmake/src/Makefile
index 92a2b087e65..4162a3b45d7 100644
--- a/wmake/src/Makefile
+++ b/wmake/src/Makefile
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2014 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -43,19 +43,15 @@ SHELL      = /bin/sh
 
 
 #------------------------------------------------------------------------------
-# set compilation and dependency building rules
+# Set compilation and dependency building rules
 #------------------------------------------------------------------------------
 
-GENERAL_RULES = $(WM_DIR)/rules/General
-RULES         = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
-WMAKE_BIN     = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)
-
-include $(RULES)/general
-include $(RULES)/$(WM_LINK_LANGUAGE)
+GENERAL_RULES   = $(WM_DIR)/rules/General
+include $(GENERAL_RULES)/general
 
 
 #------------------------------------------------------------------------------
-# targets
+# Targets
 #------------------------------------------------------------------------------
 
 all:  $(WMAKE_BIN)/dirToString $(WMAKE_BIN)/wmkdep
-- 
GitLab