2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
8 #-------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
29 # Constructs all the file list for make given the source file list,
30 # written by hand or using makeFilesAndOptions.
32 #------------------------------------------------------------------------------
34 [ -d "$WM_OPTIONS" ] ||
{
35 echo "The '$WM_OPTIONS' directory does not exist, exiting" 1>&2
39 # change to the $WM_OPTIONS directory
40 cd "$WM_OPTIONS" 2>/dev
/null ||
{
41 echo "Could not change to directory '$WM_OPTIONS'" 1>&2
45 # Find and keep macro definitions in files list
46 grep "=" files
> filesMacros
48 # Remove all macro definitions from the files list
49 grep -v "=" files
> filesPlusBlank
51 # Add a newline to files to ensure the last line is followed by a newline
52 echo "" >> filesPlusBlank
55 # Remove commented lines, blank lines, and trailing blanks from files
56 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 filesPlusBlank
> files.$$
67 echo "SOURCE = " > tmpSourceFile
68 cat files.$$
>> tmpSourceFile
72 tmpSourceFile
> sourceFiles
80 -e 's%^%$(OBJECTS_DIR)/%' \
81 -e 's%\.[a-zA-Z]*$%\.o%' \
82 files.$$
> tmpObjectFiles
84 echo "OBJECTS = " > tmpObjectFiles2
85 cat tmpObjectFiles
>> tmpObjectFiles2
89 tmpObjectFiles2
> objectFiles
91 rm tmpObjectFiles tmpObjectFiles2
94 # make localObjectFiles
95 # ~~~~~~~~~~~~~~~~~~~~~
97 -e 's%\.[a-zA-Z]*$%\.o%' \
98 files.$$
> tmpLocalObjectFiles
100 echo "LOCAL_OBJECTS = " > tmpLocalObjectFiles2
101 cat tmpLocalObjectFiles
>> tmpLocalObjectFiles2
105 tmpLocalObjectFiles2
> localObjectFiles
107 rm tmpLocalObjectFiles tmpLocalObjectFiles2
110 # make dependencyFiles
111 # ~~~~~~~~~~~~~~~~~~~~
112 sed 's/\.[a-zA-Z]*$/\.dep/' \
113 files.$$
> tmpDependencyFiles
115 echo "DEPENDENCIES = " > tmpDependencyFiles2
116 cat tmpDependencyFiles
>> tmpDependencyFiles2
120 tmpDependencyFiles2
> dependencyFiles
122 rm tmpDependencyFiles tmpDependencyFiles2
127 sed -e 's/\.[a-zA-Z]*$/.dep/' \
129 files.$$
> includeDeps
133 #------------------------------------------------------------------------------