mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into splitCyclic
Conflicts: src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C src/parallel/decompose/scotchDecomp/scotchDecomp.C src/parallel/parMetisDecomp/parMetisDecomp.C src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C
This commit is contained in:
@ -6,9 +6,8 @@
|
||||
.SUFFIXES: .atg
|
||||
|
||||
atgtoo = \
|
||||
$(WM_THIRD_PARTY_DIR)/coco-cpp/platforms/$(WM_ARCH)$(WM_COMPILER)/bin/coco-cpp \
|
||||
$(WM_THIRD_PARTY_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)/coco-cpp/bin/coco-cpp \
|
||||
-single \
|
||||
-frames $(WM_THIRD_PARTY_DIR)/coco-cpp/platforms/share/coco-cpp \
|
||||
$$SOURCE -o $(OBJECTS_DIR) && \
|
||||
$(CC) $(c++FLAGS) -c $*.cpp -o $@
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# File
|
||||
# Makefile
|
||||
#
|
||||
# Description
|
||||
|
||||
55
wmake/src/makeParserCode
Executable file
55
wmake/src/makeParserCode
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
#
|
||||
# OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# Script
|
||||
# makeParserCode
|
||||
#
|
||||
# Description
|
||||
# Use coco-cpp to create parser code
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
|
||||
bindir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/coco-cpp/bin
|
||||
frames=$bindir/../share/coco-cpp
|
||||
|
||||
[ -d "$bindir" -a -x "$bindir/coco-cpp" ] || {
|
||||
echo "no coco-cpp binary found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -d "$frames" -a -f "$frames/Parser.frame" -a -f "$frames/Scanner.frame" ] || {
|
||||
echo "no coco-cpp frames found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# run coco-cpp:
|
||||
$bindir/coco-cpp wmkdependParser.atg
|
||||
|
||||
echo
|
||||
echo Done
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -27,16 +27,16 @@ Application
|
||||
wmkdep
|
||||
|
||||
Description
|
||||
A fast dependency list generator that emulates the behaviour and
|
||||
output of cpp -M. However, the output contains no duplications and
|
||||
is ~40% faster than cpp.
|
||||
A fast dependency list generator that emulates the behaviour and the
|
||||
output of cpp -M. However, the output contains no duplicates and
|
||||
is approx. 40% faster than cpp.
|
||||
|
||||
The algorithm uses flex to scan for includes and searches the files
|
||||
found. Each file is entered into a hash table so that files are scanned
|
||||
only once. This is why this program is faster than cpp.
|
||||
|
||||
Usage
|
||||
wmkdep [ -Idirectory ... -Idirectory ] filename
|
||||
wmkdep [ -Idir ... -Idir ] [ -iheader .. -iheader ] filename
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -50,7 +50,7 @@ Usage
|
||||
|
||||
void nextFile(const char* fileName);
|
||||
void importFile(const char* fileName);
|
||||
void importDirectory(const char* dirName);
|
||||
void importDir(const char* dirName);
|
||||
|
||||
# undef yywrap /* sometimes a macro by default */
|
||||
|
||||
@ -76,7 +76,7 @@ void importDirectory(const char* dirName);
|
||||
<JFNAME>sun.*; BEGIN(INITIAL);
|
||||
<JFNAME>launcher.*; BEGIN(INITIAL);
|
||||
<JFNAME>[^"\n*]*; { BEGIN(INITIAL); importFile(yytext); } /*"*/
|
||||
<JFNAME>[^"\n]*\*; { BEGIN(INITIAL); importDirectory(yytext); } /*"*/
|
||||
<JFNAME>[^"\n]*\*; { BEGIN(INITIAL); importDir(yytext); } /*"*/
|
||||
|
||||
" "include[ \t]+\' BEGIN(FFNAME); /* FORTRAN-file name */
|
||||
<FFNAME>[^']* { BEGIN(INITIAL); nextFile(yytext); } /*'*/
|
||||
@ -86,155 +86,24 @@ void importDirectory(const char* dirName);
|
||||
%%
|
||||
|
||||
|
||||
int nDirectories;
|
||||
char** directories;
|
||||
char* sourceFile = NULL;
|
||||
char* sourceExt = NULL;
|
||||
char* objectFile = NULL;
|
||||
char* classFile = NULL;
|
||||
char* depFile = NULL;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char *dotPtr, *slashPtr;
|
||||
int i;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
fprintf(stderr,"input file not supplied\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sourceFile = (char*)malloc(strlen(argv[argc-1]) + 1);
|
||||
strcpy(sourceFile, argv[argc-1]);
|
||||
fprintf(stderr, "Making dependency list for source file %s\n", sourceFile);
|
||||
|
||||
|
||||
/* Get list of -I directories. */
|
||||
nDirectories = 0;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strncmp(argv[i], "-I", 2) == 0)
|
||||
{
|
||||
nDirectories++;
|
||||
}
|
||||
}
|
||||
|
||||
directories = (char**)malloc(sizeof(char*)*nDirectories);
|
||||
|
||||
nDirectories = 0;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strncmp(argv[i], "-I", 2) == 0)
|
||||
{
|
||||
directories[nDirectories++] = strdup(argv[i] + 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((dotPtr = strrchr(sourceFile, '.')) == NULL)
|
||||
{
|
||||
fprintf
|
||||
(
|
||||
stderr,
|
||||
"Cannot find extension in source file name %s\n",
|
||||
sourceFile
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((slashPtr = strrchr(sourceFile, '/')) == NULL)
|
||||
{
|
||||
slashPtr = sourceFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
slashPtr++;
|
||||
}
|
||||
|
||||
sourceExt = (char*)malloc(strlen(sourceFile));
|
||||
sourceExt[0] = 0;
|
||||
strncat
|
||||
(
|
||||
sourceExt,
|
||||
dotPtr+1,
|
||||
(&sourceFile[strlen(sourceFile) - 1] - dotPtr)/sizeof(char)
|
||||
);
|
||||
|
||||
/*
|
||||
* initialise depFile to zero and use strncat rather than strncpy
|
||||
* because there is a bug in the SGI strncat that if 0 preceeds the '.'
|
||||
* it inserts a space
|
||||
*/
|
||||
depFile = (char*)malloc(strlen(sourceFile) + 3);
|
||||
depFile[0] = 0;
|
||||
strncat(depFile, sourceFile, (dotPtr - sourceFile)/sizeof(char));
|
||||
strcat(depFile, ".dep");
|
||||
|
||||
if (strcmp(sourceExt, "java") == 0)
|
||||
{
|
||||
classFile = (char*)malloc(strlen(sourceFile) + 17);
|
||||
strcpy(classFile, "$(CLASSES_DIR)/");
|
||||
strncat(classFile, sourceFile, (dotPtr - sourceFile)/sizeof(char));
|
||||
strcat(classFile, ".class");
|
||||
|
||||
printf("%s: %s\n", classFile, depFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
objectFile = (char*)malloc(strlen(sourceFile) + 16);
|
||||
strcpy(objectFile, "$(OBJECTS_DIR)/");
|
||||
strncat(objectFile, slashPtr, (dotPtr - slashPtr)/sizeof(char));
|
||||
strcat(objectFile, ".o");
|
||||
|
||||
printf("%s: %s\n", objectFile, depFile);
|
||||
}
|
||||
|
||||
nextFile(sourceFile);
|
||||
yylex();
|
||||
|
||||
|
||||
for (i = 0; i < nDirectories; i++)
|
||||
{
|
||||
free(directories[i]);
|
||||
}
|
||||
free(directories);
|
||||
|
||||
free(sourceFile);
|
||||
free(sourceExt);
|
||||
free(objectFile);
|
||||
free(classFile);
|
||||
free(depFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int currentBuffer = 0; /* Buffer pointer stack counter */
|
||||
YY_BUFFER_STATE buffers[FILE_STACK_SIZE]; /* Buffer pointer stack */
|
||||
|
||||
/* file name entry in hash table */
|
||||
|
||||
struct FileName
|
||||
/* char* entry in hash table */
|
||||
struct HashEntry
|
||||
{
|
||||
char* name;
|
||||
struct FileName* next;
|
||||
struct HashEntry* next;
|
||||
};
|
||||
|
||||
struct FileName* fileHashTable[HASH_TABLE_SIZE]; /* File hash table */
|
||||
struct FileName* dirHashTable[HASH_TABLE_SIZE]; /* Directory hash table */
|
||||
|
||||
|
||||
/* lookup name in hash table, if not found insert in table */
|
||||
|
||||
int lookUp(struct FileName** hashTable, const char* p)
|
||||
/*
|
||||
* lookup name in hash table.
|
||||
* if found - return 1
|
||||
* if not found - insert in table and return 0
|
||||
*/
|
||||
int lookUp(struct HashEntry** hashTable, const char* p)
|
||||
{
|
||||
int ii = 0;
|
||||
struct FileName* n;
|
||||
struct FileName* nn;
|
||||
struct HashEntry* n;
|
||||
struct HashEntry* nn;
|
||||
|
||||
/* hash */
|
||||
const char* pp = p;
|
||||
@ -253,9 +122,8 @@ int lookUp(struct FileName** hashTable, const char* p)
|
||||
}
|
||||
|
||||
/* insert */
|
||||
nn = (struct FileName*)malloc(sizeof(struct FileName));
|
||||
nn->name = (char*)malloc(strlen(p)+1);
|
||||
strcpy(nn->name, p);
|
||||
nn = (struct HashEntry*)malloc(sizeof(struct HashEntry));
|
||||
nn->name = strdup(p);
|
||||
nn->next = hashTable[ii];
|
||||
hashTable[ii] = nn;
|
||||
|
||||
@ -264,17 +132,152 @@ int lookUp(struct FileName** hashTable, const char* p)
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/* Add a directory name to the file name */
|
||||
|
||||
char* addDirectoryName(const char* directoryName, const char* fileName)
|
||||
int nDirectories = 0;
|
||||
char** directories;
|
||||
char* sourceFile = NULL;
|
||||
char* depFile = NULL;
|
||||
|
||||
/* Set of files already visited */
|
||||
struct HashEntry* visitedFiles[HASH_TABLE_SIZE];
|
||||
|
||||
/* Set of (java) directories already visited */
|
||||
struct HashEntry* visitedDirs[HASH_TABLE_SIZE];
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char* pathName;
|
||||
pathName = (char*)malloc(strlen(directoryName) + strlen(fileName) + 2);
|
||||
char *basePos, *dotPos;
|
||||
int i;
|
||||
|
||||
strcpy(pathName, directoryName);
|
||||
if (argc == 1)
|
||||
{
|
||||
fprintf(stderr, "input file not supplied\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (directoryName[strlen(directoryName)-1] != '/')
|
||||
sourceFile = strdup(argv[argc-1]);
|
||||
fprintf(stderr, "Making dependency list for source file %s\n", sourceFile);
|
||||
|
||||
|
||||
if ((basePos = strrchr(sourceFile, '/')) == NULL)
|
||||
{
|
||||
basePos = sourceFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
basePos++;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
(dotPos = strrchr(sourceFile, '.')) == NULL
|
||||
|| (dotPos < basePos)
|
||||
)
|
||||
{
|
||||
fprintf
|
||||
(
|
||||
stderr,
|
||||
"cannot find extension in source file name %s\n",
|
||||
sourceFile
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* count number of -I directories */
|
||||
nDirectories = 0;
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strncmp(argv[i], "-I", 2) == 0)
|
||||
{
|
||||
if (strlen(argv[i]) > 2)
|
||||
{
|
||||
nDirectories++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
directories = (char**)malloc(sizeof(char*)*nDirectories);
|
||||
|
||||
/* build list of -I directories and add -i ignores */
|
||||
nDirectories = 0;
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strncmp(argv[i], "-I", 2) == 0)
|
||||
{
|
||||
if (strlen(argv[i]) > 2)
|
||||
{
|
||||
directories[nDirectories++] = strdup(argv[i] + 2);
|
||||
}
|
||||
}
|
||||
else if (strncmp(argv[i], "-i", 2) == 0)
|
||||
{
|
||||
if (strlen(argv[i]) > 2)
|
||||
{
|
||||
lookUp(visitedFiles, (argv[i] + 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* initialise depFile to zero and use strncat rather than strncpy
|
||||
* because there is a bug in the SGI strncat that if 0 preceeds the '.'
|
||||
* it inserts a space
|
||||
*/
|
||||
depFile = (char*)malloc(strlen(sourceFile) + 3);
|
||||
depFile[0] = 0;
|
||||
strncat(depFile, sourceFile, (dotPos - sourceFile)/sizeof(char));
|
||||
strcat(depFile, ".dep");
|
||||
|
||||
if (strcmp(dotPos, ".java") == 0)
|
||||
{
|
||||
char *classFile = strdup(sourceFile);
|
||||
classFile[(dotPos - sourceFile)/sizeof(char)] = 0;
|
||||
|
||||
printf("$(CLASSES_DIR)/%s.class: %s\n", classFile, depFile);
|
||||
free(classFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *objectFile = strdup(basePos);
|
||||
objectFile[(dotPos - basePos)/sizeof(char)] = 0;
|
||||
|
||||
printf("$(OBJECTS_DIR)/%s.o: %s\n", objectFile, depFile);
|
||||
free(objectFile);
|
||||
}
|
||||
|
||||
nextFile(sourceFile);
|
||||
yylex();
|
||||
|
||||
|
||||
for (i = 0; i < nDirectories; i++)
|
||||
{
|
||||
free(directories[i]);
|
||||
}
|
||||
free(directories);
|
||||
|
||||
free(sourceFile);
|
||||
free(depFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int currentBuffer = 0; /* Buffer pointer stack counter */
|
||||
YY_BUFFER_STATE buffers[FILE_STACK_SIZE]; /* Buffer pointer stack */
|
||||
|
||||
|
||||
/*
|
||||
* Add a directory name to the file name
|
||||
*/
|
||||
char* addDirectoryName(const char* dirName, const char* fileName)
|
||||
{
|
||||
char* pathName = (char*)malloc(strlen(dirName) + strlen(fileName) + 2);
|
||||
strcpy(pathName, dirName);
|
||||
|
||||
if (dirName[strlen(dirName)-1] != '/')
|
||||
{
|
||||
strcat(pathName, "/");
|
||||
}
|
||||
@ -285,14 +288,15 @@ char* addDirectoryName(const char* directoryName, const char* fileName)
|
||||
}
|
||||
|
||||
|
||||
/* open a file and create buffer and put on stack stack */
|
||||
|
||||
/*
|
||||
* open a file and create buffer and put on stack
|
||||
*/
|
||||
void nextFile(const char* fileName)
|
||||
{
|
||||
int d;
|
||||
char* pathName;
|
||||
|
||||
if (lookUp(fileHashTable, fileName)) return;
|
||||
if (lookUp(visitedFiles, fileName))
|
||||
{
|
||||
return; /* already existed (did not insert) */
|
||||
}
|
||||
|
||||
if (currentBuffer >= FILE_STACK_SIZE)
|
||||
{
|
||||
@ -311,9 +315,10 @@ void nextFile(const char* fileName)
|
||||
|
||||
if (!(newyyin = fopen(fileName, "r")))
|
||||
{
|
||||
int d;
|
||||
for (d=0; d<nDirectories; d++)
|
||||
{
|
||||
pathName = addDirectoryName(directories[d], fileName);
|
||||
char* pathName = addDirectoryName(directories[d], fileName);
|
||||
|
||||
if ((newyyin = fopen(pathName, "r")))
|
||||
{
|
||||
@ -337,6 +342,10 @@ void nextFile(const char* fileName)
|
||||
);
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
/* only report the first occurance */
|
||||
lookUp(visitedFiles, fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -349,10 +358,12 @@ void nextFile(const char* fileName)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Replace all '.' with '/'
|
||||
*/
|
||||
void dotToSlash(char* fileName)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
len = strlen(fileName);
|
||||
|
||||
for (i=0; i<len; i++)
|
||||
@ -362,6 +373,9 @@ void dotToSlash(char* fileName)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Import (java) file
|
||||
*/
|
||||
void importFile(const char* fileName)
|
||||
{
|
||||
char* javaFileName;
|
||||
@ -380,19 +394,23 @@ void importFile(const char* fileName)
|
||||
}
|
||||
|
||||
|
||||
void importDirectory(const char* dirName)
|
||||
/*
|
||||
* Import (java) directories
|
||||
*/
|
||||
void importDir(const char* dirName)
|
||||
{
|
||||
int dirNameLen;
|
||||
char *uDirName, *path;
|
||||
char *uDirName;
|
||||
DIR *source;
|
||||
struct dirent *list;
|
||||
|
||||
if (lookUp(dirHashTable, dirName)) return;
|
||||
if (lookUp(visitedDirs, dirName))
|
||||
{
|
||||
return; /* already existed (did not insert) */
|
||||
}
|
||||
|
||||
dirNameLen = strlen(dirName);
|
||||
uDirName = strdup(dirName);
|
||||
dotToSlash(uDirName);
|
||||
uDirName[dirNameLen-2] = 0;
|
||||
|
||||
uDirName[strlen(dirName)-2] = 0;
|
||||
|
||||
if ((source = opendir(uDirName)) == NULL)
|
||||
{
|
||||
@ -402,35 +420,33 @@ void importDirectory(const char* dirName)
|
||||
"could not open directory %s\n",
|
||||
uDirName
|
||||
);
|
||||
free(uDirName);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read and parse all the entries in the directory */
|
||||
struct dirent *list;
|
||||
|
||||
while ((list = readdir(source)) != NULL)
|
||||
{
|
||||
if
|
||||
(
|
||||
strstr(list->d_name, ".java")
|
||||
&& !strstr(list->d_name, ".java~")
|
||||
)
|
||||
char* dotPos = strrchr(list->d_name, '.');
|
||||
|
||||
if (dotPos != NULL && strcmp(dotPos, ".java") == 0)
|
||||
{
|
||||
path = addDirectoryName(uDirName, list->d_name);
|
||||
nextFile(path);
|
||||
free(path);
|
||||
char* pathName = addDirectoryName(uDirName, list->d_name);
|
||||
nextFile(pathName);
|
||||
free(pathName);
|
||||
}
|
||||
}
|
||||
|
||||
closedir(source);
|
||||
free(uDirName);
|
||||
}
|
||||
free(uDirName);
|
||||
}
|
||||
|
||||
|
||||
/* The lexer calls yywrap to handle EOF conditions */
|
||||
|
||||
/*
|
||||
* The lexer calls yywrap to handle EOF conditions
|
||||
*/
|
||||
int yywrap()
|
||||
{
|
||||
/* Close the file for the buffer which has just reached EOF */
|
||||
|
||||
@ -35,12 +35,12 @@ Description
|
||||
only once. This is why this program is faster than cpp.
|
||||
|
||||
Usage
|
||||
wmkdep [ -Idirectory ... -Idirectory ] filename
|
||||
wmkdepend [ -Idir ... -Idir ] [ -iheader .. -iheader ] filename
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "wmkdependParser.h"
|
||||
@ -58,7 +58,10 @@ void printUsage(const char* message = NULL)
|
||||
fwprintf
|
||||
(
|
||||
stderr,
|
||||
L"Usage: wmkdepend [ -Idirectory ... -Idirectory ] filename\n"
|
||||
L"Usage: wmkdepend %s filename\nOptions:\n%s\n",
|
||||
"[ -Idir ... -Idir ] [ -iheader .. -iheader ]",
|
||||
" -Idir specify include directory\n"
|
||||
" -iheader specify header name to ignore\n"
|
||||
);
|
||||
}
|
||||
|
||||
@ -67,23 +70,33 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
if (argc == 1)
|
||||
{
|
||||
printUsage("Error: input file not supplied");
|
||||
printUsage("input file not supplied");
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
for (int i=1; i < argc; i++)
|
||||
{
|
||||
if (strncmp(argv[i], "-I", 2) == 0 && strlen(argv[i]) > 2)
|
||||
if (strncmp(argv[i], "-I", 2) == 0)
|
||||
{
|
||||
std::string dirName(argv[i] + 2);
|
||||
|
||||
// add trailing slash if required
|
||||
if (dirName.rfind('/') != dirName.size()-1)
|
||||
if (strlen(argv[i]) > 2)
|
||||
{
|
||||
dirName += '/';
|
||||
}
|
||||
std::string dirName(argv[i] + 2);
|
||||
|
||||
wmake::Parser::includeDirs.push_back(dirName);
|
||||
// add trailing slash if required
|
||||
if (dirName.rfind('/') != dirName.size()-1)
|
||||
{
|
||||
dirName += '/';
|
||||
}
|
||||
|
||||
wmake::Parser::includeDirs.push_back(dirName);
|
||||
}
|
||||
}
|
||||
else if (strncmp(argv[i], "-i", 2) == 0)
|
||||
{
|
||||
if (strlen(argv[i]) > 2)
|
||||
{
|
||||
wmake::Parser::visitedFiles.insert(argv[i] + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +130,7 @@ int main(int argc, char* argv[])
|
||||
fwprintf
|
||||
(
|
||||
stderr,
|
||||
L"Cannot find extension in source file name %s\n",
|
||||
L"cannot find extension in source file name %s\n",
|
||||
sourceFile.c_str()
|
||||
);
|
||||
::exit(1);
|
||||
|
||||
@ -2,10 +2,6 @@
|
||||
Attributed Grammar for Coco/R (-*- C++ -*- version)
|
||||
compile with:
|
||||
coco-cpp wmkdependParser.atg
|
||||
For example,
|
||||
$WM_THIRD_PARTY_DIR/coco-cpp/platforms/$WM_ARCH$WM_COMPILER/bin/coco-cpp \
|
||||
-frames $WM_THIRD_PARTY_DIR/coco-cpp/platforms/share/coco-cpp \
|
||||
wmkdependParser.atg
|
||||
\*---------------------------------------------------------------------------*/
|
||||
[copy]
|
||||
/*---------------------------------*- C++ -*---------------------------------*\
|
||||
@ -59,9 +55,6 @@ COMPILER wmkdepend
|
||||
/*---------------------------------------------------------------------------*/
|
||||
private:
|
||||
|
||||
//! Set of files already visited
|
||||
static std::set<std::string> visitedFiles_;
|
||||
|
||||
//! Set of (java) directories already visited
|
||||
static std::set<std::string> visitedDirs_;
|
||||
|
||||
@ -75,6 +68,9 @@ private:
|
||||
static void importFile(const std::string& name);
|
||||
|
||||
public:
|
||||
//! Set of files already visited
|
||||
static std::set<std::string> visitedFiles;
|
||||
|
||||
//! Include directories to search
|
||||
static std::list<std::string> includeDirs;
|
||||
|
||||
@ -95,9 +91,9 @@ public:
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
std::set<std::string> Parser::visitedFiles_;
|
||||
std::set<std::string> Parser::visitedDirs_;
|
||||
|
||||
std::set<std::string> Parser::visitedFiles;
|
||||
std::list<std::string> Parser::includeDirs;
|
||||
std::string Parser::sourceFile;
|
||||
std::string Parser::depFile;
|
||||
@ -123,7 +119,7 @@ void Parser::ignoreDir(const std::string& name)
|
||||
|
||||
void Parser::includeFile(const std::string& name)
|
||||
{
|
||||
if (!visitedFiles_.insert(name).second)
|
||||
if (!visitedFiles.insert(name).second)
|
||||
{
|
||||
return; // already existed (did not insert)
|
||||
}
|
||||
@ -170,6 +166,9 @@ void Parser::includeFile(const std::string& name)
|
||||
L"could not open file %s for source file %s\n",
|
||||
name.c_str(), sourceFile.c_str()
|
||||
);
|
||||
|
||||
// only report the first occurance
|
||||
visitedFiles.insert(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ SourceFiles
|
||||
generated
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// This file was generated with Coco/R C++ (7 Feb 2010)
|
||||
// This file was generated with Coco/R C++ (10 Mar 2010)
|
||||
// http://www.ssw.uni-linz.ac.at/coco/
|
||||
// with these defines:
|
||||
// - FORCE_UTF8
|
||||
@ -52,9 +52,9 @@ namespace wmake {
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
std::set<std::string> Parser::visitedFiles_;
|
||||
std::set<std::string> Parser::visitedDirs_;
|
||||
|
||||
std::set<std::string> Parser::visitedFiles;
|
||||
std::list<std::string> Parser::includeDirs;
|
||||
std::string Parser::sourceFile;
|
||||
std::string Parser::depFile;
|
||||
@ -80,7 +80,7 @@ void Parser::ignoreDir(const std::string& name)
|
||||
|
||||
void Parser::includeFile(const std::string& name)
|
||||
{
|
||||
if (!visitedFiles_.insert(name).second)
|
||||
if (!visitedFiles.insert(name).second)
|
||||
{
|
||||
return; // already existed (did not insert)
|
||||
}
|
||||
@ -127,6 +127,9 @@ void Parser::includeFile(const std::string& name)
|
||||
L"could not open file %s for source file %s\n",
|
||||
name.c_str(), sourceFile.c_str()
|
||||
);
|
||||
|
||||
// only report the first occurance
|
||||
visitedFiles.insert(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ SourceFiles
|
||||
generated
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// This file was generated with Coco/R C++ (7 Feb 2010)
|
||||
// This file was generated with Coco/R C++ (10 Mar 2010)
|
||||
// http://www.ssw.uni-linz.ac.at/coco/
|
||||
// with these defines:
|
||||
// - FORCE_UTF8
|
||||
@ -122,9 +122,6 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
//! Set of files already visited
|
||||
static std::set<std::string> visitedFiles_;
|
||||
|
||||
//! Set of (java) directories already visited
|
||||
static std::set<std::string> visitedDirs_;
|
||||
|
||||
@ -138,6 +135,9 @@ private:
|
||||
static void importFile(const std::string& name);
|
||||
|
||||
public:
|
||||
//! Set of files already visited
|
||||
static std::set<std::string> visitedFiles;
|
||||
|
||||
//! Include directories to search
|
||||
static std::list<std::string> includeDirs;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ SourceFiles
|
||||
generated
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// This file was generated with Coco/R C++ (7 Feb 2010)
|
||||
// This file was generated with Coco/R C++ (10 Mar 2010)
|
||||
// http://www.ssw.uni-linz.ac.at/coco/
|
||||
// with these defines:
|
||||
// - FORCE_UTF8
|
||||
|
||||
@ -32,7 +32,7 @@ SourceFiles
|
||||
generated
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// This file was generated with Coco/R C++ (7 Feb 2010)
|
||||
// This file was generated with Coco/R C++ (10 Mar 2010)
|
||||
// http://www.ssw.uni-linz.ac.at/coco/
|
||||
// with these defines:
|
||||
// - FORCE_UTF8
|
||||
|
||||
48
wmake/wclean
48
wmake/wclean
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -27,8 +27,8 @@
|
||||
# wclean
|
||||
#
|
||||
# Description
|
||||
# Clean up the wmake control directory Make and remove the include
|
||||
# directories generated for libraries.
|
||||
# Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
|
||||
# lnInclude directories generated for libraries.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
@ -36,18 +36,23 @@ Script=${0##*/}
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
usage: $Script [dir]
|
||||
$Script target [dir [MakeDir]]
|
||||
|
||||
Clean up the wmake control directory Make and remove the include
|
||||
directories generated for libraries.
|
||||
Usage: $Script [OPTION] [dir]
|
||||
$Script [OPTION] target [dir [MakeDir]]
|
||||
|
||||
options:
|
||||
-help print the usage
|
||||
|
||||
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
|
||||
lnInclude directories generated for libraries.
|
||||
|
||||
The targets correspond to a subset of the 'wmake' special targets:
|
||||
all all subdirectories
|
||||
exe cleans dir/Make
|
||||
lib cleans dir/Make and dir/lnInclude
|
||||
libso cleans dir/Make and dir/lnInclude
|
||||
libo cleans dir/Make and dir/lnInclude
|
||||
(NB: any Allwclean or Allclean files will be used if they exist)
|
||||
exe clean dir/Make
|
||||
lib clean dir/Make and dir/lnInclude
|
||||
libo clean dir/Make and dir/lnInclude
|
||||
libso clean dir/Make and dir/lnInclude
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
@ -77,16 +82,11 @@ then
|
||||
makeOption=$1
|
||||
fi
|
||||
|
||||
if [ $# -ge 2 ]
|
||||
then
|
||||
dir=$2
|
||||
fi
|
||||
# specified directory name:
|
||||
[ $# -ge 2 ] && dir=$2
|
||||
|
||||
# alternative name for the Make sub-directory
|
||||
if [ $# -ge 3 ]
|
||||
then
|
||||
MakeDir=$3
|
||||
fi
|
||||
# specified alternative name for the Make sub-directory:
|
||||
[ $# -ge 3 ] && MakeDir=$3
|
||||
|
||||
if [ "$dir" ]
|
||||
then
|
||||
@ -106,7 +106,11 @@ fi
|
||||
|
||||
if [ "$makeOption" = all ]
|
||||
then
|
||||
if [ -e Allclean ]
|
||||
if [ -e Allwclean ] # consistent with Allwmake
|
||||
then
|
||||
./Allwclean
|
||||
exit $?
|
||||
elif [ -e Allclean ] # often used for tutorial cases
|
||||
then
|
||||
./Allclean
|
||||
exit $?
|
||||
@ -141,7 +145,7 @@ rm -rf $MakeDir/$WM_OPTIONS $MakeDir/classes 2>/dev/null
|
||||
find . -name "*.dep" -exec rm {} \;
|
||||
|
||||
case "$makeOption" in
|
||||
lib | libso | libo )
|
||||
lib | libo | libso )
|
||||
rm -rf lnInclude 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -62,6 +62,6 @@ find . -depth -type d \( -name lnInclude -o -name ii_files -o -name Templates.DB
|
||||
echo "Removing misc files"
|
||||
find . \( -name exe -o -name log -o -name so_locations \) -exec rm {} \;
|
||||
|
||||
( cd tutorials && ./Allclean )
|
||||
tutorials/Allclean
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
32
wmake/wmake
32
wmake/wmake
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -35,27 +35,32 @@ Script=${0##*/}
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
usage: $Script [dir]
|
||||
$Script target [dir [MakeDir]]
|
||||
|
||||
Usage: $Script [OPTION] [dir]
|
||||
$Script [OPTION] target [dir [MakeDir]]
|
||||
|
||||
options:
|
||||
-help print the usage
|
||||
|
||||
A general, easy-to-use make system for multi-platform development
|
||||
|
||||
The 'target' is a Makefile target:
|
||||
e.g., Make/linux64GccDPOpt/fvMesh.o
|
||||
|
||||
or a special target:
|
||||
or a special target:
|
||||
all all subdirectories
|
||||
(NB: any Allwmake files will be used if they exist)
|
||||
exe build statically linked executable
|
||||
lib build statically linked archive lib (.a)
|
||||
libso build dynamically linked lib (.so)
|
||||
libo build statically linked lib (.o)
|
||||
libso build dynamically linked lib (.so)
|
||||
jar build Java jar
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
}
|
||||
|
||||
# provide immediate help, even if none of the environment is set
|
||||
# provide immediate help, even if environment is not set
|
||||
if [ "$1" = "-h" -o "$1" = "-help" ]
|
||||
then
|
||||
usage
|
||||
@ -130,16 +135,11 @@ then
|
||||
makeOption=$1
|
||||
fi
|
||||
|
||||
if [ $# -ge 2 ]
|
||||
then
|
||||
dir=$2
|
||||
fi
|
||||
# specified directory name:
|
||||
[ $# -ge 2 ] && dir=$2
|
||||
|
||||
# alternative name for the Make sub-directory
|
||||
if [ $# -ge 3 ]
|
||||
then
|
||||
MakeDir=$3
|
||||
fi
|
||||
# specified alternative name for the Make sub-directory:
|
||||
[ $# -ge 3 ] && MakeDir=$3
|
||||
|
||||
if [ "$dir" ]
|
||||
then
|
||||
@ -221,7 +221,7 @@ OBJECTS_DIR=$MakeDir/$WM_OPTIONS
|
||||
touch $OBJECTS_DIR/dontIncludeDeps
|
||||
|
||||
case "$makeOption" in
|
||||
lib | libso | libo )
|
||||
lib | libo | libso )
|
||||
$make -s -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/dontIncludeDeps lnInclude/uptodate
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user