Merge branch 'master' of ssh://opencfd@repo.or.cz/srv/git/OpenFOAM-1.6.x
[OpenFOAM-1.6.x.git] / wmake / wmakeDerivedFiles
blobfe6d53e08c3d56a9e2b9789e2c83c0b83da1cf99
1 #!/bin/sh
2 #------------------------------------------------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #-------------------------------------------------------------------------------
9 # License
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 the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # 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
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # Script
27 # wmakeDerivedFiles
29 # Description
30 # Constructs all the file list for make given the source file list
31 # (which written by hand or using makeFilesAndDirectories.)
33 #------------------------------------------------------------------------------
35 if [ ! -d "$WM_OPTIONS" ]
36 then
37 echo "The $WM_OPTIONS directory does not exist, exiting" 1>&2
38 exit 1
41 # change to the $WM_OPTIONS directory
42 cd $WM_OPTIONS 2>/dev/null || {
43 echo "Could not change to directory '$WM_OPTIONS'" 1>&2
44 exit 1
47 # Find and keep macro definitions in files list
48 grep "=" files > filesMacros
50 # Remove all macro definitions from the files list
51 grep -v "=" files > filesPlusBlank
53 # Add a newline to files to make sure the last line is followed by a newline
54 echo "" >> filesPlusBlank
57 # Remove commented lines blank lines, and trailing blanks from files
58 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 sed -e '/^#/ d' \
60 -e '/^[ \t]*$/ d' \
61 -e 's/[ \t]*$//' \
62 filesPlusBlank > files.$$
64 rm filesPlusBlank
67 # make sourceFiles
68 # ~~~~~~~~~~~~~~~~
69 echo "SOURCE = " > tmpSourceFile
70 cat files.$$ >> tmpSourceFile
72 sed -e 's/$/\\/' \
73 -e '$s/\\//' \
74 tmpSourceFile > sourceFiles
76 rm tmpSourceFile
79 # make objectFiles
80 # ~~~~~~~~~~~~~~~~
81 sed -e 's%.*/%%' \
82 -e 's%^%$(OBJECTS_DIR)/%' \
83 -e 's%\.[a-zA-Z]*$%\.o%' \
84 files.$$ > tmpObjectFiles
86 echo "OBJECTS = " > tmpObjectFiles2
87 cat tmpObjectFiles >> tmpObjectFiles2
89 sed -e 's/$/\\/' \
90 -e '$s/\\//' \
91 tmpObjectFiles2 > objectFiles
93 rm tmpObjectFiles tmpObjectFiles2
96 # make localObjectFiles
97 # ~~~~~~~~~~~~~~~~~~~~~
98 sed -e 's%.*/%%' \
99 -e 's%\.[a-zA-Z]*$%\.o%' \
100 files.$$ > tmpLocalObjectFiles
102 echo "LOCAL_OBJECTS = " > tmpLocalObjectFiles2
103 cat tmpLocalObjectFiles >> tmpLocalObjectFiles2
105 sed -e 's/$/\\/' \
106 -e '$s/\\//' \
107 tmpLocalObjectFiles2 > localObjectFiles
109 rm tmpLocalObjectFiles tmpLocalObjectFiles2
112 # make dependencyFiles
113 # ~~~~~~~~~~~~~~~~~~~~
114 sed 's/\.[a-zA-Z]*$/\.dep/' \
115 files.$$ > tmpDependencyFiles
117 echo "DEPENDENCIES = " > tmpDependencyFiles2
118 cat tmpDependencyFiles >> tmpDependencyFiles2
120 sed -e 's/$/\\/' \
121 -e '$s/\\//' \
122 tmpDependencyFiles2 > dependencyFiles
124 rm tmpDependencyFiles tmpDependencyFiles2
127 # make includeDeps
128 # ~~~~~~~~~~~~~~~~
129 sed -e 's/\.[a-zA-Z]*$/.dep/' \
130 -e 's/^/include /' \
131 files.$$ > includeDeps
133 rm files.$$
135 cd ..
137 #------------------------------------------------------------------------------