From 1cdbeb29d76fd334934a28486cd1564f552926e1 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Wed, 6 May 2009 15:56:29 +0200 Subject: [PATCH] minor tweak to wmake - place wmkdep and dirToString executables under utilbin/$(WM_ARCH)$(WM_COMPILER). This helps somewhat when copying rules about, and might help when creating general rules. --- wmake/Makefile | 10 +++++++--- wmake/MakefileApps | 2 +- wmake/MakefileFiles | 2 +- wmake/MakefileOptions | 4 ++-- wmake/makeWmake | 2 +- wmake/rules/General/mplibOPENMPI | 3 +++ wmake/rules/General/sourceToDep | 2 +- wmake/rules/linux64Gcc/X | 4 ++-- wmake/scripts/addCompile | 2 +- wmake/scripts/makeFiles | 30 +++++++++++++++--------------- wmake/scripts/makeOptions | 2 +- wmake/scripts/mkObjectDir | 2 +- wmake/src/Makefile | 22 +++++++++++++--------- wmake/src/dirToString.c | 12 ++++++------ wmake/src/wmkdep.l | 4 ++-- wmake/wmkdir | 15 +++++++++------ 16 files changed, 66 insertions(+), 52 deletions(-) create mode 100644 wmake/rules/General/mplibOPENMPI diff --git a/wmake/Makefile b/wmake/Makefile index cd1d1f0e433..02c573a2659 100644 --- a/wmake/Makefile +++ b/wmake/Makefile @@ -4,7 +4,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # @@ -65,7 +65,10 @@ SYS_LIBS = PROJECT_INC = -I$(LIB_SRC)/$(WM_PROJECT)/lnInclude -I$(LIB_SRC)/OSspecific/$(WM_OS)/lnInclude PROJECT_LIBS = -l$(WM_PROJECT) -PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g')) +## +## unused: +## PROJECT_VERSION = $(shell printf -- "-DPROJECT_VERSION=%d%03d%03d" $$(echo $(WM_PROJECT_VERSION) | sed -e 's/\./ /g')) +## EXE_INC = EXE_LIBS = @@ -103,6 +106,7 @@ SEXE = a.out GENERAL_RULES = $(WM_DIR)/rules/General RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +UTILBIN = $(WM_DIR)/utilbin/$(WM_ARCH)$(WM_COMPILER) include $(GENERAL_RULES)/general include $(RULES)/general @@ -197,7 +201,7 @@ $(LIB).jar: $(OBJECTS) #------------------------------------------------------------------------------ lnInclude/uptodate: $(MAKE_DIR)/files $(MAKE_DIR)/options - @rm -rf lnInclude ; wmakeLnInclude `pwd` ; touch lnInclude/uptodate + @rm -rf lnInclude ; wmakeLnInclude . ; touch lnInclude/uptodate #------------------------------------------------------------------------------ diff --git a/wmake/MakefileApps b/wmake/MakefileApps index 607925d7792..56c089c8536 100644 --- a/wmake/MakefileApps +++ b/wmake/MakefileApps @@ -4,7 +4,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/wmake/MakefileFiles b/wmake/MakefileFiles index 9c95ed320f0..4c2ef52826a 100644 --- a/wmake/MakefileFiles +++ b/wmake/MakefileFiles @@ -4,7 +4,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/wmake/MakefileOptions b/wmake/MakefileOptions index 06bfccd123d..92834a9a659 100644 --- a/wmake/MakefileOptions +++ b/wmake/MakefileOptions @@ -4,7 +4,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # @@ -43,7 +43,7 @@ include $(RULES)/general OPTIONS = $(WM_OPTIONS)/options #------------------------------------------------------------------------------ -# Declare dependecy of all make system files on FILE +# Declare dependency of all make system files on FILE # Causes all derived files to be remade if any are changed or missing #------------------------------------------------------------------------------ diff --git a/wmake/makeWmake b/wmake/makeWmake index 659e1ba3776..30a65650955 100755 --- a/wmake/makeWmake +++ b/wmake/makeWmake @@ -5,7 +5,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/wmake/rules/General/mplibOPENMPI b/wmake/rules/General/mplibOPENMPI new file mode 100644 index 00000000000..834d2d3e22a --- /dev/null +++ b/wmake/rules/General/mplibOPENMPI @@ -0,0 +1,3 @@ +PFLAGS = -DOMPI_SKIP_MPICXX +PINC = -I$(MPI_ARCH_PATH)/include +PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi diff --git a/wmake/rules/General/sourceToDep b/wmake/rules/General/sourceToDep index 21332f95fb3..9935761405f 100644 --- a/wmake/rules/General/sourceToDep +++ b/wmake/rules/General/sourceToDep @@ -1,6 +1,6 @@ .SUFFIXES: .c .cc .cxx .cpp .C .java .F .f .dep -MKDEP = $(RULES)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) +MKDEP = $(UTILBIN)/wmkdep -I$(*D) $(LIB_HEADER_DIRS) .c.dep: $(MAKE_DEP) diff --git a/wmake/rules/linux64Gcc/X b/wmake/rules/linux64Gcc/X index 5d1f9c5cc54..47480abd229 100644 --- a/wmake/rules/linux64Gcc/X +++ b/wmake/rules/linux64Gcc/X @@ -1,3 +1,3 @@ XFLAGS = -XINC = $(XFLAGS) -I/usr/X11R6/include -XLIBS = -L/usr/X11R6/lib64 -lXext -lX11 +XINC = $(XFLAGS) -I/usr/include/X11 +XLIBS = -L/usr/lib64 -lXext -lX11 diff --git a/wmake/scripts/addCompile b/wmake/scripts/addCompile index f0963d0b145..802768241b4 100755 --- a/wmake/scripts/addCompile +++ b/wmake/scripts/addCompile @@ -5,7 +5,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/wmake/scripts/makeFiles b/wmake/scripts/makeFiles index e3ed7029397..3ccc3fa2213 100755 --- a/wmake/scripts/makeFiles +++ b/wmake/scripts/makeFiles @@ -5,7 +5,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # @@ -35,11 +35,11 @@ if [ -r Make/files ] then - echo "makeFiles: Make/files already exists, exiting" - exit 1 + echo "makeFiles: Make/files already exists, exiting" + exit 1 fi -rulesPath=$WM_DIR/rules/$WM_ARCH$WM_COMPILER +utilbin=$WM_DIR/utilbin/$WM_ARCH$WM_COMPILER [ -d Make ] || mkdir Make rm -f Make/files @@ -48,16 +48,16 @@ dirs=`find . -name "*" -type d -print` for dir in $dirs do - if [ $dir != . ] - then - baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString` - baseDir=`echo $dir | sed 's%^\./%%'` + if [ $dir != . ] + then + baseDir=`echo $dir | sed 's%^\./%%'` + baseDirName=`echo $baseDir | $utilbin/dirToString` - if [ $baseDirName != Make ] - then - echo $baseDirName " = " $baseDir >> Make/files - fi - fi + if [ $baseDirName != Make ] + then + echo $baseDirName " = " $baseDir >> Make/files + fi + fi done echo >> Make/files @@ -66,12 +66,12 @@ files=`find . -name "*.[cCylfF]" -type f -print` for file in $files do - pathName=`echo ${file%/*} | sed 's%^\.%%' | sed 's%^/%%' | $rulesPath/dirToString` + pathName=`echo ${file%/*} | sed 's%^\.%%' | sed 's%^/%%' | $utilbin/dirToString` fileName=`echo ${file##*/}` if [ "$pathName" != "" ] then - echo '$('$pathName")/"$fileName >> Make/files + echo '$('$pathName')/'$fileName >> Make/files else echo $fileName >> Make/files fi diff --git a/wmake/scripts/makeOptions b/wmake/scripts/makeOptions index 3a8d706b820..47c9f0c271f 100755 --- a/wmake/scripts/makeOptions +++ b/wmake/scripts/makeOptions @@ -5,7 +5,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/wmake/scripts/mkObjectDir b/wmake/scripts/mkObjectDir index db4762ecf18..3008303ae36 100755 --- a/wmake/scripts/mkObjectDir +++ b/wmake/scripts/mkObjectDir @@ -5,7 +5,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # diff --git a/wmake/src/Makefile b/wmake/src/Makefile index 11900fd6a0f..daa1e56c6bc 100644 --- a/wmake/src/Makefile +++ b/wmake/src/Makefile @@ -4,7 +4,7 @@ # \\ / O peration | # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\/ M anipulation | -#------------------------------------------------------------------------------- +#------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # @@ -43,26 +43,30 @@ SHELL = /bin/sh .SUFFIXES: .SUFFIXES: .o -RULES_DIR = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +UTILBIN = $(WM_DIR)/utilbin/$(WM_ARCH)$(WM_COMPILER) -all: $(RULES_DIR)/dirToString $(RULES_DIR)/wmkdep +all: $(UTILBIN)/dirToString $(UTILBIN)/wmkdep clean: - rm -f $(RULES_DIR)/dirToString $(RULES_DIR)/wmkdep 2>/dev/null + rm -f $(UTILBIN)/dirToString $(UTILBIN)/wmkdep 2>/dev/null + +$(UTILBIN)/dirToString: dirToString.c + @mkdir -p $(UTILBIN) + $(cc) $(cFLAGS) dirToString.c -o $(UTILBIN)/dirToString -$(RULES_DIR)/dirToString: dirToString.c - $(cc) $(cFLAGS) dirToString.c -o $(RULES_DIR)/dirToString +$(UTILBIN)/wmkdep: wmkdep.l + @mkdir -p $(UTILBIN) + flex wmkdep.l + $(cc) $(cFLAGS) lex.yy.c -o $(UTILBIN)/wmkdep -$(RULES_DIR)/wmkdep: wmkdep.l - flex wmkdep.l ; $(cc) $(cFLAGS) lex.yy.c -o $(RULES_DIR)/wmkdep #------------------------------------------------------------------------------ # set compilation and dependency building rules #------------------------------------------------------------------------------ GENERAL_RULES = $(WM_DIR)/rules/General -RULES = $(RULES_DIR) +RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) include $(RULES)/general include $(RULES)/$(WM_LINK_LANGUAGE) diff --git a/wmake/src/dirToString.c b/wmake/src/dirToString.c index e7ba1f1505b..1116214530d 100644 --- a/wmake/src/dirToString.c +++ b/wmake/src/dirToString.c @@ -33,11 +33,11 @@ Usage echo dirName | dirToString e.g. - using csh - set baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString` + using sh + baseDirName=`echo $dir | sed 's%^\./%%' | $utilbin/dirToString` - using ksh - baseDirName=`echo $dir | sed 's%^\./%%' | $rulesPath/dirToString` + using csh + set baseDirName=`echo $dir | sed 's%^\./%%' | $utilbin/dirToString` \*----------------------------------------------------------------------------*/ @@ -49,7 +49,7 @@ int main() { int c; int nextupper = 0; - + while ((c=getchar()) != EOF) { if (c == '/') @@ -66,7 +66,7 @@ int main() { putchar(c); } - + nextupper = 0; } } diff --git a/wmake/src/wmkdep.l b/wmake/src/wmkdep.l index 7f79bb3ea27..43eb4899b78 100644 --- a/wmake/src/wmkdep.l +++ b/wmake/src/wmkdep.l @@ -36,7 +36,7 @@ Description only once. This is why this program is faster than cpp. Usage - wmkdep [ -Idirectory ... -Idirectory] filename + wmkdep [ -Idirectory ... -Idirectory ] filename \*---------------------------------------------------------------------------*/ @@ -107,7 +107,7 @@ int main(int argc, char* argv[]) sourceFile = (char*)malloc(strlen(argv[argc-1]) + 1); strcpy(sourceFile, argv[argc-1]); - fprintf(stderr,"Making dependency list for source file %s\n", sourceFile); + fprintf(stderr, "Making dependency list for source file %s\n", sourceFile); /* Get list of -I directories. */ diff --git a/wmake/wmkdir b/wmake/wmkdir index 441eedb52db..e9703d2733d 100755 --- a/wmake/wmkdir +++ b/wmake/wmkdir @@ -27,21 +27,24 @@ # wmkdir # # Description -# Script to make a directory that does not already exist -# Usage : wmkdir <dir> +# Script to make directories that do not already exist +# Usage : wmkdir <dir> [.. <dirN>] # #------------------------------------------------------------------------------ -if [ $# -eq 1 ] +if [ $# -ge 1 ] then # provide help if [ "$1" = "-h" -o "$1" = "-help" ] then - echo "usage: ${0##*/} <dir>" - echo " mkdir if directory does not already exist" + echo "usage: ${0##*/} <dir> [.. <dirN>]" + echo " mkdir if directories do not already exist" echo else - [ -d "$1" ] || mkdir -p "$1" + for dir + do + [ -d "$dir" ] || mkdir -p "$dir" + done fi fi -- GitLab