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.
This commit is contained in:
Henry Weller
2020-12-09 13:35:14 +00:00
parent 4eddb8b164
commit 30e6e02d29
25 changed files with 75 additions and 92 deletions

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,3 +0,0 @@
EXE_INC = /*-DFULLDEBUG -O0 -g*/ \
EXE_LIBS =

View File

@ -1,7 +1,3 @@
/* # Check for consistent behaviour with non-optimized code
check for consistent behaviour with non-optimized code
*/
EXE_INC = \ EXE_INC = \
-DFULLDEBUG -g -O0 -DFULLDEBUG -g -O0

View File

@ -1 +0,0 @@
EXE_INC = /* -DFULLDEBUG -g -O0 */

View File

@ -1,6 +1,3 @@
/* # Check for consistent behaviour with non-optimized code
check for consistent behaviour with non-optimized code
*/
EXE_INC = \ EXE_INC = \
-DFULLDEBUG -g -O0 -DFULLDEBUG -g -O0

View File

@ -1,13 +1,14 @@
EXE_INC = \ 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)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/conversion/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 = \ EXE_LIBS = \
-ldynamicMesh \ -ldynamicMesh \
-lconversion -lconversion

View File

@ -1,7 +1,8 @@
EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_DEBUG = -DFULLDEBUG -g -O0
EXE_NDEBUG = -DNDEBUG EXE_NDEBUG = -DNDEBUG
CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ CGAL_EXACT =
#CGAL_EXACT = -DCGAL_DONT_USE_LAZY_KERNEL
CGAL_INEXACT = -DCGAL_INEXACT CGAL_INEXACT = -DCGAL_INEXACT
include $(GENERAL_RULES)/CGAL include $(GENERAL_RULES)/CGAL

View File

@ -1,7 +1,8 @@
EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_DEBUG = -DFULLDEBUG -g -O0
EXE_NDEBUG = -DNDEBUG EXE_NDEBUG = -DNDEBUG
CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ CGAL_EXACT =
#CGAL_EXACT = -DCGAL_DONT_USE_LAZY_KERNEL
CGAL_INEXACT = -DCGAL_INEXACT CGAL_INEXACT = -DCGAL_INEXACT
include $(GENERAL_RULES)/CGAL include $(GENERAL_RULES)/CGAL

View File

@ -1,7 +1,8 @@
EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_DEBUG = -DFULLDEBUG -g -O0
EXE_NDEBUG = -DNDEBUG EXE_NDEBUG = -DNDEBUG
CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ CGAL_EXACT =
#CGAL_EXACT = -DCGAL_DONT_USE_LAZY_KERNEL
CGAL_INEXACT = -DCGAL_INEXACT CGAL_INEXACT = -DCGAL_INEXACT
include $(GENERAL_RULES)/CGAL include $(GENERAL_RULES)/CGAL

View File

@ -22,7 +22,7 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
$(CGAL_LIBS) \ $(CGAL_LIBS) \
-lconformalVoronoiMesh \ -lconformalVoronoiMesh \
-ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \ -ldecompositionMethods \
-ltriSurface \ -ltriSurface \
-lsurfMesh \ -lsurfMesh \
-lmeshTools \ -lmeshTools \

View File

@ -5,7 +5,6 @@ include $(GENERAL_RULES)/CGAL
EXE_INC = \ EXE_INC = \
-DUNIX \ -DUNIX \
-Wno-old-style-cast \ -Wno-old-style-cast \
/* -IMarchingCubes */ \
-I$(FASTDUALOCTREE_SRC_PATH) \ -I$(FASTDUALOCTREE_SRC_PATH) \
-I../conformalVoronoiMesh/lnInclude \ -I../conformalVoronoiMesh/lnInclude \
-I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \ -I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \

View File

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
/* -g -DFULLDEBUG -O0 */ \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \ -I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
/* -DFULLDEBUG -g -O0 */ \
${COMPILE_FLAGS} \ ${COMPILE_FLAGS} \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \

View File

@ -1,8 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude
/* -DDEBUG_ZIPUP */ \
/* -DDEBUG_CHAIN */ \ #EXE_INC += -DDEBUG_ZIPUP
/* -DDEBUG_ORDER */ #EXE_INC += -DDEBUG_CHAIN
#EXE_INC += -DDEBUG_ORDER
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools -lmeshTools

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,4 +1,4 @@
/* Note: enable vtkPolyhedron when available */ # Note: enable vtkPolyhedron when available
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -1,9 +1,9 @@
/* Needs ParMGridGen environment variable set. (see Allwmake script) */ # Needs ParMGridGen environment variable set. (see Allwmake script)
TYPE_REAL= TYPE_REAL =
#if defined(WM_SP) ifndef $(WM_SP)
TYPE_REAL=-DTYPE_REAL TYPE_REAL = -DTYPE_REAL
#endif endif
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \

View File

@ -14,4 +14,3 @@ LIB_LIBS = \
-ldynamicFvMesh \ -ldynamicFvMesh \
-lfiniteVolume \ -lfiniteVolume \
-lfileFormats -lfileFormats
/*-lforces include in controlDict if needed */

View File

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
/* -DFULLDEBUG -g -O0 */ \
-I$(METIS_ARCH_PATH)/include \ -I$(METIS_ARCH_PATH)/include \
-I../decompositionMethods/lnInclude -I../decompositionMethods/lnInclude

View File

@ -1,7 +1,6 @@
/* # Note including of mplib compilation rules.
* Note including of mplib compilation rules. # This is purely to avoid scotch.h including mpicxx.h, which causes problems.
* This is purely to avoid scotch.h including mpicxx.h, which causes problems.
*/
-include $(GENERAL_RULES)/mplibType -include $(GENERAL_RULES)/mplibType
EXE_INC = \ EXE_INC = \

View File

@ -1,7 +1,6 @@
-include $(GENERAL_RULES)/mplibType -include $(GENERAL_RULES)/mplibType
EXE_INC = \ EXE_INC = \
/* -DFULLDEBUG -g -O0 */ \
$(PFLAGS) $(PINC) \ $(PFLAGS) $(PINC) \
-I$(FOAM_SRC)/Pstream/mpi/lnInclude \ -I$(FOAM_SRC)/Pstream/mpi/lnInclude \
-I$(FOAM_SRC)/renumber/renumberMethods/lnInclude \ -I$(FOAM_SRC)/renumber/renumberMethods/lnInclude \
@ -9,5 +8,4 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \ LIB_LIBS = \
/* -L$(ZOLTAN_ARCH_PATH)/lib -lzoltan */ \
-lmeshTools -lmeshTools

View File

@ -25,8 +25,11 @@
# wmake/makefiles/files # wmake/makefiles/files
# #
# Description # 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 GENERAL_RULES = $(WM_DIR)/rules/General
@ -38,10 +41,10 @@ include $(GENERAL_RULES)/general
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS) OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
OPTIONS = $(OBJECTS_DIR)/options OPTIONS = $(MAKE_DIR)/options
FILES = $(OBJECTS_DIR)/files 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 # Causes all derived files to be remade if any are changed or missing
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
all : $(OPTIONS) $(FILES) all : $(FILES)
$(OPTIONS) : $(MAKE_DIR)/options # Create a grep pattern from the source file suffix list
@$(CPP) $(GFLAGS) $(MAKE_DIR)/options | sed -e 's@ *@ @g' > $(OPTIONS) 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 $(FILES): $(MAKE_DIR)/files
@$(CPP) $(GFLAGS) $(MAKE_DIR)/files | sed -e 's@ *@ @g' \ @$(CPP) $(GFLAGS) $(MAKE_DIR)/files | sed -e 's@ *@ @g' \
> $(OBJECTS_DIR)/cppdFiles > $(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 # 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 # Use the suffix pattern to create the SOURCE entry from the source files
@echo "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) | sed -e 's,$$, \\,' -e '$$s,\\,,' >> $(FILES)
# Remove the temporary cpp'd files file # Remove the temporary cpp'd files file
@rm -f $(OBJECTS_DIR)/cppdFiles @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
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -57,8 +57,8 @@ WM_SCRIPTS = $(WM_DIR)/scripts
LIB_SRC = $(WM_PROJECT_DIR)/src LIB_SRC = $(WM_PROJECT_DIR)/src
LIB_PLATFORMS = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib LIB_PLATFORMS = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib
OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS) OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS)
OPTIONS = $(OBJECTS_DIR)/options OPTIONS = $(MAKE_DIR)/options
FILES = $(OBJECTS_DIR)/files FILES = $(MAKE_DIR)/files
SYS_INC = SYS_INC =
SYS_LIBS = SYS_LIBS =
@ -73,6 +73,12 @@ EXE_LIBS =
LIB_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 # Declare default name of libraries and executables
@ -195,15 +201,15 @@ $(LIB).o: $(OBJECTS)
# Set rule to create the include directory for libraries # 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 . @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)) $(foreach S,$(SOURCE),$(eval $(OBJECTS_DIR)/$(basename $S).o : $(OBJECTS_DIR)/$S.dep))

View File

@ -390,8 +390,7 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Spawn a sub-shell and unset MAKEFLAGS in that sub-shell to avoid # Created the objectsDir directory
# files and options being built in parallel
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
objectsDir=$MakeDir/$WM_OPTIONS objectsDir=$MakeDir/$WM_OPTIONS
@ -402,29 +401,31 @@ then
objectsDir=$platformPath${exPath//$WM_PROJECT_DIR/} objectsDir=$platformPath${exPath//$WM_PROJECT_DIR/}
fi fi
( mkdir -p "$objectsDir"
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"
)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# 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" ] || { if ! grep -q "SOURCE" "$MakeDir/files"; then
echo "$Script error: file '$objectsDir/files'" \ (
"could not be created in $PWD" 1>&2 unset MAKEFLAGS
exit 1
} $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
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------