From 30e6e02d29a4b53ef1353023ab2f26c1c80f0146 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 9 Dec 2020 13:35:14 +0000 Subject: [PATCH] wmake: Removed the cpp processing of the Make/options file so that it can be included directly into the wmake Makefile to allow full support of gmake syntax, variables, functions etc. The Make/files file handled in the same manner as the Make/options file if it contains the SOURCE entry otherwise it is first processed by cpp for backward compatibility. --- applications/test/Distribution/Make/options | 2 - applications/test/ListOps/Make/options | 3 -- applications/test/PackedList/Make/options | 6 +-- applications/test/globalIndex/Make/options | 1 - applications/test/tokenize/Make/options | 5 +-- .../mesh/conversion/star3ToFoam/Make/options | 13 +++--- .../cellSizeAndAlignmentGrid/Make/options | 3 +- .../conformalVoronoiMesh/Make/options | 3 +- .../foamyMesh/foamyHexMesh/Make/options | 3 +- .../foamyHexMeshBackgroundMesh/Make/options | 2 +- .../foamyHexMeshSurfaceSimplify/Make/options | 1 - .../generation/snappyHexMesh/Make/options | 1 - .../mesh/manipulation/objToVTK/Make/options | 1 - .../manipulation/renumberMesh/Make/options | 1 - .../mesh/manipulation/zipUpMesh/Make/options | 9 ++-- .../miscellaneous/foamListTimes/Make/options | 2 - .../graphics/PVReaders/vtkPVFoam/Make/options | 2 +- .../MGridGenGamgAgglomeration/Make/options | 10 ++--- src/fvMotionSolver/Make/options | 1 - .../decompose/metisDecomp/Make/options | 1 - .../decompose/scotchDecomp/Make/options | 7 ++-- src/renumber/zoltanRenumber/Make/options | 2 - wmake/makefiles/files | 31 ++++++-------- wmake/makefiles/general | 16 +++++--- wmake/wmake | 41 ++++++++++--------- 25 files changed, 75 insertions(+), 92 deletions(-) diff --git a/applications/test/Distribution/Make/options b/applications/test/Distribution/Make/options index 18e6fe47af..e69de29bb2 100644 --- a/applications/test/Distribution/Make/options +++ b/applications/test/Distribution/Make/options @@ -1,2 +0,0 @@ -/* EXE_INC = */ -/* EXE_LIBS = */ diff --git a/applications/test/ListOps/Make/options b/applications/test/ListOps/Make/options index 51903c0ce4..e69de29bb2 100644 --- a/applications/test/ListOps/Make/options +++ b/applications/test/ListOps/Make/options @@ -1,3 +0,0 @@ -EXE_INC = /*-DFULLDEBUG -O0 -g*/ \ - -EXE_LIBS = diff --git a/applications/test/PackedList/Make/options b/applications/test/PackedList/Make/options index 42da6e3418..2b5401f1c0 100644 --- a/applications/test/PackedList/Make/options +++ b/applications/test/PackedList/Make/options @@ -1,7 +1,3 @@ -/* - check for consistent behaviour with non-optimized code - */ - +# Check for consistent behaviour with non-optimized code EXE_INC = \ -DFULLDEBUG -g -O0 - diff --git a/applications/test/globalIndex/Make/options b/applications/test/globalIndex/Make/options index 90f18e878f..e69de29bb2 100644 --- a/applications/test/globalIndex/Make/options +++ b/applications/test/globalIndex/Make/options @@ -1 +0,0 @@ -EXE_INC = /* -DFULLDEBUG -g -O0 */ diff --git a/applications/test/tokenize/Make/options b/applications/test/tokenize/Make/options index 971e4950d9..2b5401f1c0 100644 --- a/applications/test/tokenize/Make/options +++ b/applications/test/tokenize/Make/options @@ -1,6 +1,3 @@ -/* - check for consistent behaviour with non-optimized code - */ - +# Check for consistent behaviour with non-optimized code EXE_INC = \ -DFULLDEBUG -g -O0 diff --git a/applications/utilities/mesh/conversion/star3ToFoam/Make/options b/applications/utilities/mesh/conversion/star3ToFoam/Make/options index b4a6830ff5..c694289766 100644 --- a/applications/utilities/mesh/conversion/star3ToFoam/Make/options +++ b/applications/utilities/mesh/conversion/star3ToFoam/Make/options @@ -1,13 +1,14 @@ EXE_INC = \ - /* -DDEBUG_MERGE */ \ - /* -DDEBUG_COUPLE */ \ - /* -DDEBUG_COUPLE_INTERSECTION */ \ - /* -DDEBUG_RIGHT_HAND_WALK */ \ - /* -DDEBUG_FACE_ORDERING */ \ - /* -DDEBUG_COUPLE_PROJECTION */ \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/conversion/lnInclude +# EXE_INC += -DDEBUG_MERGE +# EXE_INC += -DDEBUG_COUPLE +# EXE_INC += -DDEBUG_COUPLE_INTERSECTION +# EXE_INC += -DDEBUG_RIGHT_HAND_WALK +# EXE_INC += -DDEBUG_FACE_ORDERING +# EXE_INC += -DDEBUG_COUPLE_PROJECTION + EXE_LIBS = \ -ldynamicMesh \ -lconversion diff --git a/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options b/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options index dbd6d93668..ad008471b1 100644 --- a/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid/Make/options @@ -1,7 +1,8 @@ EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_NDEBUG = -DNDEBUG -CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ +CGAL_EXACT = +#CGAL_EXACT = -DCGAL_DONT_USE_LAZY_KERNEL CGAL_INEXACT = -DCGAL_INEXACT include $(GENERAL_RULES)/CGAL diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options index 6276148173..3102dfc3e7 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/Make/options @@ -1,7 +1,8 @@ EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_NDEBUG = -DNDEBUG -CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ +CGAL_EXACT = +#CGAL_EXACT = -DCGAL_DONT_USE_LAZY_KERNEL CGAL_INEXACT = -DCGAL_INEXACT include $(GENERAL_RULES)/CGAL diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options index ecf9cc2b3b..804498da01 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMesh/Make/options @@ -1,7 +1,8 @@ EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_NDEBUG = -DNDEBUG -CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ +CGAL_EXACT = +#CGAL_EXACT = -DCGAL_DONT_USE_LAZY_KERNEL CGAL_INEXACT = -DCGAL_INEXACT include $(GENERAL_RULES)/CGAL diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options index 7c0b735815..7401615ddd 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/Make/options @@ -22,7 +22,7 @@ EXE_INC = \ EXE_LIBS = \ $(CGAL_LIBS) \ -lconformalVoronoiMesh \ - -ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \ + -ldecompositionMethods \ -ltriSurface \ -lsurfMesh \ -lmeshTools \ diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options index c0eac65238..f5f8a41820 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/Make/options @@ -5,7 +5,6 @@ include $(GENERAL_RULES)/CGAL EXE_INC = \ -DUNIX \ -Wno-old-style-cast \ - /* -IMarchingCubes */ \ -I$(FASTDUALOCTREE_SRC_PATH) \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \ diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index b50c6396e8..0fa291c8ef 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - /* -g -DFULLDEBUG -O0 */ \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/applications/utilities/mesh/manipulation/objToVTK/Make/options b/applications/utilities/mesh/manipulation/objToVTK/Make/options index 79a9626b55..e69de29bb2 100644 --- a/applications/utilities/mesh/manipulation/objToVTK/Make/options +++ b/applications/utilities/mesh/manipulation/objToVTK/Make/options @@ -1 +0,0 @@ -/* */ diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Make/options b/applications/utilities/mesh/manipulation/renumberMesh/Make/options index ef06510502..720011d74f 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/Make/options +++ b/applications/utilities/mesh/manipulation/renumberMesh/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - /* -DFULLDEBUG -g -O0 */ \ ${COMPILE_FLAGS} \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ diff --git a/applications/utilities/mesh/manipulation/zipUpMesh/Make/options b/applications/utilities/mesh/manipulation/zipUpMesh/Make/options index 082ffae98e..936ae242cf 100644 --- a/applications/utilities/mesh/manipulation/zipUpMesh/Make/options +++ b/applications/utilities/mesh/manipulation/zipUpMesh/Make/options @@ -1,8 +1,9 @@ EXE_INC = \ - -I$(LIB_SRC)/meshTools/lnInclude \ - /* -DDEBUG_ZIPUP */ \ - /* -DDEBUG_CHAIN */ \ - /* -DDEBUG_ORDER */ + -I$(LIB_SRC)/meshTools/lnInclude + +#EXE_INC += -DDEBUG_ZIPUP +#EXE_INC += -DDEBUG_CHAIN +#EXE_INC += -DDEBUG_ORDER EXE_LIBS = \ -lmeshTools diff --git a/applications/utilities/miscellaneous/foamListTimes/Make/options b/applications/utilities/miscellaneous/foamListTimes/Make/options index 18e6fe47af..e69de29bb2 100644 --- a/applications/utilities/miscellaneous/foamListTimes/Make/options +++ b/applications/utilities/miscellaneous/foamListTimes/Make/options @@ -1,2 +0,0 @@ -/* EXE_INC = */ -/* EXE_LIBS = */ diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options index b96dadc3c0..b6cb5424ff 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/Make/options @@ -1,4 +1,4 @@ -/* Note: enable vtkPolyhedron when available */ +# Note: enable vtkPolyhedron when available EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options index a58b65fb79..343daf982d 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/Make/options @@ -1,9 +1,9 @@ -/* Needs ParMGridGen environment variable set. (see Allwmake script) */ +# Needs ParMGridGen environment variable set. (see Allwmake script) -TYPE_REAL= -#if defined(WM_SP) -TYPE_REAL=-DTYPE_REAL -#endif +TYPE_REAL = +ifndef $(WM_SP) + TYPE_REAL = -DTYPE_REAL +endif EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 91c19f1488..acd99f9dc1 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -14,4 +14,3 @@ LIB_LIBS = \ -ldynamicFvMesh \ -lfiniteVolume \ -lfileFormats - /*-lforces include in controlDict if needed */ diff --git a/src/parallel/decompose/metisDecomp/Make/options b/src/parallel/decompose/metisDecomp/Make/options index 8acd678fd3..d4dfa96ba2 100644 --- a/src/parallel/decompose/metisDecomp/Make/options +++ b/src/parallel/decompose/metisDecomp/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - /* -DFULLDEBUG -g -O0 */ \ -I$(METIS_ARCH_PATH)/include \ -I../decompositionMethods/lnInclude diff --git a/src/parallel/decompose/scotchDecomp/Make/options b/src/parallel/decompose/scotchDecomp/Make/options index df47c9071c..038f88d5f7 100644 --- a/src/parallel/decompose/scotchDecomp/Make/options +++ b/src/parallel/decompose/scotchDecomp/Make/options @@ -1,7 +1,6 @@ -/* - * Note including of mplib compilation rules. - * This is purely to avoid scotch.h including mpicxx.h, which causes problems. - */ +# Note including of mplib compilation rules. +# This is purely to avoid scotch.h including mpicxx.h, which causes problems. + -include $(GENERAL_RULES)/mplibType EXE_INC = \ diff --git a/src/renumber/zoltanRenumber/Make/options b/src/renumber/zoltanRenumber/Make/options index 3b02b8dd9a..5bd46bbf9b 100644 --- a/src/renumber/zoltanRenumber/Make/options +++ b/src/renumber/zoltanRenumber/Make/options @@ -1,7 +1,6 @@ -include $(GENERAL_RULES)/mplibType EXE_INC = \ - /* -DFULLDEBUG -g -O0 */ \ $(PFLAGS) $(PINC) \ -I$(FOAM_SRC)/Pstream/mpi/lnInclude \ -I$(FOAM_SRC)/renumber/renumberMethods/lnInclude \ @@ -9,5 +8,4 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ - /* -L$(ZOLTAN_ARCH_PATH)/lib -lzoltan */ \ -lmeshTools diff --git a/wmake/makefiles/files b/wmake/makefiles/files index 2efc968aa0..c19ec548d9 100644 --- a/wmake/makefiles/files +++ b/wmake/makefiles/files @@ -25,8 +25,11 @@ # wmake/makefiles/files # # Description -# A Makefile for the 'options' and 'files' files, used by wmake +# A Makefile to process Make/files for gmake # +# If the Make/files file does not contain a SOURCE entry it is parsed by cpp +# to filter comments, expands macros and variable and the source file list +# is converted into the SOURCE entry for gmake. #------------------------------------------------------------------------------ GENERAL_RULES = $(WM_DIR)/rules/General @@ -38,10 +41,10 @@ include $(GENERAL_RULES)/general #------------------------------------------------------------------------------ OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS) -OPTIONS = $(OBJECTS_DIR)/options +OPTIONS = $(MAKE_DIR)/options FILES = $(OBJECTS_DIR)/files --include $(OPTIONS) +include $(OPTIONS) #------------------------------------------------------------------------------ @@ -49,32 +52,24 @@ FILES = $(OBJECTS_DIR)/files # Causes all derived files to be remade if any are changed or missing #------------------------------------------------------------------------------ -all : $(OPTIONS) $(FILES) +all : $(FILES) -$(OPTIONS) : $(MAKE_DIR)/options - @$(CPP) $(GFLAGS) $(MAKE_DIR)/options | sed -e 's@ *@ @g' > $(OPTIONS) +# Create a grep pattern from the source file suffix list +SUFFIX_PATTERN = \ + $(shell echo $(SUFFIXES) \ + | sed -e "s/\([a-zA-Z]\) \./\1\\\|./g" -e "s/\./\\\./g") -ifeq ($(shell grep "SOURCE" $(MAKE_DIR)/files),) -# List of source files format supporting cpp conditionals $(FILES): $(MAKE_DIR)/files @$(CPP) $(GFLAGS) $(MAKE_DIR)/files | sed -e 's@ *@ @g' \ > $(OBJECTS_DIR)/cppdFiles - # Create a grep pattern from the source file suffix list - @echo $(SUFFIXES) | sed -e "s/\([a-zA-Z]\) \./\1\\\|./g" -e "s/\./\\\./g" \ - > $(OBJECTS_DIR)/suffixPattern # Use the suffix pattern to find all non source file lines in files - @grep -v -f $(OBJECTS_DIR)/suffixPattern $(OBJECTS_DIR)/cppdFiles > $(FILES) + @grep -v "$(SUFFIX_PATTERN)" $(OBJECTS_DIR)/cppdFiles > $(FILES) # Use the suffix pattern to create the SOURCE entry from the source files @echo "SOURCE = \\" >> $(FILES) - @grep -f $(OBJECTS_DIR)/suffixPattern $(OBJECTS_DIR)/cppdFiles \ + @grep "$(SUFFIX_PATTERN)" $(OBJECTS_DIR)/cppdFiles \ | sed -e 's,$$, \\,' -e '$$s,\\,,' >> $(FILES) # Remove the temporary cpp'd files file @rm -f $(OBJECTS_DIR)/cppdFiles -else -# SOURCE declaration format supporting gmake conditionals -$(FILES): $(MAKE_DIR)/files - @$(CPP) $(GFLAGS) $(MAKE_DIR)/files | sed -e 's@ *@ @g' > $(FILES) -endif #------------------------------------------------------------------------------ diff --git a/wmake/makefiles/general b/wmake/makefiles/general index ec125adf1e..6a42191ef2 100644 --- a/wmake/makefiles/general +++ b/wmake/makefiles/general @@ -57,8 +57,8 @@ WM_SCRIPTS = $(WM_DIR)/scripts LIB_SRC = $(WM_PROJECT_DIR)/src LIB_PLATFORMS = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS) -OPTIONS = $(OBJECTS_DIR)/options -FILES = $(OBJECTS_DIR)/files +OPTIONS = $(MAKE_DIR)/options +FILES = $(MAKE_DIR)/files SYS_INC = SYS_LIBS = @@ -73,6 +73,12 @@ EXE_LIBS = LIB_LIBS = +# For backward compatibility set FILES to $(OBJECTS_DIR)/files if it has been +# created from $(MAKE_DIR)/files that does not contain the SOURCE entry +ifneq ("$(wildcard $(OBJECTS_DIR)/files)","") + FILES = $(OBJECTS_DIR)/files +endif + #------------------------------------------------------------------------------ # Declare default name of libraries and executables @@ -195,15 +201,15 @@ $(LIB).o: $(OBJECTS) # Set rule to create the include directory for libraries #------------------------------------------------------------------------------ -lnInclude: $(MAKE_DIR)/files $(MAKE_DIR)/options +lnInclude: $(MAKE_DIR)/files $(OPTIONS) @rm -rf lnInclude ; wmakeLnInclude . #------------------------------------------------------------------------------ -# Declare all object files depend on $(OBJECTS_DIR)/options +# Declare all object files depend on $(OPTIONS) #------------------------------------------------------------------------------ -$(OBJECTS): $(OBJECTS_DIR)/options +$(OBJECTS): $(OPTIONS) $(foreach S,$(SOURCE),$(eval $(OBJECTS_DIR)/$(basename $S).o : $(OBJECTS_DIR)/$S.dep)) diff --git a/wmake/wmake b/wmake/wmake index 82d2162c4e..8c0d815f4f 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -390,8 +390,7 @@ fi #------------------------------------------------------------------------------ -# Spawn a sub-shell and unset MAKEFLAGS in that sub-shell to avoid -# files and options being built in parallel +# Created the objectsDir directory #------------------------------------------------------------------------------ objectsDir=$MakeDir/$WM_OPTIONS @@ -402,29 +401,31 @@ then objectsDir=$platformPath${exPath//$WM_PROJECT_DIR/} fi -( - unset MAKEFLAGS - mkdir -p "$objectsDir" - - # Pre-build the $WM_OPTIONS/options file - # which is included when building the $WM_OPTIONS/files file - $make -s -f "$WM_DIR/makefiles/files" MAKE_DIR="$MakeDir" \ - OBJECTS_DIR="$objectsDir" "$objectsDir/options" - - $make -s -f "$WM_DIR/makefiles/files" MAKE_DIR="$MakeDir" \ - OBJECTS_DIR="$objectsDir" -) +mkdir -p "$objectsDir" #------------------------------------------------------------------------------ -# Check the $objectsDir/files file was created successfully +# Create $objectsDir/files from $MakeDir/files if necessary +# +# Spawn a sub-shell and unset MAKEFLAGS in that sub-shell to avoid +# $objectsDir/files being built in parallel #------------------------------------------------------------------------------ -[ -r "$objectsDir/files" ] || { - echo "$Script error: file '$objectsDir/files'" \ - "could not be created in $PWD" 1>&2 - exit 1 -} +if ! grep -q "SOURCE" "$MakeDir/files"; then + ( + unset MAKEFLAGS + + $make -s -f "$WM_DIR/makefiles/files" MAKE_DIR="$MakeDir" \ + OBJECTS_DIR="$objectsDir" + ) + + # Check the $objectsDir/files file was created successfully + [ -r "$objectsDir/files" ] || { + echo "$Script error: file '$objectsDir/files'" \ + "could not be created in $PWD" 1>&2 + exit 1 + } +fi #------------------------------------------------------------------------------